This solution requires TSO:

   alloc_dd. = ''
   call get_alloc_dds

 :

   if \ dd_exists('ABCXYZ') then ...

 :
 :

/* Get allocated DDs */
get_alloc_dds_MVS: procedure,
   expose alloc_dd.
address TSO

   x = outtrap('listalc.')
   "LISTALC STATUS"
   x = outtrap('OFF')

   do i = 2 to listalc.0
      line = listalc.i

      if left(line,1) \= ' ' then do
         parse var line dsn dd .
         if dd \= '' then
            alloc_dd.dd = dsn
         end
      else do
         parse var line 3 dd ' ' .
         if dd \= '' then
            alloc_dd.dd = dsn
         end

      end

   return


/* Check if a DD name is allocated to this step */
dd_exists: procedure,
   expose alloc_dd.
   arg dd_name
   true  = 1
   false = 0

   if alloc_dd.dd_name = '' then return false

   return true



-----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