Microsoft KB Archive/35242

Method for Displaying COBOL Version 3.0 Binary File Status

PSS ID Number: Q35242 Article last modified on 04-21-1993

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

Summary: If the first status-key of the status is 9, the second status-key will be a 2-byte binary status-key. Below is a good method for displaying the file status in Microsoft COBOL Versions 3.0 and 3.0a.

More Information: The following example is shown on Page 7-20 of the “Microsoft COBOL 3.0: Operating Guide”: ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT FILE1 ASSIGN “TST.FIL” STATUS FILE1-STAT. DATA DIVISION. FILE SECTION. FD FILE1. 01 F1-REC PIC X(80). WORKING-STORAGE SECTION. 01 FILE1-STAT. 02 S1 PIC X. 02 S2 PIC X. 01 STAT-BIN REDEFINES FILE1-STAT PIC 9(4) COMP. 01 DISPLY-STAT. 02 S1-DISPL PIC X. 02 FILLER PIC X(3). 02 S2-DISPL PIC 9999. PROCEDURE DIVISION. START-TEST. OPEN INPUT FILE1. IF S1 NOT = “9” GO TO END-TEST. MOVE S1 TO S1-DISPL. MOVE LOW-VALUES TO S1. MOVE STAT-BIN TO S2-DISPL. DISPLAY DISPLY-STAT. END-TEST. STOP RUN.

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.