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.