SCOUG Logo


Next Meeting: Sat, TBD
Meeting Directions


Be a Member
Join SCOUG

Navigation:


Help with Searching

20 Most Recent Documents
Search Archives
Index by date, title, author, category.


Features:

Mr. Know-It-All
Ink
Download!










SCOUG:

Home

Email Lists

SIGs (Internet, General Interest, Programming, Network, more..)

Online Chats

Business

Past Presentations

Credits

Submissions

Contact SCOUG

Copyright SCOUG



warp expowest
Pictures from Sept. 1999

The views expressed in articles on this site are those of their authors.

warptech
SCOUG was there!


Copyright 1998-2024, 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.

The Southern California OS/2 User Group
USA

SCOUG-Programming Mailing List Archives

Return to [ 11 | March | 2007 ]

<< Previous Message << >> Next Message >>


Date: Sun, 11 Mar 2007 13:09:15 -0700
From: Peter Skye <pskye@peterskye.com >
Reply-To: scoug-programming@scoug.com
To: scoug-programming@scoug.com
Subject: SCOUG-Programming: Getting a PID ? (RXU Steven)

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.