David, FWIW, here is a "skeleton" Exec that I use to setup a VM service
machine to wait for incoming reader files and process them. The Exec als o supports invoking commands from authorized users that send it SMSGs. The user issuing the SMSG command must be authorized to do so and the Exec supports up to three levels of authorization checking. Level 1, you are authorized to run anything supported by the Exec on the service machine. Level 2, you are authorized to run anything on the service machine. Leve l 3, you are authorized to run the specified command. The Exec expects to use the MSGNOH command to send replys, so the service machine running it needs the privilege class required for MSGNOH, (IBM Class "B"). :RDRWAIT EXEC: /*--------------------------------------------------------------------*/ /* RDRWAIT EXEC */ /* Skeleton Exec for Service Machine to Wait for Reader Files or */ /* "Special" Messages, (SMSGs). Must be customized for each Service */ /* Machine that runs it. */ /*--------------------------------------------------------------------*/ RDRWAIT: Address COMMAND Parse Source . ctype ename etype emode . adminid = 'xxxxxxx' /* ID to Receive Console & Bad Rdr Fil es */ qfiles = 'QUERY FILES * ALL AVAIL' qryrdr = 'QUERY READER * ALL AVAIL ISODATE DIST' myuid = Userid() Say LOGMSG('Begin' ename etype'...') Say ' ' 'CP SPOOL READER CLASS *' 'WAKEUP +0 (QUIET IUCVMSG' /* Setup to Receive MSGs */ 'CP SET MSG ON' 'CP SET SMSG IUCV' /* Trap SMSGs Only */ 'MAKEBUF' bufnum = rc stkcnt = Queued() Do Forever Say LOGMSG('Waiting for Reader Files...') 'WAKEUP (QUIET CONS RDR IUCVMSG' src = rc Select /* src */ When src = 4 Then Call DORDR /* Incoming RDR File */ When src = 5 Then Call DOSMSG /* Incoming SMSG */ When src = 6 Then Call EXIT src /* Enter Key */ Otherwise Call EXIT src End /* Select src */ End /* Do Forever */ Call EXIT 99 /*--------------------------------------------------------------------*/ /* At least 1 Reader file has arrived, process all Reader files found.*/ /*--------------------------------------------------------------------*/ DORDR: Parse Value Diag(08,qfiles) With . numrdr . Do While numrdr \= 'NO' 'PIPE CP' qryrdr'|DROP 1|STEM RDRFILES.' If rc \= 0 Then Leave Do n = 1 to rdrfiles.0 Parse Var rdrfiles.n origin fileid class type recs copy, hold date time spfn spft spdist . Say ' ' Say LOGMSG('Processing' spfn spft 'for' origin'...') Select /* process */ When spfn = 'xxxx' Then Call PROCESS_xxxx When spfn = 'yyyy' Then Call PROCESS_yyyy Otherwise 'CP TRANSFER READER' fileid 'TO' adminid 'READER' End /* Select process */ End n Parse Value Diag(08,qfiles) With . numrdr . End /* Do While numrdr \= 'NO' */ Return /*--------------------------------------------------------------------*/ /* Process Reader file "xxxx". */ /*--------------------------------------------------------------------*/ PROCESS_xxxx: Return /*--------------------------------------------------------------------*/ /* Process Reader file "yyyy". */ /*--------------------------------------------------------------------*/ PROCESS_yyyy: Return /*--------------------------------------------------------------------*/ /* At least 1 SMSG has arrived, process all SMSGs found. */ /*--------------------------------------------------------------------*/ DOSMSG: 'GLOBALV SELECT' ename 'SET INVOKER' /* Can be used by other Execs */ Do While Queued() > stkcnt Pull msgtype smsgusr smsg If msgtype \= '*SMSG' Then Do Say msgtype Left(smsgusr,8) smsg Iterate End If smsgusr = '' Then Iterate smsgusr = Left(smsgusr,8) smsg = Strip(smsg) Parse Var smsg smsgcmd smsgargs telluser = 'CP MSGNOH' smsgusr myuid':' If smsgcmd = '' Then Do msg = LOGMSG('No command specified.') telluser msg Say smsgusr msg Iterate End msg = LOGMSG('Processing request "'smsg'".') telluser msg Say smsgusr msg authfn = '' Select /* smsgcmd */ When smsgcmd = 'CMS' Then cmd = 'CMS' smsgargs When smsgcmd = 'CP' Then cmd = 'CP' smsgargs When smsgcmd = 'EXEC' Then Do authfn = Word(smsgargs,1) cmd = 'COMMAND' smsgcmd smsgargs End When smsgcmd = 'RESTART' Then cmd = 'RESTART' When smsgcmd = 'STOP' Then cmd = 'STOP' Otherwise authfn = smsgcmd cmd = 'CMS' smsgcmd smsgargs End /* Select smsgcmd */ authid = '' authids = ename 'AUTHIDS *' 'ESTATE' authids If rc = 0 Then 'PIPE <' authids'|NFIND *|REXX AUTHIDS' smsgusr'|VAR AUTHID' If authid = '' Then Do authids = myuid 'AUTHIDS *' 'ESTATE' authids If rc = 0 Then 'PIPE <' authids'|NFIND *|REXX AUTHIDS' smsgusr||, '|VAR AUTHID' End If authid = '' & authfn \= '' Then Do authids = authfn 'AUTHIDS *' 'ESTATE' authids If rc = 0 Then 'PIPE <' authids'|NFIND *|REXX AUTHIDS' smsgusr||, '|VAR AUTHID' End If authid = '' Then Do msg = LOGMSG('You are not authorized to run "'smsg'".') telluser msg Say smsgusr msg Iterate End If cmd = 'STOP' Then Call STOP If cmd = 'RESTART' Then Call RESTART 'GLOBALV SELECT' ename 'SET INVOKER' smsgusr 'PIPE' cmd'|CONSOLE|SPECS /'telluser'/ 1 1-* NW|STEM MSG.' src = rc 'PIPE STEM MSG.|CP' msg = LOGMSG('** "'smsgcmd smsgargs'" ended,', 'Return Code =' src '**') telluser msg Say smsgusr msg End /* Do While Queued() > stkcnt */ 'GLOBALV SELECT' ename 'SET INVOKER' Return /*--------------------------------------------------------------------*/ /* Preface supplied string with the current date and time. */ /*--------------------------------------------------------------------*/ LOGMSG: Return Date('S',,,'-') Time() Arg(1) /*--------------------------------------------------------------------*/ /* Restart this Exec. */ /*--------------------------------------------------------------------*/ RESTART: msg = LOGMSG('"'ename'" Restarting...') telluser msg Say smsgusr msg Push 'EXEC' ename Exit 0 /*--------------------------------------------------------------------*/ /* Stop running this Exec. */ /*--------------------------------------------------------------------*/ STOP: msg = LOGMSG('"'ename'" Terminating...') telluser msg Say smsgusr msg Call EXIT 16 /*--------------------------------------------------------------------*/ /* Cleanup and Exit. Logoff if the Service Machine is not Connected. */ /*--------------------------------------------------------------------*/ EXIT: Arg src . If src = '' Then src = 0 'DROPBUF' bufnum 'CP SET SMSG OFF' 'WAKEUP RESET' /* Cleanup IUCV Environment */ Say '' Say LOGMSG('End ' ename etype'...') display = (SubStr(Diag(24,-1),13,1) = 0) If \display Then Do Say ename 'RC='src 'CP LOGOFF' End Exit src :AUTHIDS REXX: /*--------------------------------------------------------------------*/ /* AUTHIDS REXX */ /* REXX PIPELINE subroutine to support "wildcard", (last character is */ /* an asterisk (*)), matching for Authorization checking. If a match */ /* is found, the record containing the match is output. If no match */ /* is found, a blank record is output. The userid to be matched must */ /* be specified as a parm to this routine and the userid in the */ /* records must be the first word in the record. */ /*--------------------------------------------------------------------*/ AUTHIDS: Signal On Error blank = ' ' Arg chkid . Do Forever 'PEEKTO REC' /* Get Record */ Parse Var rec authid . If chkid = authid Then Call VALID If Right(authid,1) = '*' Then Do authid = Strip(authid,'T','*') l = Length(authid) If Left(chkid,l) = authid Then Call VALID End 'READTO' /* Consume Record */ End /* Do Forever */ ERROR: Signal Off Error src = rc 'OUTPUT' blank Exit src*(src<>12) VALID: Signal Off Error 'OUTPUT' chkid Exit rc*rc<>12 :RDRWAIT AUTHIDS: THISID This ID is Authorized THATID That ID also VMBAT0* All VM:Batch Worker Machines Dale R. Smith "It's just a simple matter of programming." - Any boss who has never written a program On Tue, 1 Jul 2008 07:10:26 -0700, Wakser, David <[EMAIL PROTECTED]> wrote: >All: > > What is the best method to code, for a SVM, a wait for a file to >arrive in its reader? > > I have a (very old) EXEC that has a "do forever" loop with a >"EXECIO * CP (STEM" aa. "STRING CP Q RDR * ALL" command followed by a >SLEEP when no files are found. Is there a better method of "waking up" >an EXEC when a RDR file arrives? > > Thanks, in advance. > >David Wakser >======================== ========================= =======================