SCOUG-Programming Mailing List Archives
Return to [ 11 | 
March | 
2007 ]
<< Previous Message << 
 >> Next Message >>
 
 
 
Content Type:   text/plain 
Steven Levine wrote:  
>   
> Look at my tweaked cron.cmd on the SCOUG server.  It's a working example.  
 
Thanks much!  Here's my test code:  
 
/* From Steven Levine in a couple of the SCOUG .cmd's (cronrgf.cmd, Startup-PenFTP.cmd) */  
/* Remember pid so others know not to kill us */  
rc = RxFuncAdd( 'RxuInit','RXU','RxuInit' )  
say "RxFuncAdd(RXU)="rc  
rc = RxuInit()  
say "rc(RxuInit)="rc  
say ""  
stProcInfo = RxProcId()  
say "RxProcId()="stProcInfo  
/* The following line needs a little info.  Apparently RxProcId()  
   can return an error value and the "if 0" is always false so  
   RxuTerm is never called -- yes?  (According to RXU.INF,  
   RxuTerm de-registers all RXU Rexx functions.)  Did you have      <----- STEVEN?  
   a concern about the returned value from RxProcId()? */           <----- STEVEN?  
if 0 then call RxuTerm          /* fixme to be gone someday */      <----- STEVEN?  
parse var stProcInfo PID ParentPID ThreadID  
say "PID="PID  
say "ParentPID="ParentPID  
say "ThreadID="ThreadID  
/* Write to the pidfile. */  
/* Programmer's note:  
   PARSE SOURCE - The data parsed describes the source of the program being run.  
   The source string contains the characters OS/2, followed by either COMMAND,  
   FUNCTION, or SUBROUTINE, depending on whether the program was invoked as a  
   host command or from a function call in an expression or using the CALL  
   instruction.  These two tokens are followed by the complete path specification  
   of the program file.  The string parsed might, therefore, be displayed as:   
     OS/2 COMMAND C:\OS2\REXTRY.CMD  
   */  
PARSE SOURCE . . full_path_of_this_procedure  
pidfile = SUBSTR(full_path_of_this_procedure, 1,,  
          LASTPOS(".", full_path_of_this_procedure)) || "pid"  
call SysFileDelete pidfile  
call lineout pidfile, PID  
call lineout pidfile  
exit  
 
Here are the results (looks very good, thanks again):  
 
   [H:\cmd\D-]x-pid-rxu  
   RxFuncAdd(RXU)=1  
   rc(RxuInit)=186 186  
 
   RxProcId()=2522 52 1  
   PID=2522  
   ParentPID=52  
   ThreadID=1  
 
   [H:\cmd\D-]dir *.pid  
   3-11-07   1:01p         6           0  x-PID-RXU.pid  
 
   [H:\cmd\D-]type x-PID-RXU.pid  
   2522  
 
Thanks a third time.  
 
- Peter  
 
 
 
=====================================================  
 
To unsubscribe from this list, send an email message  
to "steward@scoug.com". In the body of the message,  
put the command "unsubscribe scoug-programming".  
 
For problems, contact the list owner at  
"postmaster@scoug.com".  
 
=====================================================  
 
  
<< Previous Message << 
 >> Next Message >>
Return to [ 11 | 
March | 
2007 ] 
  
  
The Southern California OS/2 User Group
 P.O. Box 26904
 Santa Ana, CA  92799-6904, USA
Copyright 2001 the Southern California OS/2 User Group.  ALL RIGHTS 
RESERVED. 
 
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International 
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
 
 |