Using VSAM status codes (VSAM files only)
Often the COBOL file status code is too general to pinpoint
the disposition of a request. You can get more detailed information
about VSAM input or output requests by coding a second data item in
the FILE STATUS
clause.
About this task
FILE STATUS IS data-name-1 data-name-8
The data item data-name-1 shown above specifies the COBOL file status key, which you define as a two-character alphanumeric or national data item, or as a two-digit zoned decimal or national decimal item.
The data item data-name-8 specifies the VSAM status code, which you define as a 6-byte alphanumeric group data item that has three subordinate 2-byte binary fields. The VSAM status code contains meaningful values when the COBOL file status key is not 0.
You can define data-name-8 in
the WORKING-STORAGE SECTION
, as in VSAM-CODE
below.
01 RETURN-STATUS.
05 FS-CODE PIC X(2).
05 VSAM-CODE.
10 VSAM-R15-RETURN PIC S9(4) Usage Comp-5.
10 VSAM-FUNCTION PIC S9(4) Usage Comp-5.
10 VSAM-FEEDBACK PIC S9(4) Usage Comp-5.
Enterprise COBOL uses data-name-8 to
pass information supplied by VSAM. In the following example, FS-CODE
corresponds
to data-name-1 and VSAM-CODE
corresponds
to data-name-8:
Example: checking VSAM status codes
FILE STATUS clause (Enterprise COBOL for z/OS Language Reference)
File status key (Enterprise COBOL for z/OS Language Reference)
z/OS® DFSMS Macro Instructions for Data Sets (VSAM macro return and
reason codes)