Example code for using the List Job Schedule Entries (QWCLSCDE) API
**********************************************************************************************
* Sample code for listing job schedule entries using the QWCLSCDE API
**********************************************************************************************
* PROGRAM NAME
D SDS
D PGM 10
D Usrprf 254 263
* ==List API structures==
* Standard error code DS for API error handling
D Error_Code DS
D BytesProvd 1 4B 0 Inz(0)
D BytesAvail 5 8B 0 Inz(0)
D Except_ID 9 15
D Reserved 16 16
D Exception 17 272
* Receiver value DS for user space header info (used in first call to QUSRTVUS)
D GenRcvrDS DS
D UserArea 1 64
D GenHdrSize 65 68B 0
D StrucLevel 69 72
D FormatName 73 80
D APIused 81 90
D CreateStamp 91 103
D InfoStatus 104 104
D SizeUSused 105 108B 0
D InpParmOff 109 112B 0
D InpParmSiz 113 116B 0
D HeadOffset 117 120B 0
D HeaderSize 121 124B 0
D ListOffset 125 128B 0
D ListSize 129 132B 0
D ListNumber 133 136B 0
D EntrySize 137 140B 0
* QWCLSCDE format SCDL0200 structure
D ScdL0200DS DS
D L_InfoStatus 1A Overlay( ScdL0200DS : 1 )
D L_JobName 10A Overlay( ScdL0200DS : 2 )
D L_EntryNbr 10A Overlay( ScdL0200DS : 12 )
D L_SchedDate 10A Overlay( ScdL0200DS : 22 )
D L_SchedDays 70A Overlay( ScdL0200DS : 32 )
D L_SchedTime 6A Overlay( ScdL0200DS : 102 )
D L_Frequency 10A Overlay( ScdL0200DS : 108 )
D L_RelDayOfMn 10A Overlay( ScdL0200DS : 118 ) Dim(5)
D L_RecovryAct 10A Overlay( ScdL0200DS : 168 )
D L_NxtSbmDate 10A Overlay( ScdL0200DS : 178 )
D L_Status 10A Overlay( ScdL0200DS : 188 )
D L_JobQueName 10A Overlay( ScdL0200DS : 198 )
D L_JobQueLib 10A Overlay( ScdL0200DS : 208 )
D L_UsrPrfEntA 10A Overlay( ScdL0200DS : 218 )
D L_LastSbmDat 10A Overlay( ScdL0200DS : 228 )
D L_LastSbmTim 6A Overlay( ScdL0200DS : 238 )
D L_Text 50A Overlay( ScdL0200DS : 244 )
D L_Reserved1 23A Overlay( ScdL0200DS : 294 )
D L_JobQueSts 10A Overlay( ScdL0200DS : 317 )
D L_DatesOmitd 10A Overlay( ScdL0200DS : 327 ) Dim(20)
D L_JobDName 10A Overlay( ScdL0200DS : 527 )
D L_JobDLib 10A Overlay( ScdL0200DS : 537 )
D L_UsrPrfSbmJ 10A Overlay( ScdL0200DS : 547 )
D L_MsgQueName 10A Overlay( ScdL0200DS : 557 )
D L_MsgQueLib 10A Overlay( ScdL0200DS : 567 )
D L_SaveEntry 10A Overlay( ScdL0200DS : 577 )
D L_LstSbmJobN 10A Overlay( ScdL0200DS : 587 )
D L_LstSbmUsrN 10A Overlay( ScdL0200DS : 597 )
D L_LstSbmJNbr 6A Overlay( ScdL0200DS : 607 )
D L_LstAtSbmDt 10A Overlay( ScdL0200DS : 613 )
D L_LstAtSbmTm 6A Overlay( ScdL0200DS : 623 )
D L_StsLstSbmA 10A Overlay( ScdL0200DS : 629 )
D L_Reserved2 2A Overlay( ScdL0200DS : 639 )
D L_LenCmdStr 10I 0 Overlay( ScdL0200DS : 641 )
D L_Command 512A Overlay( ScdL0200DS : 645 )
**********************************************************************************************
* WORK FIELDS:
**********************************************************************************************
D ContHandle S 16
D CurrentEnt S 5P 0
D DataLength S 10I 0 Inz(140)
D ErrorMsg S 30
D ExtendAttr S 10 Inz('USRSPC ')
D InitialSiz S 10I 0 Inz(1024)
D InitialVal S 1 Inz(X'00')
D JobScdEnt S 10 Inz('*ALL ')
D ListFormat S 8 Inz('SCDL0200')
D PublicAut S 10 Inz('*ALL ')
D ReplaceSpc S 10 Inz('*YES ')
D Response S 1
D StartPos S 10I 0 Inz(1)
D TextDescrp S 50 Inz('User space for API use')
D UserSpace S 20 Inz('QWCLSCDE QTEMP ')
**********************************************************************************************
* CONSTANTS:
**********************************************************************************************
**********************************************************************************************
* ENTRY PARAMETERS*
**********************************************************************************************
**********************************************************************************************
* KEY LISTS:
**********************************************************************************************
**********************************************************************************************
* MAINLINE:
**********************************************************************************************
* Create a user space to hold the format list entries
C Call 'QUSCRTUS'
C Parm UserSpace
C Parm ExtendAttr
C Parm InitialSiz
C Parm InitialVal
C Parm PublicAut
C Parm TextDescrp
C Parm ReplaceSpc
C Parm Error_Code
* List the job schedule entries on the system
C Call 'QWCLSCDE'
C Parm UserSpace
C Parm 'SCDL0200' ListFormat
C Parm JobScdEnt
C Parm ContHandle
C Parm Error_Code
* Get the header info for this space
C Call 'QUSRTVUS'
C Parm UserSpace
C Parm StartPos
C Parm DataLength
C Parm GenRcvrDS
C Parm Error_Code
* Process returned entries
B001 C If ListNumber > 0
* Set the initial offset for the start of the list entries
C Eval ListOffset = ListOffset + 1
C Eval CurrentEnt = 1
* Loop through the entries held in the list section of the user space
B002 C DoW CurrentEnt <= ListNumber
* Get the detail info for next list entry
C Call 'QUSRTVUS'
C Parm UserSpace
C Parm ListOffset
C Parm EntrySize
C Parm ScdL0200DS
C Parm Error_Code
* Include outque if API call successful
B003 C If Not %ERROR
**************************
* <Processing code here> *
**************************
E003 C EndIf
* Bump up the counter & offset for the next entry
C Eval ListOffset = ListOffset + EntrySize
C Eval CurrentEnt = CurrentEnt + 1
E002 C EndDo
E001 C EndIf
C Eval *INLR = *On
C Return
**********************************************************************************************
--
MartinRowe - 23 Sep 2005