//MARKA JOB (0),'ASSEMBLE',MSGLEVEL=1,CLASS=A,MSGCLASS=A //ASM EXEC PGM=IFOX00, // PARM='DECK,LOAD,TERM,TEST,SYSPARM((NOSP,NODEBUG)),XREF(SHORT)', // REGION=4096K,COND=(0,NE) //SYSLIB DD DISP=SHR,DSN=SYS1.MACLIB //* DD DISP=SHR,DSN=SYS1.AMODGEN //* DD DISP=SHR,DSN=SYS1.ATSOMAC //SYSUT1 DD SPACE=(CYL,(25,5)),UNIT=3350 //SYSUT2 DD SPACE=(CYL,(25,5)),UNIT=3350 //SYSUT3 DD SPACE=(CYL,(25,5)),UNIT=3350 //SYSTERM DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSPUNCH DD SYSOUT=* //SYSGO DD DISP=(MOD,PASS,DELETE),UNIT=SYSDA, // DSN=&&OBJLIB,SPACE=(TRK,(2,2)) //SYSIN DD DATA,DLM=ZZ * --------------------------------------------------------------------- * * WTORPGM - ISSUE A WTOR AND EXPECT 'U' OR 'C' IN THE REPLY * REPLY OF 'U' = CC0 * REPLY OF 'C' = CC8 * * WTOR TEXT: MID0001A @@@@@@@ Reply 'U' to proceed, or 'C' to cancel * where @@@@@@@@ is replaced by the batch jobname or TSU * userid if invoked via TSO. * * SYSIN DD CARD: REQUIRED, MAY BE DUMMIED * If the SYSIN is not dummied it is expected to provide some * data cards (the first 60 bytes are used) to issue a stream * of WTOs to the operators to provide additional information * about what the WTOR prompt is for. * If dummied then only the WTOR itself is issued which may * be fine for your use. * * EXAMPLE: * * //DLY00000 JOB (0),'DAILY JOBSTREAM',CLASS=A,MSGCLASS=A * //* * //* DLY00000 - DAILY BATCH JOB STREAM TRIGGER * //* SUBMITTED ONTO INTERNAL READER BY AUTOMATION * //* TIMERS. * //* * //* OPER REPLY U - SUBMIT THE DAILY JOBS * //* OPER REPLY C - SHOW INFO ON HOW OPS CAN DO WHAT * //* WE WOULD HAVE DONE FOR THEM AND END * //* * //STEP0000 EXEC PGM=WTORPGM * //SYSIN DD * * THE DAILY BATCH STREAM IS READY TO BEGIN * WHEN READY TO PROCEED REPLY 'U' * TO CANCEL THE DAILY BATCH STREAM FOR TODAY REPLY 'C' * /* * //* IF ALL IS OK SUBMIT THE DAILY BATCH JOBS * //STEP0001 EXEC PGM=IEBGENER,COND=(0,NE) --- OK: SUB DAILY JOBS * //SYSPRINT DD SYSOUT=* * //SYSUT1 DD DSN=SYS9.JOBDECKS(DAILY),DISP=SHR * //SYSUT2 DD SYSOUT=(A,INTRDR) * //SYSIN DD DUMMY * //STEP0002 EXEC PGM=WTOBATCH,COND=(0,EQ) --- NOT OK: MORE MSGS * //SYSIN DD * * DAILY BATCH STREAM HAS BEEN CANCELLED. * TO RESTART MANUALLY USE 'S JOBDECK,J=DAILY' * /* * // * * * NOTES: CANCELCC SHOULD RETURN CC=0, BUT ADDING =F'4' TO 0 KEEPS * GIVING ME A CC=8. DUNNO WHY SO DOCUMENTED AS 8. * * --------------------------------------------------------------------- WTORPGM CSECT STM R14,R12,12(13) BALR R12,R0 IF REMOVED, SOC4 USING *,R12 LA R15,SAVEAREA ST R15,8(R13) ST R13,4(R15) LR R13,R15 SPACE 2 BAL R4,GETJOBID GET JOBNAME INVOKING US MVI SYSINMSG,C' ' , erase sysinmsg buffer MVC SYSINMSG+1(L'SYSINMSG-1),SYSINMSG MVC SYSINMSG(8),MID0003I , default message id MVC SYSINMSG+9(8),JOBNAME , jobname for message OPEN (SYSIN,(INPUT)) , open sysin file WTORPGMR GET SYSIN MVC SYSINMSG+19(60),0(R1) , allow 60 bytes of sysin line MVC SYSINWTO+8(70),0(R1) , put 70 bytes of card in wto * ....+....2....+....3....+....4....+....5....+....6....+ * ....7....+....8' SYSINWTO WTO ' - ' , we will use a 80 byte field B WTORPGMR , get next sysin line EOFSYSIN DS 0F CLOSE (SYSIN) , done with the sysin messages BAL R4,WTORDO , do the WTOR now L R1,LASTCC C R1,CANCELCC BE EXITCC4 EXITCC0 L R13,4(R13) , get old address area LM R14,R12,12(R13) SLR R15,R15 , return code 0 BR R14 EXITCC4 EQU * L R13,4(R13) , get old address area LM R14,R12,12(R13) SLR R15,R15 , clear R15 A R15,=F'4' , set return code (is set to 8) * dunno why, but document as 8 BR R14 EJECT * --------------------------------------------------------------------- * * WTORDO - issue a WTOR and wait for the response * * Entry: R4 contains branch back address * Exit : no changes * Data : LastCC will be 0 (OK) or 4 (operator replied cancel) * * --------------------------------------------------------------------- SPACE 2 WTORDO DS 0F STM R14,R1,WTORSAVE , save R14, R15 and R1 SLR R1,R1 , lastcc so far is 0 ST R1,LASTCC MVC MID0001A+9(8),JOBNAME , the jobname execing this pgm MVI WTORTEXT,C' ' , erase sysinmsg buffer MVC WTORTEXT+1(L'WTORTEXT-1),WTORTEXT MVC WTORTEXT(L'MID0001A),MID0001A insert message text WTORISSU LA R1,L'MID0001A+4 , length of wtor message STH R1,THEWTOR+8 , put into WTOR parmlist XC WTOECB,WTOECB , clear the ECB WTOR ,WTOREPLY,L'WTOREPLY,WTOECB,MF=(E,THEWTOR) WAIT ECB=WTOECB , wait until operator reply OC WTOREPLY,=C' ' , convert to uppercase CLI WTOREPLY,C'U' , U was reply BE WTOREXIT , ok to leave CLI WTOREPLY,C'C' , C was reply (cancel) BE WTORCAN MVC WTORERR+17(8),JOBNAME , +8 into wto then txt offset WTORERR WTO 'MID0002E INVALID REPLY, NEED U OR C' B WTORISSU WTORCAN L R1,CANCELCC , lastCC to be 4 ST R1,LASTCC WTOREXIT LM R14,R1,WTORSAVE BR R4 , return EJECT * --------------------------------------------------------------------- * * GETJOBID - * OBTAIN THE JOBNAME OF THE JOB INVOKING US AND STORE IT IN JOBNAME * * A different method is used depending on whether we are a STC and TSU * or not. If we are a STC or TSU we assume TSO so get the userid, * if not then we are a batch job so get the jobname (STC method would * just return init which is not want we want). * * Entry: R4 contains branch back address * Exit : no changes * Data : JOBNAME field will be set correctly * * Notes: * The first block will return INIT for a batch job rather than the * batch job name, but we do the test anyway as this is a faster way * finding out if we are a batch job than the alternative of scanning * the mvs control blocks to work out if we are an STC, TSO or batch. * Also, these four lines will return the TSO userid if we are running * in TSU space which we would need to find out later if we were not a * batch job anyway. * * --------------------------------------------------------------------- GETJOBID EQU * STM R5,R6,GETJSAVE L R5,16 , addr of CVT pointer L R5,0(R5) , addr of dispatch queue L R5,12(R5) , addr of current ASCB L R5,176(R5) , addr of jobname MVC JOBNAME(8),0(R5) , save into JOBNAME data field CLC JOBNAME(8),INITNAME , is it INIT ? BNE GETJOBIX , no, usefull so will use it * * --- jobname of INIT, so within JES. Get the real jobname --- * , ELSE yes, get batch jobname LA R5,16 , addr of CVT pointer L R6,0(R5) , addr of CVT (dispatch queue) L R5,0(R6) , addr of TCBS L R6,4(R5) , addr of 2nd TCB L R5,180(R6) , addr of JSCB L R6,260(R5) , addr of JCT prefix LA R6,24(R6) , addr of jobname in JCT MVC JOBNAME(8),0(R6) , save into JOBNAME data field GETJOBIX LM R5,R6,GETJSAVE , restore registers BR R4 EJECT * -------------------------------------------------------------------- * D A T A A R E A * -------------------------------------------------------------------- SAVEAREA DS 18F , save area for program WTORSAVE DS 3F , save registers for wtordo GETJSAVE DS 2F , save registers for getjobname INITNAME DC C'INIT ' , for tests JOBNAME DC CL8' ' , store jobname SYSINMSG DS CL80 , to build wto from sysin WTOREPLY DC C' ' , reply we are waiting for THEWTOR WTOR '---------1---------2---------3---------4---------5-----+ ----6---------7---------8---------9---------0---------1-+ --------2-',,,,MF=L WTORTEXT EQU THEWTOR+12,121 WTOECB DS F , ECB we are waiting for MID0001A DC C'MID0001A jjjjjjjj Reply ''U'' to proceed, or ''C'' to + cancel' MID0003I DC C'MID0003I' LASTCC DS F CANCELCC DC F'4' SYSIN DCB DDNAME=SYSIN,MACRF=(GL),DSORG=PS,EODAD=EOFSYSIN * SPACE 2 R0 EQU 0 R1 EQU 1 R2 EQU 2 R3 EQU 3 R4 EQU 4 R5 EQU 5 R6 EQU 6 R7 EQU 7 R8 EQU 8 R9 EQU 9 R10 EQU 10 R11 EQU 11 R12 EQU 12 R13 EQU 13 R14 EQU 14 R15 EQU 15 * END ZZ //LKED1 EXEC PGM=IEWL, // PARM='XREF,LIST,LET,TEST,AC=1', // REGION=1024K,COND=(0,NE) //SYSLMOD DD DSN=SYS9.LINKLIB(WTORPGM),DISP=SHR //SYSLIN DD DSN=&&OBJLIB,DISP=(OLD,DELETE,DELETE) //SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(8,1)) //SYSPRINT DD SYSOUT=* //LKED2 EXEC PGM=IEWL, // PARM='XREF,LIST,LET,TEST,AC=1', // REGION=1024K,COND=(0,NE) //SYSLMOD DD DSN=SYS9.LINKLIB,DISP=SHR //SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(8,1)) //SYSPRINT DD SYSOUT=* //SYSLIN DD * INCLUDE SYSLMOD(WTORPGM) ENTRY WTORPGM NAME WTORPGM(R) /* //