×
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.
On 07-Nov-2011 10:48 , James Lampert wrote:
Is there an easy way for a CL program to know what library it's
located in?
It needs to access a similarly named IFS directory, according to
the library where it lives.
A subroutine in the CLP could effect something like the following
code snippet; as currently coded, assumes the bytes returned will always
include the active CLP [OPM] in the first 200 bytes provided:
<code>
pgm
dcl &rcvdta *char 200
dcl &rcvlen *int 4 200
dcl &bytrtn *int 4
dcl &bytavl *int 4
dcl &nbrent *int 4
dcl &entofs *int 4
dcl &pgmsst *int 4
dcl &pgm *char 10
dcl &lib *char 10
dcl &errcde *char 08 x'0000000800000000'
dcl &ji *char 58 '*'
chgvar %sst(&ji 43 14) x'0000000000000000000000000000'
chgvar %bin(&ji 45 4) 01 /* Thread indicator; thread of this CLP */
/* get current OPM entry in stack; i.e. this CLP */
call QWVRCSTK (&rcvdta &rcvlen 'CSTK0100' &ji 'JIDF0100' &errcde)
chgvar &bytrtn %bin(&rcvdta 1 4)
chgvar &bytavl %bin(&rcvdta 5 4)
chgvar &entofs %bin(&rcvdta 13 4)
chgvar &nbrent %bin(&rcvdta 17 4)
chgvar &pgmsst (&entofs + 25)
chgvar &pgm %sst(&rcvdta &pgmsst 10)
chgvar &pgmsst (&pgmsst + 10)
chgvar &lib %sst(&rcvdta &pgmsst 10)
sndpgmmsg (&pgm *cat ':' *cat &lib) tousr(*requester)
</code>
Regards, Chuck
As an Amazon Associate we earn from qualifying purchases.