....
/* This EXEC is for transmitting MICS extract files from the ESAWRITE 191 disk to MVS. Execute it from PROFILE EXEC. It performs the following; 1) Determine if logged on (vs DSC). If so, don't run. 2) Spool punch to self, punch jcl, punch file, close file and send to MVS. 3) tell esawrite to erase file. */ PARSE UPPER ARG force . /* 'force' EXECution even when logged on? */ Say 'Executing RUNMICS at' TIME() SERVE = 'XAMSERVE' /* 'ESASERVE' service machine */ rscs_id = 'RSCSV2' /* Local RSCS userid */ sendto = sendto_user 'AT' sendto_node datadisk = '100' /* ESAWRITE's 191 disk */ datamode = 'J' listdisk = '191' /* listing archive disk */ listmode = 'A' /* where listings are accumulated */ filepool = '' /* SFS filepool */ parse VALUE DIAGRC(8,'Q' SERVE ) WITH rc . If rc > 0 Then Do; Say 'The ESAMON Service Machine ' SERVE 'is not available.' Say 'Please correct and rerun.' Say 'Note that variable "SERVE" is set to service machine name.' Exit; End; CMD = 'CP SMSG' SERVE /* set up ESAMON SMSG */ Address Command Call CHECK_LOGGED; /* If logged on then EXIT, Else run*/ 'CP SLEEP 60 SEC' /* ensure ESAWRITE cleanup complete */ 'ACCESS' datadisk datamode /* ESAWRITE's 191 disk */ 'LISTFILE ESAEXTR *' datamode '(LIFO' /* find data files */ If rc ^= 0 Then Return; /* nope, there's none */ Do QUEUED(); Parse Pull fname ftype fmode . Call INITPUNCH; /* spool punch */ CALL INITJCL; /* spool initial jcl */ Call NETSEND; /* send extract file */ Call ENDJCL; /* send closing jcl */ Call SENDIT; /* and send it. */ Call ERASEIT; /* and erase file from ESAWRITE 191 */ End; Dsc = Left(Word(Diag(8,'QUERY USER 'Userid()),3),3) = 'DSC' If ^Dsc Then Exit; queue 'CP LOGOFF' /* Else LOGOFF */ Exit; /******************************************************************/ /* set up punch with correct tags */ /******************************************************************/ INITPUNCH: 'SPOOL PUNCH CONT' rscs_id 'CL A' 'CP TAG DEV PUNCH' sendto_node 'JOB' Return; /******************************************************************/ /* JCL header to call TSO routine to do netdata recieve */ /******************************************************************/ INITJCL: queue '//' || userid() ||',CLASS=H,USER=TSO3820' queue '//IEFPROC EXEC PGM=IKJEFT01,DYNAMNBR=30' /*queue '//SYSPROC DD DSN=SYS1.CLIST,DISP=SHR' */ /*queue '// DD DSN=ISPF.CLIST,DISP=SHR' */ /*queue '// DD DSN=SYS1.TSOPROC,DISP=SHR' */ /*queue '//OUTPUT OUTPUT DEST= ' */ /*queue '//PRINTOUT DD SYSOUT=(&CLASS,,STD),OUTPUT=*.OUTPUT,' */ /*queue '// DCB=(RECFM=VBM,LRECL=8205,BLKSIZE=8209)' */ queue '//SYSTSPRT DD SYSOUT=*' queue '//SYSTSIN DD *' queue ' %TSOREC' queue ' RECEIVE INFILE(IN)' /* MOD will append to existing file */ queue ' MOD' queue ' END' queue "//IN DD DATA,DLM='$$'" queue '' 'EXECIO * PUNCH' Return; /******************************************************************/ /* Put data into input stream in NETDATA format */ /******************************************************************/ NETSEND: 'DMSDDL SEND' fn ft fm 'TO' sendto '(NOLOG NOACK NOSPOOL' Return; /******************************************************************/ /* Put closing JCL in input stream */ /******************************************************************/ ENDJCL: queue '$$' queue '//' queue '' 'EXECIO * PUNCH' Return; /******************************************************************/ /* close input stream and send the data off to RSCS */ /******************************************************************/ SENDIT: 'CP SPOOL PUNCH NOCONT CLOSE' /* should now get message */ /* PUN FILE 0527 SENT FROM yourid PUN WAS 0527 ...*/ . Return; ERASEIT: /* Now tell ESAWRITE to erase raw data files */ cmd 'CMS ERASE' fname ftype 'CP SLEEP 5 SEC' /* give it enough time to erase it.*/ 'SET CMSTYPE HT'; 'ACCESS' datadisk datamode; 'STATE' fname ftype datamode 'SET CMSTYPE RT' If eraserc ^= 0 Then Do; Say 'FILE NOT ERASED, ERROR CONDITION!' fname ftype Exit; End; Return; /****************************************************************/ /*** Determine if userid is running disconnected or note ******/ /****************************************************************/ CHECK_LOGGED: Dsc = Left(Word(Diag(8,'QUERY USER 'Userid()),3),3) = 'DSC' If ^Dsc & force ^= 'FORCE' Then Exit; force = '' erased. = 0 listing = 0; Return;