Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AS/400 Cobol Program Error

Status
Not open for further replies.

Uvaiz

MIS
Jun 13, 2003
38
CA
Hi everyone,

I have developed a small COBOL program on AS400 and it was successfully compiled. Executing the program I encounter the following message

Cause . . . . . : Program TERRORLST in USERDEV issued an I/O operation on
file TERROR at COBOL statement 133 which failed with file status 95; and no
error handler existed. When an unsuccessful file status is received from an
I/O operation, an AT END/INVALID KEY, USE PROCEDURE, or FILE STATUS should
be coded to handle the error. Recovery . . . : Enter a G to continue the
program at the next COBOL statement; or a C,D, or F to cancel the program. A
D will also create a dump of the COBOL identifiers and an F will dump both

A summary of statements referred in the job log is as follows(this is from the compiled report);

100-Initialization-Rtn.

011800 100-INITIALIZATION-RTN.
011900
133 012000 OPEN INPUT BLACKLST
012100 INPUT MFAIVRP
012200 OUTPUT BLACK-LIST-REPORT-FILE.
134 012300 ACCEPT WS-RUN-DATE FROM DATE.
135 012400 MOVE WS-RUN-MONTH TO HL-RUN-MONTH.
136 012500 MOVE WS-RUN-DAY TO HL-RUN-DAY.
137 012600 MOVE WS-RUN-YEAR TO HL-RUN-YEAR.
138 012700 PERFORM 215-READ-MFAIVRP-RTN.

200-PROCESS-RECORD-RTN.

MOVE WS-FIRST-NAME TO TR-FIRST-NAME
READ BLACKLST
INVALID KEY
PERFORM 215-READ-MFAIVRP-RTN
NOT INVALID KEY
PERFORM 205-WRITE-RECORD-RTN
END-READ.

215-READ-MFAIVRP-RTN.

READ MFAIVRP
AT END
MOVE 'NO' TO ARE-THERE-MORE-IVRP
END-READ.
MOVE FIRST-NAME OF MFAIVRP TO WS-FIRST-NAME.
MOVE INITIALS OF MFAIVRP TO WS-MIDDLE-NAME.
MOVE LAST-NAME OF MFAIVRP TO WS-LAST-NAME.

Can anyone please help me to resolve this issue.

Thanks.
Tony
 
"95 = File Information invalid or incomplete".

I think we still need to see the file information in order to help.

Areas of interest:

1. SELECT statement.
2. FD clause.
3. Physical file specs.

Dimandja
 
Hello Dimandja,

The following are the details that you requested. This is from the compiled source.


SELECT BLACKLST
ASSIGN TO DATABASE-TERROR
ORGANIZATION IS INDEXED
ACCESS IS SEQUENTIAL
RECORD KEY IS EXTERNALLY-DESCRIBED-KEY.

FD BLACKLST.

01 BLACKLST-ACT-RECORD.
COPY DD-ALL-FORMATS OF TERROR.
05 TERROR-RECORD PIC X(43).
I-O FORMAT:TERRORR FROM FILE TERROR OF LIBRARY USERDEV
TERROR LIST MASTER FILE
THE KEY DEFINITIONS FOR RECORD FORMAT TERRORR
NUMBER NAME RETRIEVAL TYPE ALTSEQ
0001 TR-FIRST-NAME ASCENDING AN NO
05 TERRORR REDEFINES TERROR-RECORD.
06 TR-FIRST-NAME PIC X(20).
06 TR-MIDDLE-NAME PIC X(3).
06 TR-LAST-NAME PIC X(20).

Thanks,
Tony
 
shouldn't that be a ACCESS IS RANDOM select on the file in the means you are attemtping to read the file

___________________________________________________________________
onpnt2.gif

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
Thanks Dimandja,

Thats was very helpful and it worked.

Thanks again,
Tony
 
Hi Dimandja,

Just one more clarification,

When I submit the job call pgm(libl/pgm) i get still get this message but responding with G the program continues. Any clue for this message please.

Thank you in anticipation
Tony

Message . . . . : I/O operation failed in program TERRORLST in USERDEV (C D
F G).
Cause . . . . . : Program TERRORLST in USERDEV issued an I/O operation on
file TERROR at COBOL statement 133 which failed with file status 95; and no
error handler existed. When an unsuccessful file status is received from an
I/O operation, an AT END/INVALID KEY, USE PROCEDURE, or FILE STATUS should
be coded to handle the error. Recovery . . . : Enter a G to continue the
program at the next COBOL statement; or a C,D, or F to cancel the program. A
D will also create a dump of the COBOL identifiers and an F will dump both
the COBOL identifiers and the compiler-generated variables. Possible choices
for replying to message . . . . . . . . . . . . . . . : C -- No formatted
dump is given D -- A dump of the COBOL identifiers is given F -- A dump of
all variables is given G -- To continue the program at the next COBOL
statement
01/21/04 15:09:49.381136 QMHSCLVL QSYS 0640 QLRMAIN QSYS 05BB
Message . . . . : G
 
First, you should thank onpnt for that tip - instead of me.

I don't know much about the AS/400; hopefully someone here does.

You may still be having problems with the file definition. For example, I am surprised this code compiles at all:
Code:
01  BLACKLST-ACT-RECORD.                                               
COPY DD-ALL-FORMATS OF TERROR.                                         
      05  TERROR-RECORD PIC X(43).                                     
    I-O FORMAT:TERRORR    FROM FILE TERROR     OF LIBRARY USERDEV      
                  TERROR LIST MASTER FILE                              
THE KEY DEFINITIONS FOR RECORD FORMAT  TERRORR                         
  NUMBER               NAME               RETRIEVAL     TYPE    ALTSEQ
0001   TR-FIRST-NAME                    ASCENDING      AN      NO 
   05  TERRORR       REDEFINES TERROR-RECORD.                     
       06 TR-FIRST-NAME         PIC X(20).                        
       06 TR-MIDDLE-NAME        PIC X(3).                         
       06 TR-LAST-NAME          PIC X(20).
Someone with hands-on AS/400 will undoubtedly be able to help.

Dimandja
 
Uvaiz post the record format section from your source code. the compile portion doesn't tell us much of where there may be a conflict.

for example, for what you're doing all you should really have is
FD BLACKLST.
01 BLACKLST-ACT-RECORD
COPY DDS-ALL-FORMATS OF TERROR.



___________________________________________________________________
onpnt2.gif

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
Hi onpnt,

Thanks for all your inputs. Finally I have been able to resolve this issue by referring to AS400 COBOL guide. The problem encountered was in the handling of internal error messages.

This was made possible by using the file status command and adding the declarative statement in the Procedure Division as follows.
DECLARATIVES.
INPUT-FILE-ERROR SECTION.
USE AFTER STANDARD ERROR PROCEDURE ON BLACKLST.

Thanks again,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top