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


  • Subject: Re: Find a CL program's library - While it is running
  • From: John Earl <johnearl@xxxxxxxxxxx>
  • Date: Wed, 05 May 1999 11:17:59 -0700
  • Organization: PowerTech Toolworks & The 400 School

Dave (and all),

Thanks for the samples and suggestions.

This problem defied some of the simpler solutions because the CL program in
question gets a qualified call (call lib/pgm) with no parameters passed, and
after it is called I need to determine which library it was called from so that 
I
can get that library into the library list (and I don't know what my libraries
name is at this point).

I ended up using an RPG program because the Program Status Data Structure can
easily provide the library name.  It was then just a simple matter of having the
RPG program call the CL program passing the library as a parameter.  Here's a
code sample;

D DeclareFields   DS
D  QualifiedName                21
D*
D PgmStatusDS    SDS
D  PgmLibrary            81     90
C*
C* Assemble the qualified Program name for the 'call' op code
C*
C                   EVAL      QualifiedName = %TRIMR(PgmLibrary) +
C
%TRIML('/PROGRAMA')
C*
C* Call the CL program passing the Library name.
C                   CALL      QualifiedName
C                   PARM                    PgmLibrary
C*
C                   EVAL      *INLR = *ON
C                   RETURN

It's not a CL solution, but it does get the job done....

It was after I got this working that I read Brendan's solution, and I have to
agree with Dave that it is really quite brilliant.

Thanks again to all,

jte

David Morris wrote:

> John,
>
> I don't think sending messages will get you the library.  I think
> you will have to look directly at the job stack.  You can retrieve
> the job stack from within your program using the Materialize
> Stack MI instruction.  I will send you an example directly.
> However I think you would be better off passing the library as
> a parameter.
>
> David Morris
>
> >>> John Earl <johnearl@toolnet.com> 05/04/99 12:32PM >>>
> Does anyone remember the trick to finding a CL program's
> library while it is running? (that's an important part of
> this uestion <g>).
>
> I thought that it involved the program sending a
> message to itself, but I can't remember the specifics.
> Any help?
>
> jte
>
> --
> John Earl   johnearl@toolnet.com
>
> PowerTech Toolworks  206-575-0711
> PowerLock Network Security www.toolnet.com
> The 400 School   www.400school.com
> --
>
> +---
> | This is the Midrange System Mailing List!
> | To submit a new message, send your mail to MIDRANGE-L@midrange.com.
> | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
> | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: david@midrange.com
> +---



--
John Earl   johnearl@toolnet.com

PowerTech Toolworks  206-575-0711
PowerLock Network Security www.toolnet.com
The 400 School   www.400school.com
--


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


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.