× 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,

In the native environment... the first time envvars are used by a job, all of the *SYS envvars are copied to *JOB envvars in the command. From then all, all reference to the envvars uses the *JOB ones.

The *SYS ones are just "initializers" intended to set the initial value of the job level ones. The *SYS ones aren't normally used directly.

QShell, when it starts, copies the native envvars into QShell envvars. Yes, QShell has it's own set of envvars separate from the native environment.

After QShell has copied all of the native envvars, it sources the .profile file...

Finally, it runs the command you sent to it.

So in your environment:

1) *SYS is copied to *JOB.
2) QShell is started. *JOB envvar copied to QSH.
3) QShell runs .profile, replacing the PATH envvar with the one set in .profile.

However, instead of setting it in the native environment with ADDENVVAR/WRKENVVAR/etc you could've done this:

QSH CMD('export PATH=whatever; your-command-here')

This would set the PATH after the .profile is loaded, and before running 'your-command', and therefore would've worked. Likewise, if you're doing it interactively, you could simply set the PATH environment variable interactively with 'export PATH=whatever' and then run your command.

Or... you can remove the PATH variable from .profile, and set it at the *SYS level (assuming all users use the same one) and therefore it would be possible to override it by setting with WRKENVVAR/ADDENVVAR/CHGENVVAR....

Or you could set it in the user's start up program...


Pete Helgren wrote:
The answer to 1 is: Because that is the way that worked!

I could not figure out a way to change it directly unless my profile entries were causing the issue in the first place. I used the WRKENVVAR LEVEL(*SYS) command but it had no effect (maybe due to my profile entries) and in perusing the archives I found an entry that mentioned that the Environment variables weren't utilized by QSHELL. The only archive entries I found that worked pointed to changing the profile. Indeed, it DID work.

The application I was use changes about every 6 months to a year so I need to update the path so the newer executables can be found. If there is a better way to handle changes to path so that the executables can be found when run in QShell, let me know.

I agree the "hidden" nature of the files makes it "cleaner". I just have to figure out how to remind myself how to find them when I do need them.

Thanks,

Pete


Scott Klement wrote:
Hello,

What was confusing me is that the .profile files are "invisible" when you use the wrklnk command.
In Unix, a filename that starts with a dot is a "hidden" file. Much like a hidden file in Windows, you can not normally see it in a directory listing.

On Unix systems, any per-user configuration files are stored in the users home directory. However, a user logs on to their home directory and uses it for all of their documents and other work. So it'd be easy for them to accidentally delete configuration files, et al, if they weren't hidden. For example, they might be doing their "spring cleaning" and deleting the files they don't need. The casual user might not understand a "Profile" file (since it was likely installed by IT) and so might think "I never use this, I'll delete it". Causing future logins to work improperly.

That's why it's hidden. It's nicer, because it's not cluttering up your workspace, and it's safer, because the casual user won't accidentally delete it.

Not really a problem on i, because folks rarely use their home directories the way a Unix user would. Indeed, you're lucky on IBM i if the users even know the IFS exists. But, IBM treats it the way Unix does, for ease of porting apps.

Anyway... this leaves me with two questions:

1) Why do you use .profile for your PATH?

2) If you only need to change it once each year, why not just manipulate the PATH variable directly rather than updating your .profile? Is it a permanent change that lasts the whole year?


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.