View previous topic :: View next topic
Author
Message
Jeff Agosta New User Joined: 08 Oct 2022Posts: 4 Location: United States
Esteemed REXX gurus -
I have a REXX process which gets a list of names via LMDLIST and then calls IDCAMS to do renames which works great for catalogued files. However, I received a requirement to do the same for UNcataloged files. To do so, I need to call IEHPROGM, however, I'm getting an error RC(16).
As a model I'm using a working batch JCL:
Code:
//STEP1 EXEC PGM=IEHPROGM
//SYSPRINT DD SYSOUT=*
//DD1 DD VOLUME=SER=LB2261,UNIT=SYSDA,DISP=OLD
//SYSIN DD *
RENAME DSNAME=XFER.JEFFA.FLAT1,VOL=SYSDA=LB2261, X
NEWNAME=JEFFA.FLAT1
RENAME DSNAME=XFER.JEFFA.PDS1,VOL=SYSDA=LB2261, X
NEWNAME=JEFFA.PDS1
REXX code excerpt:
Code:
Address TSO
"ALLOC FILE(DD1) DATASET('"dsn.di"') VOLUME("volume")",
" UNIT(SYSDA) OLD REU"
"ALLOC FILE(SYSPRINT) BLKSIZE(2660) LRECL(133) NEW REU",
" SPACE(1,1) TRACK RECFM(F,B) "
"ALLOC FILE(SYSIN) BLKSIZE(3280) LRECL(80) NEW REU",
" SPACE(1,1) TRACK RECFM(F,B) "
output.0 = 2
output.1 = " RENAME DSNAME="dsn.di",VOL=SYSDA="volume,
" X"
output.2 = " NEWNAME="newDSN
"EXECIO " output.0 " DISKW SYSIN ( FINIS STEM OUTPUT."
"CALL 'SYS1.LINKLIB(IEHPROGM)'"
end
Note the difference between the JCL and the REXX, in the REXX I needed to specify the DSN for DD1, since without it the ALLOCATE fails.
I've verified the positions of the sysin and it's correct. I will add code to programmatically do so, since the filenames will very in length. However, I am stuck on the rc(16) and can't determine a anyway to get further diagnostics?
Trace output:
Code:
128 *-* RenameDSNs:
129 *-* /**/
130 *-* parse var dsn.di hlq"."newDSN
>>> "XFER"
>>> "JEFFA.FLAT1"
131 *-* if volume = ''
>>> "0"
144 *-* else
*-* do
145 *-* Address TSO
146 *-* /**/
147 *-* "ALLOC FILE(DD1) DATASET('"dsn.di"') VOLUME("volume")"," UNIT(SYSDA) OLD REU"
>>> "ALLOC FILE(DD1) DATASET('XFER.JEFFA.FLAT1') VOLUME(LB2261) UNIT(SYSDA) OLD REU"
149 *-* "ALLOC FILE(SYSPRINT) BLKSIZE(2660) LRECL(133) NEW REU"," SPACE(1,1) TRACK RECFM(F,B) "
>>> "ALLOC FILE(SYSPRINT) BLKSIZE(2660) LRECL(133) NEW REU SPACE(1,1) TRACK RECFM(F,B) "
151 *-* "ALLOC FILE(SYSIN) BLKSIZE(3280) LRECL(80) NEW REU"," SPACE(1,1) TRACK RECFM(F,B) "
>>> "ALLOC FILE(SYSIN) BLKSIZE(3280) LRECL(80) NEW REU SPACE(1,1) TRACK RECFM(F,B) "
153 *-* output.0 = 2
>>> "2"
154 *-* output.1 = " RENAME DSNAME="dsn.di",VOL=SYSDA="volume," X"
>>> " RENAME DSNAME=XFER.JEFFA.FLAT1,VOL=SYSDA=LB2261 X"
156 *-* /**/
157 *-* output.2 = " NEWNAME="newDSN
>>> " NEWNAME=JEFFA.FLAT1"
158 *-* /**/
159 *-* "EXECIO " output.0 " DISKW SYSIN ( FINIS STEM OUTPUT."
>>> "EXECIO 2 DISKW SYSIN ( FINIS STEM OUTPUT."
160 *-* "CALL 'SYS1.LINKLIB(IEHPROGM)'"
>>> "CALL 'SYS1.LINKLIB(IEHPROGM)'"
+++ RC(16) +++
161 *-* end
163 *-* If rc = '0'
>>> "0"
168 *-* else
169 *-* Do
170 *-* say dsn' rename failed!!! :-('
>>> "XFER.JEFFA.FLAT1 rename failed!!! :-("
XFER.JEFFA.FLAT1 rename failed!!! :-(
171 *-* Address ISPEXEC
172 *-* "LMINIT DATAID(DATAID) DDNAME(SYSPRINT)"
>>> "LMINIT DATAID(DATAID) DDNAME(SYSPRINT)"
173 *-* "VIEW DATAID(&DATAID)"
>>> "VIEW DATAID(&DATAID)"
Back to top
Willy Jensen Active Member Joined: 01 Sep 2015Posts: 712 Location: Denmark
Rd 16 means 'An unrecoverable error exists. The utility is ended' so something is clearly wrong.
You don't have UNIT for neither SYSIN nor SYSPRINT.
Suggest allocate SYSPRINT to DA(*) to get the messages immediately while testing.
Did you check the SYSLOG for possible security or other mesages?
One suggestion, use blksize 0 for new output datasets.
Check ISRDDN afterwards, view SYSIN and SYSPRINT DDnames.
Back to top
Jeff Agosta New User Joined: 08 Oct 2022Posts: 4 Location: United States
@Willy Jensen-
DA(*) was a HUGE help. the issue was that the ',' at the end of
Code:
output.1 = " RENAME DSNAME="dsn.di",VOL=SYSDA="volume",
" X"
Added the ',' and it works perfectly! Funny when a dirt spec on the screen isn't enuf!
Code:
output.1 = " RENAME DSNAME="dsn.di",VOL=SYSDA="volume",",
" X"
Now I just need to clean up the code to be flexible to handle different dataset name lengths (up to 44 bytes) to ensure the continuation character is in the 72 position.
Once complete, I'll share a copy if anyone is interested.
Again, Willy a huge thanks!!!
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2023 Location: USA
Code:
output.1 = Left( " RENAME DSNAME="dsn.di",VOL=SYSDA="volume",", 71 ),
|| "X"
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2023 Location: USA
Code:
. . . . . . . . . . . .
Queue Left( " RENAME DSNAME="dsn.di",”, 71) || “X”
Queue Left( Copies( “ “, 15) || “VOL=SYSDA="volume”,”, 71) || "X"
Queue Copies( “ “, 15 ) || "NEWNAME="newDSN
"EXECIO" Queued() "DISKW SYSIN (FINIS"
. . . . . . . . .
Back to top
Jeff Agosta New User Joined: 08 Oct 2022Posts: 4 Location: United States
SergeyKen -
Thank you, that's exactly what I needed!
I had to restrict the input DSN length to <= 38 due to the SYSIN line length of 72, otherwise it works like a charm!
Code:
else if length(dsn.di) <= maxDSNlen then do
Address TSO
"ALLOC FILE(DD1) DATASET('"dsn.di"') VOLUME("volume")",
" UNIT(SYSDA) OLD REU"
"ALLOC FILE(SYSPRINT) DA(*)" /* use for testing */
/*"ALLOC FILE(SYSPRINT) BLKSIZE(2660) LRECL(133) NEW REU",
" SPACE(1,1) TRACK RECFM(F,B) " */
"ALLOC FILE(SYSIN) BLKSIZE(3280) LRECL(80) NEW REU",
" SPACE(1,1) TRACK RECFM(F,B) "
output.0 = 2
output.1 = Left( " RENAME DSNAME="dsn.di",VOL=SYSDA="volume",", 71 ),
|| "X"
output.2 = " NEWNAME="newDSN
"EXECIO " output.0 " DISKW SYSIN ( FINIS STEM OUTPUT."
"CALL 'SYS1.LINKLIB(IEHPROGM)'"
end
else do
rc=99
say dsn.di 'renamed failed due to name length= 'length(dsn.di),
' maximum allowed in newOSDSN is 'maxDSNlen
end
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2023 Location: USA
Jeff Agosta wrote:
SergeyKen -
Thank you, that's exactly what I needed!
I had to restrict the input DSN length to <= 38 due to the SYSIN line length of 72, otherwise it works like a charm!
Code:
else if length(dsn.di) <= maxDSNlen then do
Address TSO
"ALLOC FILE(DD1) DATASET('"dsn.di"') VOLUME("volume")",
" UNIT(SYSDA) OLD REU"
"ALLOC FILE(SYSPRINT) DA(*)" /* use for testing */
/*"ALLOC FILE(SYSPRINT) BLKSIZE(2660) LRECL(133) NEW REU",
" SPACE(1,1) TRACK RECFM(F,B) " */
"ALLOC FILE(SYSIN) BLKSIZE(3280) LRECL(80) NEW REU",
" SPACE(1,1) TRACK RECFM(F,B) "
output.0 = 2
output.1 = Left( " RENAME DSNAME="dsn.di",VOL=SYSDA="volume",", 71 ),
|| "X"
output.2 = " NEWNAME="newDSN
"EXECIO " output.0 " DISKW SYSIN ( FINIS STEM OUTPUT."
"CALL 'SYS1.LINKLIB(IEHPROGM)'"
end
else do
rc=99
say dsn.di 'renamed failed due to name length= 'length(dsn.di),
' maximum allowed in newOSDSN is 'maxDSNlen
end
1) Split your first statement line in two parts (as in my example), to not limit your DSN length
2) Instead of stem variable, better use the program stack for input/output (as in my example)
Back to top
Jeff Agosta New User Joined: 08 Oct 2022Posts: 4 Location: United States
SergeyKen -
Indeed! I am in your awe!
I've attached the results of our collective labors. Thanks to you and Willy for all your help!
Back to top
Please enable JavaScript!