I actually got this running. I used Wally's suggestion. I was already using a subroutine named IS.PHANTOM.RUNNING ( ServiceName, IsRunning). All I did was:

1)  Run listusers() to get the list of users,
2) Parse out phantom users and run "PORT.STATUS PID {n} CALL.STACK" against them, 3) Parse out the 1st entry after the attribute containing "BASIC CALLSTACK" to get what's running,
4)  Compare this program against the passed in Service Name.
5)  If #4 matches then IsRunning = 1 otherwise it equals 0

It only pauses for about three seconds so this is a good thing. As a result of the above, I don't have to manage anything, just find out if what I'm interested in is running as a phantom.

The important change I had to make was to modify our service program from...

SLEEP  SleepForSeconds

      ...to...

FOR  X  =  1  TO  SleepForSeconds
    SLEEP  1
NEXT  X

Thanks for the help.

Bill

------------------------------------------------------------------------
Bill Haskett said the following on 4/2/2010 11:59 AM:
Thanks David.  This could work.

Bill

------------------------------------------------------------------------
David Wolverton said the following on 4/2/2010 10:57 AM:
I do a variation on this -- since my phantoms now need to be 'multi-account' (that is, 6 accounts, I need 6 phantoms - one per account) -- I do a READU of an 'item' from a 'Paramters' file -- the "ItemID" I attempt to read is
"AcctName-PHANRUN"

Don't care if it exists or not -- as long as the READU 'passes' -- if the LOCKED clause hits, I exit the 'startup'... I put this logic into a process I call during the LOGIN paragraph -- not flawless, in that people have to
move in and out of the account, but for what I do, it works A-OK.

This way, if another account needs to 'starts up' it can tell if the phantom for that account's data already has a phantom 'running' or not. Uses READU so that regardless of how the phantom dies, the lock goes with it. And more
flexible than the "LOCK 60" type of lock.

DW

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Doug
Sent: Friday, April 02, 2010 10:57 AM
To: 'U2 Users List'
Subject: Re: [U2] UD: Phantoms

Bill:

Use the LOCK command with number 0 through 63. Have your phantom process do a "LOCK 60". Then you can test it in other programs using the else clause:

LOCK 60 THEN
  UNLOCK 60
* Restart phantom
END ELSE
* Phantom is running do nothing
END

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Haskett
Sent: Friday, April 02, 2010 9:25 AM
To: U2 Mail List
Subject: [U2] UD: Phantoms

In UniData, does anyone know of a sure way to determine if a BASIC program is running as a phantom?

We have a background service program in our application that has to be running as a phantom whenever UniData starts. The ability to start something when the dbms starts doesn't exist in UniData, so I have to schedule the task when Windows starts. However, if the program stops (or UD was stopped and restarted) I have no sure way to know if it's running.

Does UD have any way to know this?

Thanks,

Bill Haskett

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to