You need to quote the dsname in apostrophes if it's fully qualified. Try

 x = LISTDSI("'"dsn"'")

This might be more readable:

apostrophe = "'"
x = listdsi(apostrophe||dsn||apostrophe)

--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3
עַם יִשְׂרָאֵל חַי
נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר

________________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Steve Estle <sest...@gmail.com>
Sent: Thursday, January 4, 2024 2:55 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: LISTDSI - hardcoded dsn vs. read in from file

All,

I'm sure I'm doing something boneheaded but can't quite figure out what.  I 
have a list of fully qualified datasets in a file that I want to read the 
dataset names once per record and then once I've read the record with dataset 
name then use that name in a LISTDSI command.  When I hard code name in REXX 
exec it works fine - when I read dsname from file it fails.  I've hardcoded the 
enclosing double quote/quote inside my file as follows:

"'SYS1.PARMLIB'"

When it fails (2nd version) I get this error message:

IKJ56712I INVALID KEYWORD, "'SYS1.PARMLIB'"

Two scenarios:

Works Fine:

/* REXX */

/*------------------------------------------------------------------*/

/*    S E L E C T   D S N S   &  L I S T   I N F O        */

/*------------------------------------------------------------------*/

   DSName = "'SYS1.PARMLIB'"

   Say DSName

   x = LISTDSI(DSName)

   SAY 'Function code from LISTDSI is:                 ' x

   SAY 'The data set name is:                          ' sysdsname

   SAY 'The device unit on which the volume resides is:' sysunit

   SAY 'The record format is:                          ' sysrecfm

   SAY 'The logical record length is:                  ' syslrecl

   SAY 'The block size is:                             ' sysblksize

   SAY 'The allocation in space units is:              ' sysalloc


EXIT

Failing Version:

/* REXX */



INDSN = "'P69792.LISTDSI.INPUT'"

OUTDSN = "'P69792.LISTDSI.OUTPUT.CSV'"

DDNI  = "DD"||RANDOM(1,99999)

DDNO  = "DD"||RANDOM(1,99999)



/*------------------------------------------------------------------*/

/*                      R E A D   D S N   L I S T                   */

/*------------------------------------------------------------------*/

ADDRESS TSO "ALLOC DA(" INDSN ") DDNAME( " DDNI ") SHR REUSE "

ADDRESS TSO "ALLOC DA(" OUTDSN ") DDNAME( " DDNO ") OLD REUSE "

ADDRESS TSO "EXECIO * DISKR " DDNI "(STEM Dsni. FINIS"

ADDRESS TSO "FREE DDNAME(" DDNI ") "



/*------------------------------------------------------------------*/

/*    S E L E C T   D S N S   &  L I S T   I N F O                  */

/*------------------------------------------------------------------*/


   Trace i

DO I = 1 TO Dsni.0

   dsn = Word(Dsni.I,1)

   Say dsn

   x = LISTDSI(dsn)

   SAY 'Function code from LISTDSI is:                 ' x

   SAY 'The data set name is:                          ' sysdsname

   SAY 'The device unit on which the volume resides is:' sysunit

   SAY 'The record format is:                          ' sysrecfm

   SAY 'The logical record length is:                  ' syslrecl

   SAY 'The block size is:                             ' sysblksize

   SAY 'The allocation in space units is:              ' sysalloc

END I


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to