Well I'm new to rexx and now working on an assignment in which I would
like to realize such a feature:
For example MYID.PROC(MYREXX) is the rexx being executed. Can I get
the dataset (and member) name of the rexx, ie. 'MYID.PROC(MYREXX)', in
the rexx itself without passing an argument?
Thanks!
Wesh
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX
_http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A370/3.14?SH
ELF=IKJ4BK80&DT=20060626210253_
(http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A370/3.14?SHELF=IKJ4BK80&DT=20060626210253)
Rob
In a message dated 10/26/2009 11:42:30 P.M. US Mountain Standard Tim,
So can I say it means that I'm not able to get the dataset name? Then
I have to add an arg
/* REXX */
Parse Source . . Member DDName .
"ISPEXEC LMINIT DATAID(DDID) DDNAME(&DDNAME)"
"ISPEXEC LMOPEN DATAID(&DDID)"
"ISPEXEC LMMFIND DATAID(&DDID) MEMBER(&MEMBER) STATS(YES)"
Say "Dataset number in concatenation sequence:" ZLLIB
"ISPEXEC QBASELIB &DDNAME ID(DSNS)"
Dsns = Translate(DSNS,' ',',')
Say "Dataset that "Member" came from in "DDName" concatenation is",
Strip(Word(DSNS,ZLLIB),"B","'")
"ISPEXEC LMCLOSE DATAID(&DDID)"
"ISPEXEC LMFREE DATAID(&DDID)"
This assumes that there are no more than 16 datasets in the concatenation - LMMFIND (apparently) returns 1 to 16 for the dataset number.
--
Andy Styles
This e-mail is private and confidential and may contain privileged material. If you have received this e-mail in error, please notify the sender and delete it immediately. You must not copy, distribute, disclose or use any of the information in it or any attachments.
Lloyds TSB Bank plc. Registered Office: 25 Gresham Street, London EC2V 7HN. Registered in England and Wales, number 2065. Telephone: 020 7626 1500.
Lloyds TSB Scotland plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95237. Telephone: 0131 225 4555.
Cheltenham & Gloucester plc. Registered Office: Barnett Way, Gloucester GL4 3RL. Registered in England and Wales, number 2299428. Telephone: 01452 372372.
Cheltenham & Gloucester Savings is a division of Lloyds TSB Bank plc.
Lloyds TSB Bank plc, Lloyds TSB Scotland plc and Cheltenham & Gloucester plc are authorised and regulated by the Financial Services Authority.
Lloyds Banking Group plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95000. Telephone: 0131 225 4555.
Telephone calls may be monitored or recorded.
>Hello all,
>
>Well I'm new to rexx and now working on an assignment in which I would
>like to realize such a feature:
>For example MYID.PROC(MYREXX) is the rexx being executed. Can I get
>the dataset (and member) name of the rexx, ie. 'MYID.PROC(MYREXX)', in
>the rexx itself without passing an argument?
/* REXX - example to find where code was run from. */
/* It assumes cataloged data sets. Not well tested either. */
/* */
/* Doug Nadel */
/* With SWA code lifted from Gilbert Saint-flour's SWAREQ exec */
/* */
Say find_origin() /* say where this was executed
from */
Exit
find_origin:
Procedure
answer='* UNKNOWN *' /* assume disaster */
Parse Source . . name dd ds . /* get known info */
Call listdsi(dd 'FILE') /* get 1st ddname from file */
Numeric digits 10 /* allow up to 7FFFFFFF */
If name = '?' Then /* if sequential exec */
answer=''''ds'''' /* use info from parse source */
Else /* now test for members */
If sysdsn(''''sysdsname'('name')''')='OK' Then /* if in 1st ds */
answer=''''sysdsname'('name')''' /* go no further */
Else /* hooboy! Lets have some fun!*/
Do /* scan tiot for the ddname */
tiotptr=24+ptr(12+ptr(ptr(ptr(16)))) /* get ddname array */
tioelngh=c2d(stg(tiotptr,1)) /* nength of 1st entry */
Do Until tioelngh=0 | tioeddnm = dd /* scan until dd found */
tioeddnm=strip(stg(tiotptr+4,8)) /* get ddname from tiot */
If tioeddnm <> dd Then /* if not a match */
tiotptr=tiotptr+tioelngh /* advance to next entry */
tioelngh=c2d(stg(tiotptr,1)) /* length of next entry */
End
If dd=tioeddnm Then /* if we found it, loop through
the data sets doing an swareq
for each one to get the
dsname */
Do Until tioelngh=0 | stg(4+tiotptr,1)<> " "
tioejfcb=stg(tiotptr+12,3)
jfcb=swareq(tioejfcb) /* convert SVA to 31-bit addr */
dsn=strip(stg(jfcb,44)) /* dsname JFCBDSNM */
vol=storage(d2x(jfcb+118),6) /* volser JFCBVOLS (not used) */
If sysdsn(''''dsn'('name')''')='OK' Then /* found it? */
Leave /* we is some happy campers! */
tiotptr=tiotptr+tioelngh /* get next entry */
tioelngh=c2d(stg(tiotptr,1)) /* get entry length */
End
answer=''''dsn'('name')''' /* assume we found it */
End
Return answer
ptr: Return c2d(storage(d2x(Arg(1)),4))
stg: Return storage(d2x(Arg(1)),Arg(2))
swareq:
Procedure
If right(c2x(Arg(1)),1) \= 'F' Then /* SWA=BELOW ? */
Return c2d(Arg(1))+16 /* yes, return sva+16 */
sva = c2d(Arg(1)) /* convert to decimal */
tcb = c2d(storage(21c,4)) /* TCB PSATOLD */
tcb = ptr(540) /* TCB PSATOLD */
jscb = ptr(tcb+180) /* JSCB TCBJSCB */
qmpl = ptr(jscb+244) /* QMPL JSCBQMPI */
qmat = ptr(qmpl+24) /* QMAT QMADD */
Do While sva>65536
qmat = ptr(qmat+12) /* next QMAT QMAT+12 */
sva=sva-65536 /* 010006F -> 000006F */
End
Return ptr(qmat+sva+1)+16
(change Arabic number to Roman numeral to email)
FILENAME = PLAY(SYSPROC PLAY)
... and it'll return the full DSNAME(PLAY) file string.
- Rick
/* REXX FUNCTION PLAY */
TRACE R
ARG DDNAME MEMBER
CALL "OUTTRAP" "LISTA."
"LISTA ST"
CALL "OUTTRAP" "OFF"
DSNAME_LIST = ""
DO X = 1 TO LISTA.0
PARSE VAR LISTA.X V1 V2
IF V1 = "TERMFILE" THEN ITERATE
IF LEFT(LISTA.X,LENGTH(V1)+2) ¬= " "DDNAME THEN ITERATE
CALL FIND_LIBRARY
LEAVE
END
EXIT
FIND_LIBRARY:
Y = X-1
PARSE VAR LISTA.Y V3 V4
CALL CHECK_FOR_MEMBER
IF X = LISTA.0 THEN RETURN
DO Y = X+1 TO LISTA.0 UNTIL (V3 ¬= "" & V4 ¬= "")
PARSE VAR LISTA.Y V3 V4
SELECT
WHEN V3 = "TERMFILE" THEN LEAVE
WHEN LEFT(LISTA.Y,11) = " " THEN ITERATE
WHEN (V3 ¬= "" & V4 ¬= "") THEN ITERATE
OTHERWISE CALL CHECK_FOR_MEMBER
END
END
CHECK_FOR_MEMBER:
IF SYSDSN("'"STRIP(V3)"("MEMBER")'") = "OK" THEN
EXIT STRIP(V3)"("MEMBER")"
ELSE RETURN
>>> bububut <bub...@GMAIL.COM> 10/27/2009 11:16 PM >>>
George Fogg
Boeing Company
z/OS Enterprise Server Design/Build
MS: 7M-RE PH: (425) 865-1576
email: george...@boeing.com
My test exec looks like this:
/* REXX EXEC TESTRR */
TRACE R
PARSE SOURCE XXX
PARSE VAR XXX . . MEMBER DDNAME .
SAY "I AM" PLAY(DDNAME MEMBER)
EXIT
... and here's what it does:
3 *-* PARSE SOURCE XXX
>>> "TSO COMMAND TESTRR SYSPROC ? ? TSO ISPF ?"
4 *-* PARSE VAR XXX . . MEMBER DDNAME .
>.> "TSO"
>.> "COMMAND"
>>> "TESTRR"
>>> "SYSPROC"
>.> "? ? TSO ISPF ?"
5 *-* SAY "I AM" PLAY(DDNAME MEMBER)
>>> "I AM RICK.LIB.EXEC(TESTRR)"
I AM RICK.LIB.EXEC(TESTRR)
6 *-* EXIT
- Rick
>>> "Fogg, George C" <george...@BOEING.COM> 10/29/2009 11:44 AM
>Here's a quick and dirty that will do what you want. It may need some
>tuning.
>Paste it into a library in your SYSPROC, then call it with
>
>FILENAME = PLAY(SYSPROC PLAY)
Which is all well and good if the code is in SYSPROC. What if it was ALTLIB'd
and you have no clue what the DDN might be?
I posted Doug Nadel's solution which cares not how the code was invoked.
Current search order ...
<snip>
Signal on Novalue Name Cond_Novalue
mute = OUTTRAP('ALTLIB.')
Address TSO
"ALTLIB DISPLAY"
mute = OUTTRAP('OFF')
</>
...and what is on a DD
<snip>
Signal on Novalue Name Cond_Novalue
Arg DD
If arg(1,'O') Then Exit(12)
Address ISPEXEC
" QBASELIB "DD" ID(DDDSN)"
If rc > 0 Then exit(rc)
dsns = Translate(dddsn," ",",'")
#words = words(dsns)
Do #d = 1 to words(dsns)
dsn = STRIP(word(dsns,#d))
DSN_On_DD.DD.#d = dsn
End
DSN_On_DD.DD.0 = #words
</>
PETER NANCOLLIS
Systems Programmer
CSC
Euxton House, Euxton Lane, Chorley, Lancs, PR7 6FE
Managed Services Sector (MSS) | Office: 44(0)1257.236117 | Mobile: n/a |
Fax: 44(0)1257.236509 | pnan...@csc.com | www.csc.com
CSC • This is a PRIVATE message. If you are not the intended recipient,
please delete without copying and kindly advise us by e-mail of the
mistake in delivery. NOTE: Regardless of content, this e-mail shall not
operate to bind CSC to any order or other contract unless pursuant to
explicit written agreement or government initiative expressly permitting
the use of e-mail for such purpose • CSC Computer Sciences Limited •
Registered Office: Royal Pavilion, Wellesley Road, Aldershot, Hampshire,
GU11 1PZ, UK • Registered in England No: 0963578
PARSE SOURCE . . wclname wddn .
ADDRESS ISPEXEC " QBASELIB "wddn" ID(DDDSN)"
IF RC ¬= 0 THEN DO
SAY "DDname" wddn "not allocated"
EXIT
END
dsns = TRANSLATE(dddsn," ",",'")
wdsn = STRIP(WORD(dsns,1))
SAY wclname 'executed from' "'"wdsn"'"
Paulo Caze
------------------------------------------
-----Mensagem original-----
De: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] Em nome de Peter Nancollis
Enviada em: sexta-feira, 30 de outubro de 2009 08:52
Para: TSO-...@VM.MARIST.EDU
Assunto: Re: [TSO-REXX] can a REXX know its dataset name?
Address TSO
"ALTLIB DISPLAY"
"Esta mensagem e uma correspondencia reservada e sua divulgacao, distribuicao, reproducao ou qualquer forma de utilizacao depende de autorizacao, sujeitando-se o responsavel a medidas judiciais. O remetente utiliza o correio eletronico no exercicio do seu trabalho ou em razao dele, eximindo esta instituicao de qualquer responsabilidade por utilizacao indevida. Se voce a recebeu por engano, favor elimina-la."
"This message is a reserved correspondence and its disclosure, distribution, reproduction or any other form of use shall depend upon proper authorization, and the recipient responsible for such disclosure, distribution, reproduction or use shall be subject to legal actions. The sender uses the electronic mail in the exercise of his/her work or by virtue thereof, and the institution accepts no liability for its undue use. If you have received this e-mail by mistake, please delete it."
Thank you for your help! I added them up to produce my final version.
I can't use the ISPEXEC way since sometimes the rexx doesn't have ISPF
environment
PARSE SOURCE . . MEM DDNAME CHANCE .
IF CHANCE \= '?' THEN DO
SAY 'FIND ME HERE:'
SAY CHANCE'('MEM')'
EXIT
END
X=OUTTRAP('LISTA.')
"LISTA ST"
X=OUTTRAP('OFF')
DO I=1 TO LISTA.0
IF WORD(LISTA.I,1)=DDNAME THEN DO
IS=I-1
LEAVE
END
END
DO I=IS TO LISTA.0 BY 2
PATH=LISTA.I'('MEM')'
ANSWER=SYSDSN("'"PATH"'")
IF ANSWER='OK' THEN DO
SAY "I'M HERE! :)"
SAY PATH
LEAVE
END
END
On Fri, Oct 30, 2009 at 9:31 PM, Paulo Roberto Caze Silva
<paulo.ca...@itau-unibanco.com.br> wrote:
> Why not using PARSE Source to obtain the ddname that is allocated to running REXX exec ?
> AFAIK that ddname can be obtained even if allocated with ALTLIB
> Of course, in this solution we are assuming this REXX is running under ISPF
>
> PARSE SOURCE . . wclname wddn .
>
> ADDRESS ISPEXEC " QBASELIB "wddn" ID(DDDSN)"
> IF RC �= 0 THEN DO
> � SAY "DDname" wddn "not allocated"
> � EXIT
> END
>
> dsns = TRANSLATE(dddsn," �",",'")
> wdsn = STRIP(WORD(dsns,1))
>
> SAY wclname 'executed from' "'"wdsn"'"
>
>
> Paulo Caze
> ------------------------------------------
>
>
>
> -----Mensagem original-----
> De: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] Em nome de Peter Nancollis
> Enviada em: sexta-feira, 30 de outubro de 2009 08:52
> Para: TSO-...@VM.MARIST.EDU
> Assunto: Re: [TSO-REXX] can a REXX know its dataset name?
>
> As well as the LISTA and LM services solutions may want to consider if
> there is an active ALTLIB
>
> Current search order ...
> <snip>
> Signal on Novalue Name Cond_Novalue
>
> �mute = OUTTRAP('ALTLIB.')
>
> �Address TSO
> � "ALTLIB DISPLAY"
>
> �mute = OUTTRAP('OFF')
> </>
>
>
> ...and what is on a DD
> <snip>
> Signal on Novalue Name Cond_Novalue
>
> Arg DD
> If arg(1,'O') Then Exit(12)
>
> Address ISPEXEC
> �" QBASELIB "DD" � ID(DDDSN)"
> �If rc > 0 Then exit(rc)
>
>
> dsns = Translate(dddsn," �",",'")
>
> � #words = words(dsns)
> Do #d = 1 to words(dsns)
> � dsn = STRIP(word(dsns,#d))
> � DSN_On_DD.DD.#d = dsn
> End
> � DSN_On_DD.DD.0 �= #words
> </>
>
> PETER �NANCOLLIS
> Systems Programmer
> CSC
>
> Euxton House, Euxton Lane, Chorley, Lancs, PR7 6FE
> Managed Services Sector (MSS) | Office: 44(0)1257.236117 | Mobile: n/a |
> Fax: 44(0)1257.236509 | pnan...@csc.com | www.csc.com
>
> CSC � This is a PRIVATE message. If you are not the intended recipient,
> please delete without copying and kindly advise us by e-mail of the
> mistake in delivery. �NOTE: Regardless of content, this e-mail shall not
> operate to bind CSC to any order or other contract unless pursuant to
> explicit written agreement or government initiative expressly permitting
> the use of e-mail for such purpose � CSC Computer Sciences Limited �
> Registered Office: Royal Pavilion, Wellesley Road, Aldershot, Hampshire,
> GU11 1PZ, UK � Registered in England No: 0963578
>
>
> "Esta mensagem e uma correspondencia reservada e sua divulgacao, distribuicao, reproducao ou qualquer forma de utilizacao depende de autorizacao, sujeitando-se o responsavel a medidas judiciais. O remetente utiliza o correio eletronico no exercicio do seu trabalho ou em razao dele, eximindo esta instituicao de qualquer responsabilidade por utilizacao indevida. Se voce a recebeu por engano, favor elimina-la."
>
> "This message is a reserved correspondence and its disclosure, distribution, reproduction or any other form of use shall depend upon proper authorization, and the recipient responsible for such disclosure, distribution, reproduction or use shall be subject to legal actions. The sender uses the electronic mail in the exercise of his/her work or by virtue thereof, and the institution accepts no liability for its undue use. If you have received this e-mail by mistake, please delete it."
----------------------------------------------------------------------
Just keep in mind that this works only if the REXX was run from a DD name.
If the user ran an EX command with the library specified manually, this
doesn't get you what you need.
---
Bob Bridges, rhb...@attglobal.net, cell 336 382-7313
/* "Consider how much more you often suffer from your anger and grief, than
from those very things for which you are angry and grieved." -Marcus
Antonius. "All of your pain and suffering comes from your resistance to
what is." -Dick Sutphen's one-sentence summary of the teachings of Buddha.
"The chief pang of most trials is not so much the actual suffering itself as
our own spirit of resistance to it." -Jean Nicolas Grou (1731-1803). */
-----Original Message-----
From: Paulo Roberto Caze Silva
Sent: Friday, October 30, 2009 09:31
Why not using PARSE Source to obtain the ddname that is allocated to running
REXX exec ? AFAIK that ddname can be obtained even if allocated with ALTLIB
Of course, in this solution we are assuming this REXX is running under ISPF
PARSE SOURCE . . wclname wddn .
ADDRESS ISPEXEC " QBASELIB "wddn" ID(DDDSN)"
IF RC �= 0 THEN DO
SAY "DDname" wddn "not allocated"
EXIT
END
dsns = TRANSLATE(dddsn," ",",'")
wdsn = STRIP(WORD(dsns,1))
SAY wclname 'executed from' "'"wdsn"'"
----------------------------------------------------------------------