× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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,

Dean.Eshleman@xxxxxxxxxxxxxx wrote:
I'm trying to use the CPYENVVAR *YES on the SBMJOB command and it
doesn't
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
found)'

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...


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.