×
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 Pete,
Seeing your instructions below (thanks!) I realize that I should have
clarified that I want to set the variables using the WRKENVVAR command.
WRKENVVAR?? That's a whole different subject altogether, Pete! Your
last message stated that you were using QSH (in the subject line) and
WRKENVVAR is not part of QSH, and that's what threw me off.
Anyway... the ability to use $VAR inside another variable is purely a
Unix-shell thing. You can do it from within QShell, since QShell
emulates a Unix-shell. But, WRKENVVAR is a CL command. (as are
ADDENVVAR and CHGENVVAR which is more likely what you really mean) In
CL, you can't insert an environment variable by preceding it with a
dollar-sign... that's just not part of CL's syntax.
CL is not a good language for working with environment variables -- at
present, it doesn't even have a means of retrieving the value of an
environment variable without calling an API.
Here's an example of how you might do this in RPG, however:
H DFTACTGRP(*NO)
D getenv PR * extproc('getenv')
D varname * value options(*string)
D putenv PR 10i 0 extproc('putenv')
D varval * value options(*string)
D MY_HOME s 1024A varying
D CLASSPATH s 1024A varying
D val s *
/free
val = getenv('MY_HOME');
if (val = *NULL);
my_home = '';
else;
my_home = %str(val);
endif;
val = getenv('CLASSPATH');
if (val = *NULL);
classpath = '';
else;
classpath = %str(val);
endif;
classpath += ':' + my_home;
putenv('CLASSPATH=' + classpath);
return;
/end-free
As you can see... it's waaaay easier to do in QShell. (Though, the RPG
code will certainly run faster!) Consider setting your variable in
QShell if possible.
As an Amazon Associate we earn from qualifying purchases.