Using Keys with List Spooled Files API—ILE COBOL Example
Refer to “Using Keys with List Spooled Files API—Example” on page 3-24 for the
original example. The following program also works for OPM COBOL.
IDENTIFICATION DIVISION.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\
\ Program: List Spooled Files for Current User
\
\ Language: ILE COBOL
\
\ Description: This example shows the steps necessary to
\ process keyed output from an API.
\
\ APIs Used: QUSLSPL - List Spooled Files
\ QUSCRTUS - Create User Space
\ QUSPTRUS - Retrieve Pointer to User Space
\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\
PROGRAM-ID. LSTSPL.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-AS4ðð.
OBJECT-COMPUTER. IBM-AS4ðð.
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.
\
\ Error Code parameter include. As this sample program
\ uses COPY to include the error code structure, only the first
\ 16 bytes of the error code structure are available. If the
\ application program needs to access the variable length
\ exception data for the error, the developer should physically
\ copy the QSYSINC include and modify the copied include to
\ define additional storage for the exception data.
\
COPY QUSEC OF QSYSINC-QLBLSRC.
\
\ Listing text
\
ð1 PRTLIN.
ð5 PRTFIL PIC X(1ð).
ð5 FILLER PIC X(ð5).
ð5 PAGES PIC S9(ð9).
ð5 FILLER PIC X(ð5).
B-38 System API Programming V4R1