• JDELIST is celebrating its 20 year anniversary today!
  • Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

Local job or Server job?

AS400Guru

Well Known Member
Hello,
Is there a way to find out from within the UBE whether the job is =
running on the Server or locally. The reason being when we call the =
Execute External Program B34A1030 we need to code the winnt\rmtcmd.exe =
or the CALL LIB/PGM depending on whether the UBE is running off the =
server or locally.

AS400 V4R5 XE-SP15 Co-existence.
 

Zoltan_Gyimesi

Legendary Poster
Hi,

Just a silly idea.

Try to use the B9800181 "Get Local Computer ID" Business Function to determine it.

Maybe it returns with the name of the server machine when the UBE runs on it instead of the name of the workstation which was submitted the UBE.

I never tried it on server, so I am also very curious what will be the return value when UBE is running on the server.
Please, update your thread if you have tried this. Thanks.

Zoltán
P.S.: You also can search for other BSFNs for your needs, seeking for e.g. "*Worstation*", "*Computer*", "*Machine*", "*Client*" and "*Server*". You will have more hits.

B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 

lisa_stinebuck

Active Member
AS400Guru,
If the UBE shows up on the bottom of your screen (in the taskbar)
minimized it is run local, otherwise it is run on the server. Also,
your mappings should also show you were things are mapped.

Lisa G. Stinebuck
Senior Service Delivery Technician
Logical EBOC Cincinnati
513-412-7950 x1021
lisa.stinebuck@us.logicaleboc.com
 

Zoltan_Gyimesi

Legendary Poster
Re: RE: Local job or Server job?

Lisa,
I really wouldn't like to offend you but I think that this is not a solution for AS400Guru.

1.) How can she/he see the taskbar of the workstation from within an UBE? (If she/he can then this make me very curious, how she/he can?)
2.) OCM mappings are only the default running locations but you can override it always when you submit a job from a workstation.

Keep Your Goodwill and Readiness to Help in the Future too,
...AND...
Read You Again on the Forum/List,

Zoltán

B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 
Hello List,

I have researched the following approach but have not actually
implemented it. However, it might work.

Copybook JDENV.h references typedef "JDENV_AS400" to see
what environment it is running in (AS/400, AIX, SUN, etc). If
running on the AS/400, then it defines JDENV_AS400.

You could solve your problem as follows:

1. Write a C business function and pass it a flag. #include JDENV.h
in the business function. Then, in the business function check
to see if JDENV_AS400 is defined:

#include jdenv.h

#if defined(JDENV_AS400)
cflag = 'X'
#endif

2. Your UBE could call this new business function. If the flag
comes back as 'X', then you call B34A1010 with "call libl/pgm"
because you are running on the AS/400. If the flag comes back
as not 'X' then you execute "c:\winnt rmtcmd call libl/pgm"
from B34A1030 because your are running locally.

3. Adjust above logic for all platforms (SUN, AIX, etc.)

I am not sure if you need to include JDENV.h, JDE.h, or both of
them. But with a little research and testing this might solve your problem. If you get time to try this approach, please post your
results as I would like to know if it works as I need this functionality also.

Thanks and Good Luck,

Danny McMillian
Eagle Software Company, Inc.
 

gerd_renz3

VIP Member
I had a similar idea.
There is a #DEFINE automatically set on OW servers that you could use.
Write a new BSFN with code like this:

ServerTest( ...)
{
#if defined IAMASERVER
return(YES) // This compiles on a server
#else
return(NO) // This compiles on a WS
#endif
}

You would have to find WHERE "IAMASERVER" is defined. If you include jde.h you probably get it. This #define is jused a lot in BSFNs. Try to find this string in your source directory and you´ll find tons of places.

Let me know if it works!

Gerd





Em Saturday, May 19, 2001 em 04:33:57 PM, jdelist@jdelist.com escreveu:



--
ISM - Solucoes na Internet

http://www.ismnet.com.br/
 

AS400Guru

Well Known Member
The Get Audit info should give you the Server name if the job is run off the
server and the workstation Id if run locally.
Hope this helps.
Thanks,

AS/400 V4R5 XE- SP15 Co-existence.
----- Original Message -----
From: "gerd_renz3" <gerd_renz@infojbs.com.br>
To: <jdelistml@jdelist.com>
Sent: Sunday, May 20, 2001 12:54 PM
Subject: Re: Local job or Server job?


jde.h you probably get it. This #define is jused a lot in BSFNs. Try to find
this string in your source directory and you´ll find tons of places.
http://198.144.193.139/cgi-bin/wwwthreads/showflat.pl?Cat=0&Board=OW&Number=
11196
 

Zoltan_Gyimesi

Legendary Poster
AS400Guru,

I have suggested to use B9800181 "Get Local Computer ID" Business Function instead of the "Get Audit Informations" BSFN because the first returns with a 15 char length machine name while the second will truncate it to 10 char length. If I am right, machine name could be 15 char length (at least on NT systems).
The truncation could cause problems when your machine names are not unique on the first 10 char positions, so be careful!

Zoltán
P.S.: Have you checked the return value of B9800181 "Get Local Computer ID" Business Function on the server too?



B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 

BillFClark

Active Member
I have tried creating a UBE to run the BSFN B34A1030 and could not get it to call my AS400 CL pgm. I even added my libraries to libl first in CL but my problem is that the RPG program does not even get called. I can tell that by dspobjd and see that it was not used. After deploying the UBE to server I actually got the UBE to complete normally but my AS400 pgm does not run. This is what I was working on a few weeks ago but dropped it due to had to move on to other things but I would really like to figure this out.

To explain what I did. I created a UBE with a header only and added an event rule. I created a variable equal to my AS400 call and then added the BSFN to call my variable. On the BSFN B34A1030 were three parameters and the only parameter I filled in was the commandLn variable.

Before I deployed the UBE to the server I was able to run my CL pgm from my PC by running the c:\winnt\rmtcmd.exe from my run line.

Please help. We have so many applications that we want to use this for. Ideally, we want to use the RUNUBE command but was told that the fix was a few weeks off. We need to have backup option working in case RUNUBE does not work completely for is not as efficient as the BSFN process.

One World Xe B7333 SP13, World 7.3, AS400 File Server, NT 4.0 Deployment Server, EDI TrustedLink E Version 5 (Premenos)
 

AS400Guru

Well Known Member
The Execute External Pgm works well only if its a simple call.In order to
call the RPG pgm you will have to pass the command as a string and if you
have worked with Open Query , you might as well guess how picky it gets when
converting the variables that you have to a string and concating it together
to get a full call statement (Eg: CALL LIBL/PGM PARM('PARM1' 'PARM2' 'PARM3'
'PARM4') etc....
I did try this out...works great if run locally and doesnt work at all when
run off the server.
What we ended up doing was creating a dummy file and adding a trigger to it
and then invoking the rpg from that Trigger pgm after adding the required
libraries......Works just fine.

You might as well try and verify whether your string that you are passing is
proper..it should look identical to as if you were calling that pgm from the
command line.

Hope this helps.

AS/400 V4R5 XE-SP13 Co-existence.
----- Original Message -----
From: "BillFClark" <clarksystm@aol.com>
To: <jdelistml@jdelist.com>
Sent: Wednesday, May 23, 2001 7:54 AM
Subject: Re: Local job or Server job?


to call my AS400 CL pgm. I even added my libraries to libl first in CL but
my problem is that the RPG program does not even get called. I can tell
that by dspobjd and see that it was not used. After deploying the UBE to
server I actually got the UBE to complete normally but my AS400 pgm does not
run. This is what I was working on a few weeks ago but dropped it due to
had to move on to other things but I would really like to figure this out.
event rule. I created a variable equal to my AS400 call and then added the
BSFN to call my variable. On the BSFN B34A1030 were three parameters and
the only parameter I filled in was the commandLn variable.
my PC by running the c:\winnt\rmtcmd.exe from my run line.
Ideally, we want to use the RUNUBE command but was told that the fix was a
few weeks off. We need to have backup option working in case RUNUBE does
not work completely for is not as efficient as the BSFN process.
Server, EDI TrustedLink E Version 5 (Premenos)
http://198.144.193.139/cgi-bin/wwwthreads/showflat.pl?Cat=&Board=OW&Number=1
1423
 

BillFClark

Active Member
To test this I was actually just calling a CL pgm that sends me a message. I can't get the BSFN to call my program. How exactly did you set up your UBE to call the BSFN?

One World Xe B7333 SP13, World 7.3, AS400 File Server, NT 4.0 Deployment Server, EDI TrustedLink E Version 5 (Premenos)
 
Bill,

I think the reason that your call to B34A1030 does not run when run
on the server is because B34A1030 uses the C "system" function to
shell out and execute an operating system command on the system
that you are running on. If you are running on the PC, then B34A1030
would look something like this system('c:\winnt rmtcmd call lib/pgm')
and would work fine because rmtcmd is a Client Access command that
runs on the PC to execute an AS/400 program.

However, if you run the same command as a parameter on the AS/400
and B34A1030 shells out to run the command via the "system" function,
then the AS/400 operating system does not know what the command
"c:\winnt\rmtcmd call lib/pgm" is. It does know what the "call
lib/pgm" command is though.

See my 5/19/01 post to see how to tell if you are running on the PC
or the AS/400.

I have not actually done this but it technically makes sense.

Please post your results if you have time to try it.

Thanks,
Danny McMillian
Eagle Software Company, Inc.
 

BillFClark

Active Member
I have never written a "C" business function but will try to do it and test your suggestion. Thanks.

One World Xe B7333 SP13, World 7.3, AS400 File Server, NT 4.0 Deployment Server, EDI TrustedLink E Version 5 (Premenos)
 
Top