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(QWDDð1ðð: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