\

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 BLanguages-179

Page 457
Image 457
IBM Version 4 manual PROGRAM-ID. IFS Environment Division, Prt-Text Pic, User PIC, Curdir PRT-TEXT PIC, Initialdir PIC