C\
C\ Beginning of Mainline
C\
C\ Two parameters are being passed into this program.
C\
C \ENTRY PLIST Parm list
C PARM JOBD Job descrp
C PARM JOBDL Jobd library
C\
C\ Move the two parameters passed into LFNAM.
C\
C JOBD CAT JOBDL LFNAM Qlfd name
C\
C\ Error code parameter is set to 16.
C\
C Z-ADD16 QUSBNB Bytes provid
C\
C\ Instead of specifying 'QWCRJOBD', I could have used the
C\ constant QWDBGB that was defined in the QWDRJOBD include.
C\ Call the API
C\
C CALL 'QWDRJOBD' Parm list
C PARM QWDBH Receiver Var.
C PARM RCVLEN Length RCVVAR
C PARM FORMAT Format Name
C PARM LFNAM Qual. Job Desc
C PARM QUSBN Error Code
C\ If no bytes available, API was successful; print HOLD value
C QUSBNC IFEQ ð
C EXCPTGOOD
C ENDIF
C\ If some bytes available, API failed; print error message ID
C QUSBNC IFGT ð
C EXCPTBAD
C ENDIF
C\ End of program
C SETON LR
C RETRN
C\
C\ End of MAINLINE
C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
O\
OQPRINT E 1ð6 GOOD
O 'HOLD value - '
O QWDBHN
OQPRINT E 1ð6 BAD
O 'Failed. Error ID - '
O QUSBND
The following data structures are used:
Error-code data structure
This defines the two binary fields used and the message ID that is returned for
error conditions.
Retrieve job description data structure
This defines format JOBD0100, a 390-byte data structure with the hold field in
positions 77-86.
Dummy data structure
This contains a field used for the length of the receiver variable. The field is
defined as binary and is in the first 4 bytes. The dummy data structure (.19/
on page 3-17) also contains the format field.
This data structure is used because RPG only allows binary variables to be
defined in the context of a data structure.
The program retrieves the parameter list that is passed and initializes the fields to
be passed to the API. The API is called and places information into the receiver-
3-18 System API Programming V4R1