MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Allocate dataset

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
danm
Intermediate


Joined: 29 Jun 2004
Posts: 170
Topics: 73

PostPosted: Tue Aug 24, 2004 3:35 pm    Post subject: Allocate dataset Reply with quote

I run a REXX EXEC in batch mode to perform EXECIO DISKR on an INPFILE. I can either allocate the input dataset in the JCL or issue a "TSO ALLOC" in the EXEC. Which way is more efficient?

If I allocate a dataset in the JCL, I can get the dataset corresponding to the DSNAME inside the EXEC using TSO LISTALC. Is there a easier way?
Code:

JCL:
    //STEP1        EXEC  PGM=IKJEFT01,PARM='TEST1'
    //SYSPROC     DD  DSN=USERID.RXX.EXEC,DISP=SHR
    //INPFILE        DD  DSN=USERID.TEST,DISP=SHR


TEST1 EXEC:
/* REXX  */
/* Get the dataset correpsonding to the DSNAME INPFILE
   allocated in JCL                                     */

address TSO
Alloc_DSName = 'INPFILE'
xx = outtrap('REC.')
'LISTALC STATUS'
xx = outtrap("OFF")

InputFile = ''
Do I = Rec.0 to 1 by -1
  parse var Rec.I DSName .
  If have_file = 1 then do
    InputFile = DSName
    leave
  End
  If DSName = Alloc_DSName then have_file = 1
End
say 'Dataset for' Alloc_DSNAME 'is' InputFile
Exit

Output from the JCL:
  Dataset for INPFILE is USERID.TEST
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Wed Aug 25, 2004 5:59 am    Post subject: Reply with quote

I'm from the old school, where the datasets are always allocated in the JCL, rarely within a REXX exec. Usually, I reserve dataset allocations to only those situations that cannot be accomplished in the JCL, such as generating dynamic SYSIN cards. I also tend to code exec's to run as pure REXX (PGM=IRXJCL) as opposed to running under TSO (PGM=IKJEFT01), but again, it's a personal preference, and, the situations I tend to work in mandate it.

I think that you will find that the LISTDSI command is much better suited to your needs. It will return, for an allocated DD, the fully-qualified dataset name associated with the DD, along with a whole bunch of other information about the dataset.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group