/* rexx JES2 Checkpoint Dataset Reset */ /* =============================================================== */ ARG CONSNAME . IF CONSNAME = '' THEN CONSNAME = 'JES2CKPT' "execio * diskr inf (finis stem i." First = 'YES' do cntr = 1 to i.0 cmd = subword(i.cntr,1,1) select when cmd = 'CMD' then do if First <> 'YES' then call Process First = 'NO' x.Command = subword(i.cntr,2) x.ReplyCount = 0 x.WaitMessage = '' end when cmd = 'WAIT' then do x.WaitMessage = subword(i.cntr,2) end when cmd = 'NOWAIT' then do nop end when cmd = 'REPLY' then do x.ReplyCount = x.ReplyCount + 1 xrc = x.ReplyCount wkReply = subword(i.cntr,2) wkPos = index(wkReply,',') x.ReplyCode.xrc = substr(wkReply,1,wkPos-1) x.Reply.xrc = substr(wkReply,wkPos+1) end otherwise nop end end call Process /* =============================================================== */ exit /* =============================================================== */ Process: say 'Command :'x.Command do rCnt = 1 to x.ReplyCount say 'ReplyCD :'x.ReplyCode.rCnt say 'Reply :'x.Reply.rCnt end say 'Wait :'x.WaitMessage select when x.ReplyCount = 0 & x.WaitMessage = '' then do call Command "'" || x.Command || "'" end when x.ReplyCount = 0 then do call Command "'" || x.Command || "' M(" || x.WaitMessage || ")" end otherwise call Command "'" || x.Command || "' M(" || , x.ReplyCode.1 || ")" do cCnt = 1 to x.ReplyCount -1 ReplyNO = SearchReplyNumber(x.ReplyCode.cCnt) cCnt2 = cCnt + 1 call Command "'R " || ReplyNO || "," || x.Reply.cCnt || , "' M(" || x.ReplyCode.cCnt2 || ")" end lastCount = x.ReplyCount ReplyNO = SearchReplyNumber(x.ReplyCode.lastCount) if x.WaitMessage = '' then do call Command "'R " || ReplyNO || "," || , x.Reply.lastCount || "'" end else do call Command "'R " || ReplyNO || "," || x.Reply.lastCount || , "' M(" || x.WaitMessage || ")" end end return /* =============================================================== */ SearchReplyNumber: arg ReplyMessage wkReplyNO = 0 do xcnt = 1 to chk.0 say '>> 'chk.xcnt pos1 = index(chk.xcnt,ReplyMessage) if pos1 <> 0 then do wkReplyNO = substr(subword(chk.xcnt,2,1),2) end end return wkReplyNO /* =============================================================== */ Command: arg cmd say '!! 'cmd x = outtrap('chk.') "@cmd "cmd" CN("CONSNAME")" x = outtrap('off') return /* =============================================================== */ Message: arg msg say msg "se '"left(msg,60)"'" return