|
Hi Scott,
I'm glad to hear it does work. However, I still can't get it to work for me. What is interesting is if I call my program interactively, it can retrieve my *JOB environment variable just fine. If I submit the same program to batch and specify CPYENVVAR *YES, it can't find the variable. I'm using the DSPLY opcode in RPG to display what it finds. If I submit the same program to batch and request a system level environment variable, it can retrieve that one successfully.
The "getenv" procedure is wrappered in an RPGLE program called PGMA. This program has been in production for 3 or 4 years without any problems. Here is the code for that program.
http://code.midrange.com/0c8c121182.html
I created anothe RPGLE program, PGMB to call PGMA and pass in the name of the Environment variable I want to retrieve. I use the DSPLY opcode to display the output from PGMA. Here is the code for that program.
http://code.midrange.com/a494836cc9.html
Activation groups wouldn't have anything to do with it would they?
Dean Eshleman,
MMA, Inc.
On Tue, 08 Dec 2009 16:01:37 -0600, in midrange.midrange-l you wrote:
Hi Dean,doesn't
Dean.Eshleman@xxxxxxxxxxxxxx wrote:
I'm trying to use the CPYENVVAR *YES on the SBMJOB command and itfound)'seem to be working for me. We are at V5R3.It's working for me.
I tried the following test:
ADDENVVAR ENVVAR(JDETESTVAR) VALUE('test')
SBMJOB CMD(CALL ENVMSG) CPYENVVAR(*YES)
To test it, I wrote the following ILE CL program (unfortunately, I didn't notice that you were at V5R3... this code uses V5R4 features):
PGM
dcl var(&null) type(*char) len(1) value(x'00')
dcl var(&var) type(*char) len(129)
dcl var(&nptr) type(*ptr)
dcl var(&len) type(*int) len(4)
dcl var(&ptr) type(*ptr)
dcl var(&val) type(*char) len(1025) stg(*based) basptr(&ptr)
dcl var(&msg) type(*char) len(1024)
/* Retrieve the JDETESTVAR environment variable */
chgvar var(&var) value('JDETESTVAR' *TCAT &null)
callprc prc('getenv') parm(&var) rtnval(&ptr)
/* Set the &msg variable to the value of JDETESTVAR +
or to (not found) if not found, or (blank) if empty */
if (&ptr *eq &nptr) do
chgvar &msg value('(not found)')
enddo
else do
callPrc prc('__strlen') parm(&val) +
rtnval(&len)
if (&len *le 0) do
chgvar &msg value('(blank)')
enddo
else do
chgvar &msg value(%sst(&val 1 &len))
enddo
enddo
/* Send Scott the message. */
sndmsg msg(&msg) tousr(klemscot)
endpgm
When I run it, I successfully get back a message that says 'test'. If I type RMVENVVAR JDETESTVAR and run it again, ti comes back with '(not
So it seems to be working for me.
Perhaps there's a bug in the way you're retrieving or setting the variable? One common mistake... environment variable names are cAsE-seNsiTivE. Make sure you match upper/lower case...
______________________________________________________________________
Confidentiality Notice: This information is intended only for the individual or entity named. If you are not the intended recipient, do not use or disclose this information. If you received this e-mail in error, please delete or otherwise destroy it and contact us at (800) 348-7468 so we can take steps to avoid such transmissions errors in the future. Thank you.
This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.