I may be late to the party on this one, if so, my apologies.

Yes you can you LISTDSI to do this.  The secret is to test the return and 
reason codes. 

Here's an example of checking to ensure //REPORT DD has been allocated:

if LISTDSI('REPORT FILE') > 4 then,  /* 4 means successful, but some info not 
available */
    if SYSREASON <> 3 & SYSREASON <> 8 then,     /* SYSREASON=3 means dataset 
is of a type that can't be processed (therefore it IS allocated) */          
                                                                                
       /* SYSREASON = 8 means dataset is not on a DASD device (but IS 
allocated) */
         do;                                                
              say 'DDNAME REPORT IS UNUSABLE';                   
              RETURN 12;            
         end;                                                          

-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
Billy Ashton
Sent: Wednesday, August 21, 2024 2:28 PM
To: [email protected]
Subject: Simple Rexx question

Hi all, I have a simple question, but my searches are eluding me (maybe 
I don't know what to ask for).

In my Rexx program, before I try to do an EXECIO against it, I want to 
do something to make sure the DD statement is there and control the 
error. I tried ListDSI, but that only works on DASD files and not on 
instream (DD *) data.

How can I test that I have the ABCXYZ DD statement allocated, if it is 
DD * or DD DATA? Likewise, how can I test for DD JKLMNO that is 
allocated to SYSOUT=* to be sure it is there (as I am writing via EXECIO 
to it)?

Thank you and best regards,
Billy Ashton

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to