Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

DOS cobol compiler program error

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Mon Jun 19, 2006 1:10 pm    Post subject: DOS cobol compiler program error
Reply with quote

Hi all,
Please have a look at the below code and help me to resolve the below error :

Code:
 IDENTIFICATION DIVISION.
        PROGRAM-ID. RNDFILE.
        ENVIRONMENT DIVISION.
        INPUT-OUTPUT SECTION.
        FILE-CONTROL.
            SELECT STD-FILE
                ASSIGN TO "std.bat"
                ORGANIZATION IS INDEXED
                RECORD KEY IS SROLL
                FILE STATUS IS FS
                ACCESS MODE IS RANDOM.
        DATA DIVISION.
        FILE SECTION.
        FD STD-FILE.
        01 STD-DET.
           02 SROLL PIC 9(3).
           02 FILLER PIC X(2).
           02 SNAME PIC X(30).
           02 FILLER PIC X.
           02 SINIT PIC X(2).
           02 FILLER PIC X(2).
           02 SMARK1 PIC 999.
           02 FILLER PIC X(2).
           02 SMARK2 PIC 999.
           02 FILLER PIC X(2).
           02 SMARK3 PIC 999.
           02 FILLER PIC X(2).
           02 STOTAL PIC 9999.
        WORKING-STORAGE SECTION.
        01 CHO PIC X.
        01 MNUCHO PIC 9.
        01 FS PIC X(2).
        01 EOF PIC X.
        01 RNO PIC 999.
        01 FLD PIC 9.
        01 STD.
           02 SROLL1 PIC 9(3).
           02 SNAME1 PIC X(30).
           02 SINIT1 PIC XX.
           02 MARK1 PIC 999.
           02 MARK2 PIC 999.
           02 MARK3 PIC 999.
           02 TOTAL1 PIC 9999.
        PROCEDURE DIVISION.
        PARA1.
            MOVE 'N' TO EOF.
            DISPLAY " ".
        DISMENU.
            DISPLAY "1 --> WRITE ".
            DISPLAY "2 --> READ ".
            DISPLAY "3 --> APPEND".
            DISPLAY "4 --> EDIT".
            DISPLAY "5 --> DELETE".
            DISPLAY "------------------".
            DISPLAY "ENTER YOUR CHOICE ".
            ACCEPT MNUCHO.
            PERFORM CHK.
        CHK.
            IF MNUCHO = 1 PERFORM FILEWRT
             ELSE IF MNUCHO = 2  OPEN INPUT STD-FILE PERFORM FILERD UNTIL EOF = 'Y'
             ELSE IF MNUCHO = 3  OPEN I-O STD-FILE PERFORM FILEWRT
             ELSE IF MNUCHO = 4  OPEN I-O STD-FILE PERFORM FILEEDT
             ELSE DISPLAY "ERROR OCCURED " DISPLAY "FILE STATUS : " FS
            END-IF.
            CLOSE STD-FILE
            DISPLAY "DO YOU WANT TO CONTINUE (Y/N)? " .
            ACCEPT CHO.
            IF CHO = 'N' PERFORM DISMENU
            ELSE STOP RUN.
        FILEWRT.
            OPEN I-O STD-FILE.
            IF FS = '00' PERFORM ACPTDET
            ELSE DISPLAY " WRITE ERROR OCCURED !!!! FILE STATUS : " FS
            END-IF.
        ACPTDET.
            DISPLAY "FILE OPENED SUCCESSFULLY ".
            DISPLAY "-------------------------------".
            DISPLAY "ENTER STUDENT ROLL NO.".
            ACCEPT SROLL.
            DISPLAY "ENTER STUDENT NAME ".
            ACCEPT SNAME.
            DISPLAY "ENTER STUDENT INITIAL ".
            ACCEPT SINIT.
            DISPLAY "ENTER MARK1 ".
            ACCEPT SMARK1.
            DISPLAY "ENTER MARK2 ".
            ACCEPT SMARK2.
            DISPLAY "ENTER MARK3 ".
            ACCEPT SMARK3.
            COMPUTE STOTAL = SMARK1 + SMARK2 + SMARK3.
            WRITE STD-DET
               INVALID KEY DISPLAY "ROLL NO ALREADY EXISTS........."
               DISPLAY "FILE STATUS : " FS
            END-WRITE.
         FILERD.
             READ STD-FILE NEXT RECORD AT END MOVE 'Y' TO EOF.
             IF EOF NOT = 'Y' DISPLAY STD-DET
              ELSE DISPLAY "********END OF RECORD**********"
             END-IF.

        FILEEDT.
           DISPLAY "ENTER THE STUDENT ROLL NO TO EDIT ".
           ACCEPT RNO.
           READ STD-FILE
              KEY IS SROLL
              INVALID KEY DISPLAY " INVALID ROLL NO .. ERROR FS : " FS
           END-READ.
           DISPLAY "ENTER WHICH FIELD YOU NEED TO EDIT ".
           DISPLAY "CODE : 1.ROLLNO, 2.NAME, 3.MARKS ".
           ACCEPT FLD.
           IF FLD = 1 DISPLAY "ENTER ROLLNO :" ACCEPT SROLL1
             MOVE SROLL1 TO SROLL
           ELSE IF FLD = 2 DISPLAY "ENTER NAME : " ACCEPT SNAME1
             DISPLAY "ENTER INITIAL : " ACCEPT SINIT1
             MOVE SNAME1 TO SNAME
             MOVE SINIT1 TO SINIT
           ELSE IF FLD = 3 DISPLAY "ENTER MARK1 : " ACCEPT MARK1
             DISPLAY "ENTER MARK2 : " ACCEPT MARK2
             DISPLAY "ENTER MARK3 : " ACCEPT MARK3
             COMPUTE TOTAL1 = MARK1 + MARK2 + MARK3
             MOVE MARK1 TO SMARK1
             MOVE MARK2 TO SMARK2
             MOVE MARK3 TO SMARK3
             MOVE TOTAL1 TO STOTAL
           ELSE DISPLAY "INVALID CHOICE "
           END-IF.
           REWRITE STD-DET
             INVALID KEY DISPLAY "KEY ERROR !!!  " FS
           END-REWRITE.





I m using DOS cobol compiler. If i compile the above program i m receiving the following error .

Quote:
95 FILERD.
96 READ STD-FILE NEXT RECORD AT END MOVE 'Y' TO EOF.
R108E line= 96 col= 27 "NEXT"
R108E line= 96 col= 46 "MOVE"
97 IF EOF NOT = 'Y' DISPLAY STD-DET
98 ELSE DISPLAY "********END OF RECORD**********"
99 END-IF.
'
'
'
SOFTEK COBOL V1.003 SOURCE: RNDFILE.CBL DATE 19 Jun :6 TIME 03:33:02
PAGE: 00004

End of Compilation
2 Errors
0 Warnings
134 Source Lines
39 Symbols


As per me i dont thik there is any error in the READ NEXT sentence. I refered the book also. Can any one help me on this plzzzz

icon_cry.gif
Back to top
View user's profile Send private message

Jerry

New User


Joined: 16 Sep 2005
Posts: 42

PostPosted: Mon Jun 19, 2006 3:58 pm    Post subject:
Reply with quote

Hi khamarutheen

This might be the reason for your error. Here is what my manual says:

For random access, the value of rel-key (for relative files) or a Record Key
data item (for indexed files) indicates the record to be accessed.

For dynamic access, the program can access records sequentially and
randomly.

So, can you please try changing the access mode to dynamic. Probably, random does not allow you to read next...
Back to top
View user's profile Send private message
ralph_v

New User


Joined: 07 Jul 2005
Posts: 27

PostPosted: Mon Jun 19, 2006 5:05 pm    Post subject: Re: Cobol program error
Reply with quote

I also agree with Jerry.

NEXT RECORD is basically used after START statement so i would recommend you to change the access mode and try it.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Mon Jun 19, 2006 5:54 pm    Post subject: Cobol Program Error.
Reply with quote

Hi,

Thanks for your response. But even i changed the Access Mode still the problem arrises. If i m trying to read a single record i can but i was not able to read the whole record in a singe attempt.
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Mon Jun 26, 2006 5:24 pm    Post subject: Re: Cobol program error
Reply with quote

Hi khamarutheen,

A little bit of off topic,
I think that you are using compiler on DOS that supports COBOL 85 standards.

Can you send me the compiler that you are using? I desperately need it.

You can use 'PM' option to send me the compiler in zip file format.

Thanks in advance.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us