Académique Documents
Professionnel Documents
Culture Documents
FILE-STATUS clause –
• Identifies one field that VSAM will use to provide information
about each input/output operations for the file
• Standard field that the system updates each time you
execute an I/O statement for the file
• The value that VSAM places in the file status area is called the
return code
• After the I/O statement has been executed, the procedure
should examine this field to determine if an error occurs. (if it’s
not zero, it’s wrong)
• File status field must be defined in WORKING-STORAGE as a 2
byte alphanumeric item
• Note: this status code is returned by the system.
10 - USED ON READ.
- END OF FILE REACHED
- PERFORM NORMAL “AT END” PROCESS
21 - USED ON WRITE
- RECORD IS OUT OF SEQUENCE (SEQUENTIAL ACCESS ONLY)
- PRINT ERROR MSG AND KEEP PROCESSING.
22 - USED ON WRITE
2
- DUPLICATE KEY
- PRINT ERROR MSG AND KEEP PROCESSING.
24 - USED ON WRITE
- NO MORE SPACE ON FILE.
- CONTINUE PROCESSING
91 - USED ON OPEN
- PASSWORD FAILURE (USED ONLY ON PROTECTED FILE
PROCESSING)
TERMINATE THE JOB
- USED IN OPEN
- NO DD STATEMENT (MUST HAVE FILE SPECIFIED IN THE JOB
STREAM)
TERMINATE JOB
3
97 - USED ON OPEN
- FILE NOT CLOSED BY PREVIOUS JOB
- THIS WOULD NOT HAVE HAPPENED IF PROGRAMMER
WOULD HAVE CHECKED THE FILE STATUS AT CLOSE OF
FILE ON LAST MONTH’S PROCESSING. )
HOWEVER, VSAM DOES AUTOMATICALLY ISSUE A CLOSE
STATEMENT PRIOR TO OPENING A FILE SO IT IS POSSIBLE TO
CONTINUE PROCESSING AFTER THIS MESSAGE. BUT DON’T GET
USED TO IT.
- TERMINATE THE JOB.
The operators, programmers, and users may not look at the program
closely - program to end normally but with errors. This may
not be good.
Real world
sometimes run jobs that call other jobs
These jobs may be depending on a previous job running perfectly
A normal stop run with errors this time may cause the domino effect
COBOL has no real solutions for handling this
Many shops create their own little way of handling this problem
The assembler language has 2 ways of inducing an (abend).
START 0
SAVE (14,12)
ABEND 100
END
TERMINATE-UPD-PROG.
DISPLAY ‘FILE STATUS IS: ‘, MAST-ERROR-CODE.
DISPLAY ‘ PROGRAM HAS TERMINATED.’.
CALL ‘ABEND200’.