C PARM RECVR
C PARM QUSBN
ᑍ
ᑍ DISPLAY THE JOB NAME
C DSPLY JNAME >>> When displayed,JNAME
ᑍ will look something like
ᑍ 'QCPF QS'
ᑍ DELETE THE SPACE THAT HELD THE DATA
C CALL 'QUSDLTUS'
C PARM SPCNAM
C PARM QUSBN
ᑍᑍ
C SETON LR
Defining A Data Structure—Example of Correct Coding
The following program uses a data structure that is supplied from the QSYSINC
library. When you use this data structure, you can prevent errors in data structure
creation from happening. If the data structures change from release to release,
updates to programs do not have to be done. The application program would have
to be updated only if a new field was added to the data structure and you wanted
to use the field. The copying of the QSYSINC data structure is shown at 6 on
page 9-7.
ᑍ
ᑍ
ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
ᑍ
ᑍProgram Name: PGM2
ᑍ
ᑍProgram Language: RPG
ᑍ
ᑍDescription: This sample program illustrates the correct
ᑍ way of defining data structures.
ᑍ
ᑍHeader Files Included: QUSEC - Error Code Parameter
ᑍ QUSGEN - User Space Format for Generic Header
ᑍ QUSLJOB - List Job API
ᑍ
ᑍAPIs Used: QUSCRTUS - Create User Space
ᑍ QUSLJOB - List Job
ᑍ QUSRTVUS - Retrieve User Space
ᑍ QUSDLTUS - Delete User Space
ᑍ
ᑍ
ᑍ THIS PROGRAM WILL CREATE THE NECESSARY SPACE AND THEN CALL
ᑍ THE QUSLJOB API TO GET A LIST OF ALL ACTIVE JOBS ON THE SYSTEM.
ᑍ THE FIRST JOB NAME/USER WILL BE DISPLAYED TO THE USER.
ᑍ
I/COPY QSYSINC/QRPGSRC,QUSGEN
I/COPY QSYSINC/QRPGSRC,QUSEC
I/COPY QSYSINC/QRPGSRC,QUSLJOB 6
ᑍᑍ JOB NAME STRUCTURE FOR CALLING QUSLJOB
IJOBNAM DS
I I 'ᑍALL ' 1 1 JOB
I I 'ᑍALL ' 11 2 USER
I I 'ᑍALL' 21 26 JOBNUM
ᑍᑍ JOBL1 FORMAT RETURNED FROM QUSLJOB API
Chapter 9. Common API Programming Errors 9-7