Here the jcl //...your job card here... //ARCHIVE EXEC PGM=IKJEFT01,DYNAMNBR=20 //SYSTSPRT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSOUT DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM(ssid) -ARCHIVE LOG MODE(QUIESCE) TIME(300) //* //CHEKARCH EXEC PGM=IKJEFT1B,PARM='%CHEKLOG ssid' //SYSEXEC DD DISP=SHR,DSN=your.rexx.library //SYSTSPRT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSOUT DD SYSOUT=* //SYSTSIN DD DUMMY //* =================================================================== Here's the rexx: /******************************* REXX ********************************/ /* CHEKLOG */ /*********************************************************************/ /* MODIFICATION HISTORY:- */ /* ---------------------- */ /* USERID DATE COMMENT */ /* ------- --------------------------------------------------- */ /* THILTON 11/02/2004 INITIAL SETUP */ /* */ /*********************************************************************/ /* PROGRAM DESCRIPTION: */ /* --------------------- */ /* THIS REXX PROGRAM will examine the output of the -DIS LOG command */ /* and wait for the log archive to complete. */ /* */ /*********************************************************************/ ARG parms "((" opts opts = Strip(opts , "T" , ")" ) /* nip trailing banana */ parse var opts "TRACE" tv . /* was a -tracevalue- sent? */ parse value tv "N" with tv . /* guarantee a default value */ rc = Trace(tv) /*-------------------------------------------------------------------*/ /* Standard entry */ /*-------------------------------------------------------------------*/ signal on syntax name trap signal on failure name trap signal on novalue name trap call stdentry /* set variables */ finished = 0 ssid = parms loop = 0 /*-------------------------------------------------------------------*/ /* Main part of the code */ /*-------------------------------------------------------------------*/ do forever Address TSO queue "-DIS LOG" queue "END" x = outtrap("disp.") "DSN SYS("SSID")" x = outtrap("off") do i = 1 to disp.0 disp.i = strip(disp.i) if substr(disp.i,1,27) = 'OFFLOAD TASK IS (AVAILABLE)' then do finished = 1 say 'Archived is finished:' time() leave end end if finished then leave else do loop = loop + 1 if loop > 20 then do /* stop after 20 tries*/ call rcexit 8 'More than 20 checks of archive log.' end say 'Attempt #'right(loop,2)'. Archive still active.' , 'Will try again in 30 seconds.' time() call syscalls('ON') Address SYSCALL "SLEEP" 30 call SYSCALLS 'OFF' end end Call SHUTDOWN /*--------------------*/ /*-------------------------------------------------------------------*/ /* Shutdown */ /*-------------------------------------------------------------------*/ SHUTDOWN: /*-------------------------------------------------------------------*/ /* Put unique shutdown logic before the signal to stdexit */ /*-------------------------------------------------------------------*/ signal stdexit /*-------------------------------------------------------------------*/ /* RCEXIT - Exit on non-zero return codes */ /*-------------------------------------------------------------------*/ rcexit: parse arg EXITRC zedlmsg if EXITRC <> 0 then do /*-------------------------------------------------------------------*/ /* If execution environment is ISPF then VPUT ZISPFRC */ /*-------------------------------------------------------------------*/ if execenv = 'TSO' | execenv = 'ISPF' then do if ispfenv = 'YES' then do zispfrc = EXITRC call ispwrap "VPUT (ZISPFRC)" end end /*-------------------------------------------------------------------*/ /* If a message is provided, wrap it in date, time and EXITRC */ /*-------------------------------------------------------------------*/ if zedlmsg <> '' then do zedlmsg = date() time() execname zedlmsg 'RC='EXITRC call msg zedlmsg end /*-------------------------------------------------------------------*/ /* Signal SHUTDOWN. SHUTDOWN label MUST exist in the program */ /*-------------------------------------------------------------------*/ signal shutdown end else return /*-------------------------------------------------------------------*/ /* Issue a common trap error message using rcexit */ /*-------------------------------------------------------------------*/ TRAP: traptype = condition('C') if traptype = 'SYNTAX' then msg = errortext(RC) else msg = condition('D') trapline = strip(sourceline(sigl)) msg = traptype 'TRAP:' msg', Line:' sigl '"'trapline'"' call rcexit 666 msg /*-------------------------------------------------------------------*/ /* STDENTRY - Standard Entry logic */ /*-------------------------------------------------------------------*/ STDENTRY: arg msgdd parse upper source . . execname . execdsn . . execenv . EXITRC = 0 x = time('r') ispfenv = 'NO' if substr(execenv,1,3) <> 'TSO' & execenv <> 'ISPF' then tsoenv = 'NONE' else do tsoenv = sysvar('SYSENV') "ISPQRY" if RC = 0 then ispfenv = 'YES' end /*-------------------------------------------------------------------*/ /* allocate files if running foreground for testting */ /*-------------------------------------------------------------------*/ if tsoenv = 'FORE' then do nop end /*-------------------------------------------------------------------*/ /* Startup message */ /*-------------------------------------------------------------------*/ startmsg = execname 'started' date() time() if tsoenv = 'BACK' then do say center(' 'startmsg' ',78,'-') say end /*-------------------------------------------------------------------*/ /* If MSGDD is provided confirm the MSGDD is allocated */ /*-------------------------------------------------------------------*/ if msgdd <> '' then call ddcheck msgdd return /*-------------------------------------------------------------------*/ /* STDEXIT - Standard Exit logic */ /*-------------------------------------------------------------------*/ STDEXIT: endmsg = execname 'ended' date() time() time('e') 'RC='EXITRC if tsoenv = 'BACK' then do say say center(' 'endmsg' ',78,'-') end exit(EXITRC) /*-------------------------------------------------------------------*/ /* MSG - Determine whether to SAY or ISPEXEC SETMSG the message */ /*-------------------------------------------------------------------*/ MSG: parse arg zedlmsg /*-------------------------------------------------------------------*/ /* If this is background or OMVS use SAY */ /*-------------------------------------------------------------------*/ if tsoenv = 'BACK' | execenv = 'OMVS' then say zedlmsg else /*-------------------------------------------------------------------*/ /* If this is foreground and ISPF is available, use SETMSG */ /*-------------------------------------------------------------------*/ do if ispfenv = 'YES' then call ispwrap "SETMSG MSG(ISRZ000)" else say zedlmsg end return /*-------------------------------------------------------------------*/ /* DDCHECK - Determine if a required DD is allocated */ /*-------------------------------------------------------------------*/ DDCHECK: arg dd LRC = listdsi(dd "FILE") /*-------------------------------------------------------------------*/ /* Allow sysreason=3 to verify SYSOUT DD statements */ /*-------------------------------------------------------------------*/ if LRC <> 0 & sysreason <> 3 then call rcexit LRC 'Required DD' dd 'is missing' sysmsglvl2 return /*-------------------------------------------------------------------*/ /* ISPWRAP - Wrapper for ISPF commands */ /*-------------------------------------------------------------------*/ ISPWRAP: parse arg parms /*-------------------------------------------------------------------*/ /* If the optional valid_rc parm is present use it, if not assume 0 */ /*-------------------------------------------------------------------*/ parse var parms valid_rc isp_cmd if datatype(valid_rc,'W') = 0 then do valid_rc = 0 isp_cmd = parms end address ISPEXEC isp_cmd IRC = RC /*-------------------------------------------------------------------*/ /* If RC = 0 then return */ /*-------------------------------------------------------------------*/ if IRC <= valid_rc then return IRC else call rcexit IRC 'Error with ISPF Command:' isp_cmd /*-------------------------------------------------------------------*/ /* ISRWRAP - Wrapper for ISPF Edit commands */ /*-------------------------------------------------------------------*/ ISRWRAP: parse arg parms /*-------------------------------------------------------------------*/ /* If the optional valid_rc parm is present use it, if not assume 0 */ /*-------------------------------------------------------------------*/ parse var parms valid_rc isr_cmd if datatype(valid_rc,'W') = 0 then do valid_rc = 0 isr_cmd = parms end address ISREDIT isr_cmd ERC = RC /*-------------------------------------------------------------------*/ /* If RC = 0 then return */ /*-------------------------------------------------------------------*/ if ERC <= valid_rc then return ERC else call rcexit ERC 'Error with ISPF Edit Command:' isr_cmd /*-------------------------------------------------------------------*/ /* TSOTRAP - Capture the output from a TSO command in a stem */ /*-------------------------------------------------------------------*/ TSOTRAP: parse arg parms /*-------------------------------------------------------------------*/ /* If the optional valid_rc parm is present use it, if not assume 0 */ /*-------------------------------------------------------------------*/ parse var parms valid_rc tso_cmd if datatype(valid_rc,'W') = 0 then do valid_rc = 0 tso_cmd = parms end call outtrap 'tsoout.' address TSO tso_cmd CRC = RC /*-------------------------------------------------------------------*/ /* If RC = 0 then return */ /*-------------------------------------------------------------------*/ if CRC <= valid_rc then return CRC else do trapmsg = center(' TSO Command Error Trap ',78,'-') /*-------------------------------------------------------------------*/ /* If RC <> 0 then format output depending on environment */ /*-------------------------------------------------------------------*/ if tsoenv = 'BACK' | execenv = 'OMVS' then do say trapmsg do c=1 to tsoout.0 say tsoout.c end say trapmsg call rcexit CRC 'Error with TSO Command:' tso_cmd end else /*-------------------------------------------------------------------*/ /* If this is foreground and ISPF is available, use the ISPF LOG */ /*-------------------------------------------------------------------*/ do if ispfenv = 'YES' then do zedlmsg = trapmsg call ispwrap "LOG MSG(ISRZ000)" do c=1 to tsoout.0 zedlmsg = tsoout.c call ispwrap "LOG MSG(ISRZ000)" end zedlmsg = trapmsg call ispwrap "LOG MSG(ISRZ000)" call rcexit CRC 'Error with TSO Command:' tso_cmd, ' see the ISPF Log (Option 7.5) for details' end else do say trapmsg do c=1 to tsoout.0 say tsoout.c end say trapmsg call rcexit CRC 'Error with TSO Command:' tso_cmd end end end /*-------------------------------------------------------------------*/ /* UTILOUT - Print messages to the requested DD */ /*-------------------------------------------------------------------*/ UTILOUT: parse arg msgdd msglines message /*-------------------------------------------------------------------*/ /* Confirm the MSGDD exists */ /*-------------------------------------------------------------------*/ call ddcheck msgdd /*-------------------------------------------------------------------*/ /* Create a new stack to cushion existing stack data */ /*-------------------------------------------------------------------*/ address TSO "NEWSTACK" /*-------------------------------------------------------------------*/ /* If a number is provided, add that number of blank lines before */ /* and after the message */ /*-------------------------------------------------------------------*/ if msglines > 0 then do do m=1 to msglines push ' ' end end push message if msglines > 0 then do do m=1 to msglines push ' ' end end /*-------------------------------------------------------------------*/ /* Write the contents of the stack to the MSGDD */ /*-------------------------------------------------------------------*/ call tsotrap "EXECIO * DISKW" msgdd /*-------------------------------------------------------------------*/ /* Delete the stack */ /*-------------------------------------------------------------------*/ address TSO "DELSTACK" return