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
 

 

Cobol 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: Wed Jul 05, 2006 4:08 pm    Post subject: Cobol Program Error.
Reply with quote

Hi all,

Please review the code below and i faced some error. can any one please let me know the solution.

Code:
IDENTIFICATION DIVISION.
        PROGRAM-ID. STDCOPY.
        ENVIRONMENT DIVISION.
        INPUT-OUTPUT SECTION.
        FILE-CONTROL.
        SELECT STD-FILE
                ASSIGN TO "std.dat"
                ORGANIZATION IS INDEXED
                RECORD KEY IS SROLL
                FILE STATUS IS FS
                ACCESS MODE IS RANDOM.
        SELECT NEW-STD-FILE
               ASSIGN TO "stdnew.dat"
               ORGANIZATION IS INDEXED
               RECORD KEY IS SROLL
               ALTERNATE KEY IS SNAME WITH DUPLICATE
               FILE STATUS IS FS1
               ACCESS MODE IS DYNAMIC.
        DATA DIVISION.
        FILE SECTION.
       
               COPY "stddesc.cbl"

        FD NEW-STD-FILE.
        01 NEW-STD-DET.
           02 NEW-SROLL PIC 9(3).
           02 FILLER PIC X(2).
           02 NEW-SNAME PIC X(30).
           02 FILLER PIC X.
           02 NEW-SINIT PIC X(2).
           02 FILLER PIC X(2).
           02 NEW-SMARK1 PIC 999.
           02 FILLER PIC X(2).
           02 NEW-SMARK2 PIC 999.
           02 FILLER PIC X(2).
           02 NEW-SMARK3 PIC 999.
           02 FILLER PIC X(2).
           02 NEW-STOTAL PIC 9999.

        WORKING-STORAGE SECTION.
        77 EOF PIC X VALUE "N".
        PROCEDURE DIVISION.
        PARA-START.
            DISPLAY " ".
            DISPLAY "******** PROGRAM TO READ DATA FROM OLD FILE**".
            DISPLAY "******** AND WRITE IN NEW FILE **************".
            PERFORM OPEN-FILE.
            PERFORM PROCESS-FILE.
            PERFORM CLOSE-FILE.
            STOP RUN.
        OPEN-FILE.
            OPEN OUTPUT NEW-STD-FILE.
            OPEN I-O STD-FILE.
        PROCESS-FILE.
            PERFORM READ-OLD-FILE.
            PERFORM PROCESS-NEW-FILE UNTIL EOF = 'Y'.
        READ-OLD-FILE.
            MOVE 'N' TO EOF.
            READ STD-FILE
               AT END
               MOVE 'Y' TO EOF.
        PROCESS-NEW-FILE.
            MOVE STD-DET TO NEW-STD-DET.
            WRITE NEW-STD-DET
                INVALID KEY
                DISPLAY " ERROR WITH KEY ".
            PERFORM READ-OLD-FILE.


In the above code i faced the error

Quote:
12 SELECT NEW-STD-FILE
13 ASSIGN TO "stdnew.dat"
14 ORGANIZATION IS INDEXED
15 RECORD KEY IS SROLL
16 ALTERNATE KEY IS SNAME WITH DUPLICATE
E034E line= 16 col= 43 "DUPLICATE"
17 FILE STATUS IS FS1
18 ACCESS MODE IS DYNAMIC.
19 DATA DIVISION.
20 FILE SECTION.
21
22 COPY "stddesc.cbl"
23
24 FD NEW-STD-FILE.
25c FD STD-FILE.
C035E line= 25(stddesc.cbl:01:) col= 19
40 01 NEW-STD-DET.
41 02 NEW-SROLL PIC 9(3).
42 02 FILLER PIC X(2).
43 02 NEW-SNAME PIC X(30).
44 02 FILLER PIC X.
'
'
'
72 READ-OLD-FILE.
73 MOVE 'N' TO EOF.
74 READ STD-FILE NEXT RECORD
R108E line= 74(:59:) col= 26 "NEXT"
75 AT END
76 MOVE 'Y' TO EOF.
R108E line= 76(:61:) col= 15 "MOVE"
77 PROCESS-NEW-FILE.
78 MOVE STD-DET TO NEW-STD-DET.
79 WRITE NEW-STD-DET


Can any one solve me this above problem. If i use
READ STD-FILE
INVALID KEY DISPLAY ";;;"...
it accepts but NEXT RECORD is not accepting ... i m confusing a lot in this.
Back to top
View user's profile Send private message

prashantshinde

New User


Joined: 25 Nov 2005
Posts: 44
Location: Pune

PostPosted: Wed Jul 05, 2006 5:08 pm    Post subject: Re: Cobol Program Error.
Reply with quote

Quote:
12 SELECT NEW-STD-FILE
13 ASSIGN TO "stdnew.dat"
14 ORGANIZATION IS INDEXED
15 RECORD KEY IS SROLL
16 ALTERNATE KEY IS SNAME WITH DUPLICATE
E034E line= 16 col= 43 "DUPLICATE"


Are record key(SROLL) and duplicate key(SNAME) in NEW-STD-FILE correct ? and do they need to be defined in DATA DIVISION>FILE SECTION>FD NEW-STD-FILE
Back to top
View user's profile Send private message
Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Thu Jul 06, 2006 10:43 am    Post subject: Re: Cobol Program Error.
Reply with quote

Hi

Plaese put 'START' before reading the file.

ie. Initialize <key-filed>.
Start <file-name> key is greater than <key-fileld>.

Then execute read-next.

Regards

Aji Cherian
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Thu Jul 06, 2006 3:59 pm    Post subject: Re: Cobol Program Error.
Reply with quote

prashantshinde
Quote:
Are record key(SROLL) and duplicate key(SNAME) in NEW-STD-FILE correct ? and do they need to be defined in DATA DIVISION>FILE SECTION>FD NEW-STD-FILE


I have did a mistake so i changed as
Code:
SELECT NEW-STD-FILE
               ASSIGN TO "stdnew.dat"
               ORGANIZATION IS INDEXED
               RECORD KEY IS NEW-SROLL
               ALTERNATE KEY IS NEW-SNAME WITH DUPLICATE
               FILE STATUS IS FS1
               ACCESS MODE IS DYNAMIC.


But still i receive the same error... the compiler shows the DUPLICATE verb as error... i m not sure of it.


Aji,
Quote:
Plaese put 'START' before reading the file.

ie. Initialize <key-filed>.
Start <file-name> key is greater than <key-fileld>.

Then execute read-next.


Can you proceed with code . i cant get ur idea!!!!!
Back to top
View user's profile Send private message
Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Thu Jul 06, 2006 4:33 pm    Post subject: Re: Cobol Program Error.
Reply with quote

Hi,

You have to use 'start' first , whenever you use read-next. This is mandatory in cobol.

(Since i don't have the FD of std-file, I assume that std-key is the
key-field in your FD, If not replace std-key with your key-field)
Put this below line in one paragraph.

Intialize std-key.
start std-file key not < std-key.

put READ-NEXT in another para.

read std-file next record at end
move 'Y' to eof.

Regards

Aji Cherian
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Thu Jul 06, 2006 6:20 pm    Post subject: Re: Cobol Program Error.
Reply with quote

Hi Aji,

Quote:
70 START STD-FILE KEY NOT < SROLL.
R110E line= 70(:55:) col= 27 "KEY"


I received the above error. Can you plz help me on that. If applicable get me one example prog. i will manage from that !!!!
Back to top
View user's profile Send private message
Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Fri Jul 07, 2006 10:34 am    Post subject: Re: Cobol Program Error.
Reply with quote

Hi

Please send me the error status(file status) when you tried to 'Start'.

Regards

Aji Cherian
Back to top
View user's profile Send private message
prashantshinde

New User


Joined: 25 Nov 2005
Posts: 44
Location: Pune

PostPosted: Fri Jul 07, 2006 11:23 am    Post subject: Re: Cobol Program Error.
Reply with quote

[quote="khamarutheen

Code:
SELECT NEW-STD-FILE
               ASSIGN TO "stdnew.dat"
               ORGANIZATION IS INDEXED
               RECORD KEY IS NEW-SROLL
               ALTERNATE KEY IS NEW-SNAME WITH DUPLICATE
               FILE STATUS IS FS1
               ACCESS MODE IS DYNAMIC.


But still i receive the same error... the compiler shows the DUPLICATE verb as error... i m not sure of it.

[/quote]

Try using DUPLICATES...may be that extra 'S' will help you.
And if possible attach the file showing ur program and JES messages.
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
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm


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