Return to the CL Tips
Testing to see if System is in Restricted Condition
Here's some code from our weekly backup program:
It ends all subsystems, then checks every minute until subsystems are ended.
pgm /* API variables */ dcl var(&receiver) type(*char) len(100) dcl var(&receiverl) type(*char) len(4) value(x'00000064') dcl var(&format) type(*char) len(8) value('SSTS0200') dcl var(&reset) type(*char) len(10) value('*YES') dcl var(&error) type(*char) len(4) dcl var(&rstdflag) type(*char) len(1) /* .... */ /* End subsystems for save operation */ sndpgmmsg msgid(cpf9898) msgf(qcpfmsg) + msgdta('** Ending all subsystems immediately') tomsgq(*sysopr) endsbs sbs(*all) option(*immed) sbscheck: call pgm(QWCRSSTS) parm(&receiver &receiverl &format &reset &error) /* Restricted state flag is byte 31 (offset 30): */ /* 0 = not in restricted state */ /* 1 = restricted state */ chgvar var(&rstdflag) value(%sst(&receiver 31 1)) if cond(&rstdflag *eq '0') then(do) sndpgmmsg msgid(cpf9898) msgf(qcpfmsg) + msgdta('** Waiting for subsystems to end') tomsgq(*sysopr) dlyjob dly(60) goto cmdlbl(sbscheck) enddo /* In restricted state, can perform backup */ rste: endpgm
[report a broken link by clicking here]