ᑍ Language: COBOL
ᑍ
ᑍ Description: Demonstrate use of integrated file system
ᑍ from ILE COBOL
ᑍ
ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
ᑍ
ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
PROGRAM-ID. IFS.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-AS4.
OBJECT-COMPUTER. IBM-AS4.
SPECIAL-NAMES.
ᑍ LINKAGE TYPE PROCEDURE FOR "geterrno",
LINKAGE TYPE PROCEDURE FOR "getuid",
LINKAGE TYPE PROCEDURE FOR "getcwd",
LINKAGE TYPE PROCEDURE FOR "open",
LINKAGE TYPE PROCEDURE FOR "write",
LINKAGE TYPE PROCEDURE FOR "close",
LINKAGE TYPE PROCEDURE FOR "read",
LINKAGE TYPE PROCEDURE FOR "unlink".
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT LISTING ASSIGN TO PRINTER-QPRINT
ORGANIZATION IS SEQUENTIAL.
DATA DIVISION.
ᑍ
FILE SECTION.
FD LISTING RECORD CONTAINS 132 CHARACTERS
LABEL RECORDS ARE STANDARD
DATA RECORD IS LIST-LINE.
1 LIST-LINE PIC X(132).
ᑍ
WORKING-STORAGE SECTION.
ᑍ
ᑍ Report lines
ᑍ
1 REALID.
5 PRT-TEXT PIC X(2) VALUE "The real user id is ".
5 USER PIC X(12).
1 CURDIR.
5 PRT-TEXT PIC X(21) VALUE "Current directory is ".
5 INITIALDIR PIC X(1).
1 NEWFIL.
5 PRT-TEXT PIC X(2) VALUE "Created file: ".
5 FILENAME PIC X(1).
1 DATAIN.
5 PRT-TEXT PIC X(2) VALUE "Successfully read: ".
5 DATA-READ PIC X(1).
1 ERRLIN.
5 PRT-TEXT PIC X(2) VALUE "The errno value is: ".
5 ERRVAL PIC X(12).
ᑍ
ᑍ Miscellaneous elements
ᑍ
1 BUFFER PIC X(32767).
1 LENGTH-OF-BUFFER PIC S9(9) BINARY VALUE 32767.
Appendix B. Original Examples in Additional Languages B-179