Inside a running CL program can you find the lib that the program is running from?

50 pts.
Tags:
AS/400
CL programming
CL/400
Can you find in a running CL program the lib that it was started from? For example in a C program you can get the library name from argv[0].

Answer Wiki

Thanks. We'll let you know when a new response is added.

Look at the QUSRJOBI api. I think that format JOBI0700 has what you are looking for.

_______________________________________________________________

Do you really want ‘started from’? More typical would be the library the program is currently running from (which 99.999% of the time is the same). If you’re interested in running from then the following code will do that:

<pre>
Pgm
Dcl Var(&PgmInfo) Type(*Char) Len(80)
Dcl Var(&BytPrv) Type(*Int) Stg(*Defined) +
DefVar(&PgmInfo)
Dcl Var(&BytAvl) Type(*Int) Stg(*Defined) +
DefVar(&PgmInfo 5)
Dcl Var(&Format) Type(*Int) Stg(*Defined) +
DefVar(&PgmInfo 9)
Dcl Var(&Rsv) Type(*Char) Stg(*Defined) Len(4) +
DefVar(&PgmInfo 13)
Dcl Var(&Lib) Type(*Char) Stg(*Defined) Len(30) +
DefVar(&PgmInfo 19)

Dcl Var(&Library) Type(*Char) Len(10)

ChgVar Var(&BytPrv) Value(80)
ChgVar Var(&Format) Value(0)
ChgVar Var(&Rsv) Value(x’00000000′)
CallPrc Prc(‘_MATPGMNM’) Parm((&PgmInfo))
ChgVar Var(&Library) Value(&Lib)
SndUsrMsg Msg(&Library) MsgType(*Info)
EndPgm
</pre>

Bruce
<a href=”http://www.brucevining.com/”>Bruce Vining Services</a>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following