This program retrieves the HOLD value from a job description. It expects errors to be returned via the error code parameter.
Refer to Example in OPM RPG: Retrieving the HOLD parameter (error code structure) for the original example.
D*************************************************************** D*************************************************************** D* D* Program Name: JOBDAPI D* D* Programming Language: ILE RPG D* D* Description: This program retrieves the HOLD value from D* a job description. It expects errors to be D* returned via the error code parameter. D* D* Header Files Included: QUSEC - Error Code Parameter D* QWDRJOBD - Retrieve Job Description API D* D*************************************************************** D*************************************************************** D* D* Error Code parameter include D* D/COPY QSYSINC/QRPGLESRC,QUSEC (1) D* D* Retrieve Job Description API Include D* D/COPY QSYSINC/QRPGLESRC,QWDRJOBD D* D* Command string data structure D* DCMD_STRING DS D 26 INZ('SNDMSG MSG(''HOLD value is ') D HOLD 10 D 15 INZ(''') TOUSR(QPGMR)') DCMD_STR2 DS D 43 INZ('SNDMSG MSG(''Program failed - D with message ID ') D MSG_ID 7 D 15 INZ(''') TOUSR(QPGMR)') D* D* Miscellaneous data structure D* DRCVLEN S 9B 0 INZ(%SIZE(QWDD0100)) DFORMAT S 8 INZ('JOBD0100') DLENSTR S 15 5 INZ(%SIZE(CMD_STRING)) DLENSTR2 S 15 5 INZ(%SIZE(CMD_STR2)) C* C* Beginning of mainline C* C* Two parameters are being passed into this program C* C *ENTRY PLIST C PARM JOBD 10 C PARM JOBD_LIB 10 C* C* Move the two parameters passed into LFNAM C* C JOBD CAT JOBD_LIB LFNAM 20 C* C* Error Code Bytes Provided is set to 16 C* C EVAL QUSBPRV = %SIZE(QUSEC) (3) C* C* Call the API. C* C CALL QWDRJOBD C PARM QWDD0100 C PARM RCVLEN C PARM FORMAT C PARM LFNAM C PARM QUSEC C* C* Test for an error on the API call C* C IF QUSBAVL > 0 (2) C* C* If there was an error, exit to ERROR subroutine C* C EXSR ERROR C* C* Else, process the HOLD value C* C ELSE C MOVEL QWDHJQ HOLD C* C* Let's tell everyone what the hold value was for this job C* C CALL 'QCMDEXC' C PARM CMD_STRING C PARM LENSTR C END C* C EVAL *INLR = '1' C RETURN C* C* End of MAINLINE C* C* Subroutine to handle errors received on the CALL C* C ERROR BEGSR C* C* Process errors returned from the API C* C MOVEL QUSEI MSG_ID C CALL 'QCMDEXC' C PARM CMD_STR2 C PARM LENSTR2 C ENDSR