Apologies, I spotted a typo after hitting send: 3. The TESTLSA, TESTREXA1, and TESTREXA3 scripts are duplicates of the TESTLS, TESTREX1, and TESTREX3 scripts but stored as ISO8859 text rather than as IBM1047 text.
TESTREX3, not TESTREX2 Peter -----Original Message----- From: IBM Mainframe Discussion List <[email protected]> On Behalf Of Farley, Peter x23353 Sent: Monday, September 12, 2022 3:28 PM To: [email protected] Subject: Re: How to use LISTDSI from Rexx under Unix shell? EXTERNAL EMAIL I finally found the round tuits to finish this exercise, so here is what I found works. I hope my test pastes here make it through the listserver manipulations. Apologies if they do not. Setup: 1. In my Unix $HOME directory I created a new "exec" directory 2. Below are listed the contents of that "exec" directory with CCSID tags shown (and non-relevant lines omitted), followed by a listing of each of the three scripts TESTLS, TESTREX1, TESTREX3 3. The TESTLSA, TESTREXA1, and TESTREXA3 scripts are duplicates of the TESTLS, TESTREX1, and TESTREX2 scripts but stored as ISO8859 text rather than as IBM1047 text. 4. The PDSE named TSOUSER.EXEC contains a copy of TESTLS identical to the /u/tsouser/exec/TESTLS file The TESTREX1 script executes the TESTLS script stored in the TSOUSER.EXEC PDSE. The TESTREX3 script executes the TESTLS script stored in /u/tsouser/exec/TESTLS. The TESTLS script executes a LISTDSI using the DSN passed as its only argument and prints out the RC and SYSREASON from the LISTDSI, and if the RC is zero it then prints some of the LISTDSI returned variable contents. Listed first below are the results of running the TESTREX1 and TESTREX3 scripts directly from the Unix shell command prompt. Note that running the ISO8859 versions TESTREXA1 or TESTREXA3 will generate the same results as TESTREX1 and TESTREX3. The key requirement is that if you want to execute a Rexx script stored in a Unix directory under "ADDRESS TSO" then that script MUST be coded in IBM1047 (or, I suspect, any valid EBCDIC CCSID). The "starting" script (the one you execute from the shell prompt) can be coded in either an EBCDIC CCSID or in ISO8859 (and probably also UTF-8) but that capability is probably under the influence of the AUTOCVT option(s). The first key takeaway is that a Rexx script stored in the Unix file system and executed under "ADDRESS TSO" in a Rexx script executed from the shell MUST be stored in an EBCDIC CCSID. If you change the Unix-stored script name to be executed under "ADDRESS TSO" in the TESTREX3 script to TESTLSA (the ISO8859 version), it fails with a WRNG.LEN.REC I/O error from BPAM. The second key takeaway is that the stack does not survive the transition from "ADDRESS TSO" back to the script executing under the shell. I tried using "QUEUE" instead of "SAY" in the TESTLS script, but the values stacked got "executed" under the "ADDRESS TSO" umbrella, so "ADDRESS TSO" scripts that want to return data have to use "SAY" to transmit information back to the invoking script. Peter /u/tsouser/exec > TESTREX1 'TSOUSER.EXEC' 3 *-* parse source env how fullname fromddn fromdsn fromname hostcmd hostasn >>> "TSO" >>> "COMMAND" >>> "./exec/TESTREX1" >>> "PATH" >>> "./exec/TESTREX1" >>> "?" >>> "SH" >>> "OMVS OpenMVS" 4 *-* SAY "PARSE SOURCE =" env how fullname fromddn fromdsn fromname hostcmd hostasn >>> "PARSE SOURCE = TSO COMMAND ./exec/TESTREX1 PATH ./exec/TESTREX1 ? SH OMVS OpenMVS" PARSE SOURCE = TSO COMMAND ./exec/TESTREX1 PATH ./exec/TESTREX1 ? SH OMVS OpenMVS 5 *-* CALL OUTTRAP OUT. >>> "OUT." >>> "OUT." 6 *-* ADDRESS TSO 7 *-* "ALLOC FI(SYSEXEC) DA('TSOUSER.EXEC') SHR" >>> "ALLOC FI(SYSEXEC) DA('TSOUSER.EXEC') SHR" 8 *-* "TESTLS 'TSOUSER.EXEC'" >>> "TESTLS 'TSOUSER.EXEC'" 9 *-* "FREE FI(SYSEXEC)" >>> "FREE FI(SYSEXEC)" 10 *-* DO I=1 TO OUT.0 >>> "1" >>> "4" 11 *-* SAY OUT.I >>> "PARSE SOURCE = TSO COMMAND TESTLS SYSEXEC ? ? TSO TSO/E ?" PARSE SOURCE = TSO COMMAND TESTLS SYSEXEC ? ? TSO TSO/E ? 12 *-* END 10 *-* DO I=1 TO OUT.0 11 *-* SAY OUT.I >>> "RUNNING LISTDSI('TSOUSER.EXEC')" RUNNING LISTDSI('TSOUSER.EXEC') 12 *-* END 10 *-* DO I=1 TO OUT.0 11 *-* SAY OUT.I >>> "LISTDSI RC = 0 REASON = 0000" LISTDSI RC = 0 REASON = 0000 12 *-* END 10 *-* DO I=1 TO OUT.0 11 *-* SAY OUT.I >>> "DSN=TSOUSER.EXEC,DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=32720" DSN=TSOUSER.EXEC,DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=32720 12 *-* END 10 *-* DO I=1 TO OUT.0 13 *-* EXIT /u/tsouser/exec > TESTREX3 'TSOUSER.EXEC' 3 *-* parse source env how fullname fromddn fromdsn fromname hostcmd hostasn >>> "TSO" >>> "COMMAND" >>> "./exec/TESTREX3" >>> "PATH" >>> "./exec/TESTREX3" >>> "?" >>> "SH" >>> "OMVS OpenMVS" 4 *-* SAY "PARSE SOURCE =" env how fullname fromddn fromdsn fromname hostcmd hostasn >>> "PARSE SOURCE = TSO COMMAND ./exec/TESTREX3 PATH ./exec/TESTREX3 ? SH OMVS OpenMVS" PARSE SOURCE = TSO COMMAND ./exec/TESTREX3 PATH ./exec/TESTREX3 ? SH OMVS OpenMVS 5 *-* CALL OUTTRAP OUT. >>> "OUT." >>> "OUT." 6 *-* ADDRESS TSO 7 *-* "ALLOC FI(SYSEXEC) PATH('/u/tsouser/exec') DSNTYPE(HFS)" , "PATHMODE(SIRUSR,SIXUSR) PATHOPTS(ORDONLY)" , "FILEDATA(TEXT) PATHDISP(KEEP, KEEP)" >>> "ALLOC FI(SYSEXEC) PATH('/u/tsouser/exec') DSNTYPE(HFS) PATHMODE(SIRUSR,SIXUSR) PATHOPTS(ORDONLY) FILEDATA(TEXT) PATHDISP(KEEP, KEEP)" 10 *-* "TESTLS 'TSOUSER.EXEC'" >>> "TESTLS 'TSOUSER.EXEC'" 11 *-* "FREE FI(SYSEXEC)" >>> "FREE FI(SYSEXEC)" 12 *-* DO I=1 TO OUT.0 >>> "1" >>> "4" 13 *-* SAY OUT.I >>> "PARSE SOURCE = TSO COMMAND TESTLS SYSEXEC ? ? TSO TSO/E ?" PARSE SOURCE = TSO COMMAND TESTLS SYSEXEC ? ? TSO TSO/E ? 14 *-* END 12 *-* DO I=1 TO OUT.0 13 *-* SAY OUT.I >>> "RUNNING LISTDSI('TSOUSER.EXEC')" RUNNING LISTDSI('TSOUSER.EXEC') 14 *-* END 12 *-* DO I=1 TO OUT.0 13 *-* SAY OUT.I >>> "LISTDSI RC = 0 REASON = 0000" LISTDSI RC = 0 REASON = 0000 14 *-* END 12 *-* DO I=1 TO OUT.0 13 *-* SAY OUT.I >>> "DSN=TSOUSER.EXEC,DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=32720" DSN=TSOUSER.EXEC,DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=32720 14 *-* END 12 *-* DO I=1 TO OUT.0 15 *-* EXIT /u/tsouser > ls -laT exec total 192 drwxr-xr-x 2 TSOUSER USERGRP 8192 Aug 30 01:40 . drwxr-x--- 11 TSOUSER USERGRP 8192 Sep 12 13:22 .. t IBM-1047 T=on -rwxr-xr-x 1 TSOUSER USERGRP 416 Sep 12 12:54 TESTLS t ISO8859-1 T=on -rwxr-xr-x 1 TSOUSER USERGRP 416 Sep 12 13:03 TESTLSA t IBM-1047 T=on -rwxr-xr-x 1 TSOUSER USERGRP 385 Aug 29 22:12 TESTREX1 t IBM-1047 T=on -rwxr-xr-x 1 TSOUSER USERGRP 471 Aug 29 23:40 TESTREX3 t ISO8859-1 T=on -rwxr-xr-x 1 TSOUSER USERGRP 353 Aug 29 22:17 TESTREXA1 t ISO8859-1 T=on -rwxr-xr-x 1 TSOUSER USERGRP 501 Sep 12 12:58 TESTREXA3 This is the TESTLS script: /* REXX */ TRACE "O" parse source env how fullname fromddn fromdsn fromname hostcmd hostasn SAY "PARSE SOURCE =" env how fullname fromddn fromdsn fromname hostcmd hostasn ARG DSN2LIST SAY "RUNNING LISTDSI("DSN2LIST")" RRC = LISTDSI(DSN2LIST) SAY 'LISTDSI RC =' RRC 'REASON =' SYSREASON IF RRC = 0 THEN DO SAY 'DSN='SYSDSNAME',DSORG='SYSDSORG',RECFM='SYSRECFM ||, ',LRECL='SYSLRECL',BLKSIZE='SYSBLKSIZE END This is the TESTREX1 script: /* REXX */ TRACE 'R' parse source env how fullname fromddn fromdsn fromname hostcmd hostasn SAY "PARSE SOURCE =" env how fullname fromddn fromdsn fromname hostcmd hostasn CALL OUTTRAP OUT. ADDRESS TSO "ALLOC FI(SYSEXEC) DA('TSOUSER.EXEC') SHR" "TESTLS 'TSOUSER.EXEC'" "FREE FI(SYSEXEC)" DO I=1 TO OUT.0 SAY OUT.I END EXIT This is the TESTREX3 script: /* REXX */ TRACE 'R' parse source env how fullname fromddn fromdsn fromname hostcmd hostasn SAY "PARSE SOURCE =" env how fullname fromddn fromdsn fromname hostcmd hostasn CALL OUTTRAP OUT. ADDRESS TSO "ALLOC FI(SYSEXEC) PATH('/u/tsouser/exec') DSNTYPE(HFS)" , "PATHMODE(SIRUSR,SIXUSR) PATHOPTS(ORDONLY)" , "FILEDATA(TEXT) PATHDISP(KEEP, KEEP)" "TESTLS 'TSOUSER.EXEC'" "FREE FI(SYSEXEC)" DO I=1 TO OUT.0 SAY OUT.I END EXIT -----Original Message----- From: IBM Mainframe Discussion List <[email protected]> On Behalf Of Farley, Peter x23353 Sent: Friday, August 26, 2022 12:51 PM To: [email protected] Subject: Re: How to use LISTDSI from Rexx under Unix shell? Thank you Hank. I was able to use those examples and your suggestion to get something working that uses LISTDSI. I will post my results later after a bit more experimentation. It appears that LISTDSI is not *immediately* available in a Rexx script started directly from the shell, but *IS* available when you run another Rexx routine with "address TSO" from a Rexx script started directly from the shell. I'll post more later about exactly what works and what does not. Peter -----Original Message----- From: IBM Mainframe Discussion List <[email protected]> On Behalf Of Hank Oerlemans Sent: Friday, August 26, 2022 1:21 AM To: [email protected] Subject: Re: How to use LISTDSI from Rexx under Unix shell? See https://urldefense.com/v3/__https://www.ibm.com/docs/en/zos/2.4.0?topic=environment-examples__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!NSbZd0CNeUaU5BZESy4PzCYcXfYNfc_-HKIWdGYsJ1Msk5gyoo6kuUDqq1LLiI5hNhxUcBIlkTXgbGAIT_xeMlIM0ZT36o6fwu7OPmoq$ Use your OMVS Rexx to Address TSO 'exec (mydsi)' your working code and outtrap to work with the results. -- This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
