C IF QUSBAVL >
Cᑍ
Cᑍ If there was an error, exit to ERROR subroutine
Cᑍ
C EXSR ERROR
C ELSE
Cᑍ
Cᑍ Else, add 1 to the Initial library list offset because RPG
Cᑍ is a Base 1 language
Cᑍ
C QWDOILL ADD 1 X 5
C DO QWDNLILL
C EVAL LIBRARY = %SUBST(QWDD1:X:1)
Cᑍ
Cᑍ Let's tell everyone what the library value is
Cᑍ
C CALL 'QCMDEXC'
C PARM CMD_STRING
C PARM LENSTR
C ADD 11 X
C IF (X + 1) > RCVLEN
C LEAVE
C ENDIF
C ENDDO
C ENDIF
Cᑍ
C EVAL ᑍINLR = '1'
C RETURN
Cᑍ
Cᑍ End of MAINLINE
Cᑍ
Cᑍ Subroutine to handle errors returned in the error code parameter
Cᑍ
C ERROR BEGSR
Cᑍ
Cᑍ Process errors returned from the API. As this sample program
Cᑍ used /COPY to include the error code structure, only the first
Cᑍ 16 bytes of the error code structure are available. If the
Cᑍ application program needed to access the variable length
Cᑍ exception data for the error, the developer should physically
Cᑍ copy the QSYSINC include and modify the copied include to
Cᑍ define additional storage for the exception data.
Cᑍ
C ENDSR
Using Keys with List Spooled Files API—ILE C Example
Refer to “Using Keys with List Spooled Files API—Example” on page 3-24 for the
original example.
/ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ/
/ᑍ ᑍ/
/ᑍ Program: List Spooled Files for Current User ᑍ/
/ᑍ ᑍ/
/ᑍ Language: ILE C ᑍ/
/ᑍ ᑍ/
/ᑍ Description: This example shows the steps necessary to ᑍ/
/ᑍ process keyed output from an API ᑍ/
Appendix B. Original Examples in Additional Languages B-33