I did this to myself earlier today.  It took hours to understand
and generate a small test case.  I managed do delete a data set
but leave the catalog entry.  When I subsequently tried to
allocate the data set, ALLOCATE apparently succeeded with RC=0,
but LISTDSI( ... FILE ) fails with RC=16 RSN=24.  Did I
allocate the data set successfully or not?

If LISTSERV discards my Rexx attachment, I'll repost.
/* ---------------------------------------------------------------------- */
/* Rexx */  signal on novalue;  /*
*/
trace Err
address 'TSO'
DSN = userid()'.TEST.LIST.DSI'

/* Create and catalogue a data set; report its volume.
*/
RC = BPXWDYN( 'alloc dd(SYSUT2) dsn('''DSN''') mod catalog' ,
              'rtvol(V) reuse' )
say '  Catalogued instance on volume' V
RC = LISTDSI( 'SYSUT2 FILE' )
say 'LISTDSI(SYSUT2) returns        ' SYSVOLUME RC SYSREASON
'free dd(SYSUT2)'

/* Allocate another DDNAME to the same data set without reference
   to the catalog.  Delete it, leaving a dangling catalog entry.
*/
RC = BPXWDYN( 'alloc dd(SYSUT4) dsn('''DSN''') mod delete' ,
              'vol('V') reuse' )
'free dd(SYSUT4)'

/* Now the strangeness.  ALLOCATE succeeds with RC=0,
   but LISTDSI( ... FILE' ) gives RC=16, RSN=24.  Why?
   FREE, not surprisingly, gives RC=12

   I'd expect that ALLOCATE and LISTDSI either both fail
   or both succeed.
*/
say
say '???????????????????????????????????'
'allocate dd(SYSUT3) dsn('''DSN''') mod catalog reuse'
say'RC from ALLOCATE is' RC
parse value '(none) (none)' with SYSVOLUME SYSREASON
RC = LISTDSI( 'SYSUT3 FILE' )
say 'LISTDSI(SYSUT3) returns        ' SYSVOLUME RC SYSREASON
'free dd(SYSUT3)'
say 'RC =' RC
say '???????????????????????????????????'
say

/* Tidy up.
*/
RC = BPXWDYN( 'alloc dd(SYSUT5) dsn('''DSN''') mod uncatalog' ,
              'vol('V') reuse' )
RC = LISTDSI( 'SYSUT5 FILE' )
'free dd(SYSUT5)'

/* Experimental control:
   Can LISTDSI() deal with uncatalogued files?
*/
'alloc dd(SYSUT6) dsn(FOO.BAR) new delete'
'alloc dd(SYSUT7) dsn(FOO.BAR) new delete'
RC = LISTDSI( 'SYSUT7 FILE' )
say 'LISTDSI(SYSUT7) returns        ' SYSVOLUME RC SYSREASON
RC = LISTDSI( 'SYSUT6 FILE' )
say 'LISTDSI(SYSUT6) returns        ' SYSVOLUME RC SYSREASON
'free dd(SYSUT6)'
'free dd(SYSUT7)'
exit( RC )
/* ---------------------------------------------------------------------- */

-- gil
-- 
StorageTek
INFORMATION made POWERFUL

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to