One way I've dealt with this issue in the past is by having the 'INCLUDE' in the code always, then testing for something I know should be initialized with TESTVAR = UNASSIGNED(varname) -- if the variable would return 'Not Assigned a value' then TESTVAR would be 1, and I would know to run my 'Initialize' routine...
DW > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Bill Haskett > Sent: Tuesday, September 16, 2008 12:09 PM > To: u2-users@listserver.u2ug.org > Subject: RE: [U2] [UD] Determining if program running as a phantom > > Thanks David. This doesn't work, however. I run a program > in DesignBais using UniObjects. In this program I execute a > phantom. In the phantom program I have to initialize some > variables. This code is in an include every program uses. > So, in the include I test if the running program is a phantom > and if it is then I initialize a few critical common variables. > > Port# 4 is the initial program while port# 6 is the phantom. > Here's what I get from the various variables. > > 2 Dev (0)-> AE _PH_ * > > 3 record(s) selected. > > < 1 > Top of "designbais35286_3872" in "_PH_", 8 lines, 222 > characters. > *--: p > 001: @USER.TYPE---: 1 > 002: @TTY---------: Console > 003: PORT.NO------: 6 > 004: SYSTEM(48)---: _PH_\designbais35286_3872 > 005: ...Entry DEV_DESIGNBAIS_6_1487035287.txt > 006: ...Entry DEV_DESIGNBAIS_6_1487035288.txt > 008: PHANTOM process 3872 has completed. > Bottom. > *--: ex > Quit "designbais35286_3872" in file "_PH_" unchanged. > < 2 > Top of "O_designbais" in "_PH_", 5 lines, 136 characters. > *--: p > 001: E:\DataTrust\Dev\_PH_\O_designbais established > 002: @USER.TYPE---: 1 > 003: @TTY---------: udcs > 004: PORT.NO------: 4 > 005: SYSTEM(48)---: _PH_\designbais35286 Bottom. > *--: ex > Quit "O_designbais" in file "_PH_" unchanged. > < 3 > Top of "O_designbais.1" in "_PH_", 22 lines, 557 characters. > *--: p > 001: > 002: --- 09/16/2008 09:48:06 --------------- > 003: E:\DataTrust\Dev\_PH_\O_designbais established > 004: @USER.TYPE---: 1 > 005: @TTY---------: udcs > 006: PORT.NO------: 4 > 007: SYSTEM(48)---: > 008: --- 09/16/2008 09:48:08 --------------- > 009: E:\DataTrust\Dev\_PH_\O_designbais established > 010: @USER.TYPE---: 1 > 011: @TTY---------: udcs > 012: PORT.NO------: 4 > 013: SYSTEM(48)---: _PH_\designbais35286 > 014: @USER.TYPE---: 1 > 015: @TTY---------: udcs > 016: PORT.NO------: 4 > 017: SYSTEM(48)---: _PH_\designbais35286 > 018: @USER.TYPE---: 1 > 019: @TTY---------: udcs > 020: PORT.NO------: 4 > 021: SYSTEM(48)---: _PH_\designbais35286 > 022: --- 09/16/2008 09:48:11 --------------- Bottom. > *--: > > As you can see, both the phantom on port# 6 and the original > program on port# 4 has data returned by SYSTEM(48). I think > DesignBais turns COMO ON when it runs everything in order to > log program activity, which greatly assists debugging, then > turns it off when complete. So this isn't a solution. > > It would be nice if UD supplied some kind of system variable > that could be relied upon since as we convert our application > to DesignBais, we find ourselves doing more and more > processing as phantoms. > > Presently, our solution is to do the following: > > * > ** Determine if the running program is a phantom. > ListOfUsers = LISTUSER() > IsPhantom = 0 > uHigh = DCOUNT(ListOfUsers, @AM) > FOR UserCnt = 1 TO uHigh > UserLine = ListOfUsers<UserCnt> > UserPort = UserLine<1,1> > IF UserPort = PORT.NO THEN > IsPhantom = (OCONV(UserLine<1,5>, 'MCU') = 'PHANTOM') > EXIT > END > NEXT UserCnt > > ...which seems to work everywhere I've tested it. > > Thanks again, > > Bill > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > David A. Green > Sent: Tuesday, September 16, 2008 7:18 AM > To: u2-users@listserver.u2ug.org > Subject: RE: [U2] [UD] Determining if program running as a phantom > > Try using SYSTEM(48). A Phantom process will have a COMO file. > > Thanks, > David A. Green > www.dagconsulting.com > (480) 813-1725 > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Bill Haskett > Sent: Monday, September 15, 2008 7:54 PM > To: u2-users@listserver.u2ug.org > Subject: [U2] [UD] Determining if program running as a phantom > > I'm having a bit of a problem figuring out how to tell, > within a program, if it is running as a phantom. It was my > impression that @USER.TYPE would be set to '1' if the program > was running as a phantom. However, if I run a program from a > UniObjects connection @USER.TYPE is always set to '1'. It > doesnt matter I test this within the main program that > EXECUTEs a phantom > or within the phantomed program. If I test @TTY then it > returns 'udcs' > from within the main program or Console from within the > phantomed program (I hate to think this is how I determine if > a program is running as a phantom ). > > > If I execute the LISTUSER() function then the line properly > shows the user type as a 'phantom'. > > > The 'phantomed' process. > > *--: p > 001: @USER.TYPE-: 1 > 002: @TTY-------: Console > 003: PORT.NO----: 6 > 004: LISTUSER()-: > 12251621976152myuser2phantom2pts/12Console210:33:322Sep 15 > 2008 > 005: 2263221976152myuser2udt2pts/22192.168.1.51216:41:202Sep 15 2008 > 006: 32383621976152myuser2udt2pts/32192.168.1.51215:11:522Sep 15 2008 > 007: 42358421976402designbai2udt2pts/42udcs219:30:062Sep 15 2008 > 008: 52337621976152myuser2udt2pts/52192.168.1.51215:31:312Sep 15 2008 > 009: > 62238821976402designbai2phantom2pts/62Console219:30:532Sep 15 2008 > 010: ...Entry DEV_DESIGNBAIS_6_1486970254.txt > 011: ...Entry DEV_DESIGNBAIS_6_1486970255.txt > 013: PHANTOM process 2388 has completed. > Bottom. > > The process executing the above phantomed job > *--: p > 001: E:\DataTrust\Dev\_PH_\O_designbais established > 002: @USER.TYPE-: 1 > 003: @TTY-------: udcs > 004: PORT.NO----: 4 > 005: LISTUSER()-: > 12251621976152myuser2phantom2pts/12Console210:33:322Sep 15 > 2008 > 006: 2263221976152myuser2udt2pts/22192.168.1.51216:41:202Sep 15 2008 > 007: 32383621976152myuser2udt2pts/32192.168.1.51215:11:522Sep 15 2008 > 008: 42358421976402designbai2udt2pts/42udcs219:30:062Sep 15 2008 > 009: 52337621976152myuser2udt2pts/52192.168.1.51215:31:312Sep 15 2008 > > I've resorted to parsing the results of LISTUSER() to get > what appears to be the correct information. Does anyone know > of an easier alternative. > > Thanks, > > Bill Haskett > Advantos Systems, Inc. > 4370 La Jolla Village Drive, Suite 400 > San Diego, CA 92122 > ( 760-944-5570 x3000 (CA) > ( 360-923-4838 (WA) > ------- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/