IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Extract the Dataset name in the input DDNAME to a variable


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Thu May 28, 2009 2:51 pm
Reply with quote

Hi!

I have the below JCL step
Code:
//DDIN     DD DSN=ABCDEF.GHIJLJG.ETRUR(TEST1),DISP=SHR


I use the below code to read the contents of the Disk in the DDIN DDNAME.

Code:
"EXECIO * DISKR DDIN (STEM Code. FINIS "
"FREE FI(DDIN)" 


If I need the data set name 'ABCDEF.GHIJLJG.ETRUR(TEST1)' from which I have read the contents, in a variable. Is there any builtins for that?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu May 28, 2009 2:55 pm
Reply with quote

I believe it can be done
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Thu May 28, 2009 2:57 pm
Reply with quote

Is there any builtins for the same?
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu May 28, 2009 3:24 pm
Reply with quote

LISTDSI.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu May 28, 2009 3:25 pm
Reply with quote

Take a look at the LISTDSI function using the FILE parameter
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Thu May 28, 2009 7:09 pm
Reply with quote

I tried the below code

Code:
/* REXX */                             
RCX = LISTDSI("'"TESTDD1"'" FILE)     
  SAY '      RC:            'RCX       
  SAY '     DSN: SYSDSNAME  'SYSDSNAME
  SAY '    UNIT: SYSUNIT    'SYSUNIT   
  SAY '   DSORG: SYSDSORG   'SYSDSORG 
  SAY '   RECFM: SYSRECFM   'SYSRECFM 
  SAY '   LRECL: SYSLRECL   'SYSLRECL 
  SAY ' BLKSIZE: SYSBLKSIZE 'SYSBLKSIZE
  SAY '    UNIT: SYSUNITS   'SYSUNITS 
  SAY ' PRIMARY: SYSPRIMARY 'SYSPRIMARY
  SAY '  SECOND: SYSSECONDS 'SYSSECONDS



Code:
//VALIDATE EXEC PGM=IKJEFT01,PARM='TEST'         
//SYSEXEC  DD DSN=MY.LIBRARY,DISP=SHR
//SYSTSIN  DD DUMMY                             
//SYSPRINT DD SYSOUT=*                           
//SYSTSPRT DD SYSOUT=*                           
//TESTDD1  DD DSN=MY DATASET,DISP=SHR


I get the message as
Code:

IKJ56701I MISSING DSNAME
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu May 28, 2009 7:23 pm
Reply with quote

Example #2 from the manual:

To retrieve information about the DD called APPLPAY, you can use LISTDSI as follows:



ddinfo = LISTDSI("applpay" "FILE")
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Thu May 28, 2009 7:39 pm
Reply with quote

Code:
/* REXX */                           
DDINFO = LISTDSI("TESTDD1" "FILE")   
  SAY '     DSN: SYSDSNAME  'SYSDSNAME


Even for the above, I get the same message


Code:
IKJ56701I MISSING DSNAME


icon_sad.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu May 28, 2009 7:46 pm
Reply with quote

This works for me
Code:

X   = LISTDSI("DUMPREF  FILE")
DUMPDSN = SYSDSNAME           
SAY DUMPDSN                   
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu May 28, 2009 8:07 pm
Reply with quote

I tested and got the
Code:
IKJ56701I MISSING DSNAME
message as long as I had
Code:
//VALIDATE EXEC PGM=IKJEFT01,PARM='TEST' 
when I changed it to
Code:
//VALIDATE EXEC PGM=IKJEFT01
the message went away and the results were precisely as expected from the manual.
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Thu May 28, 2009 8:16 pm
Reply with quote

Code:
/* REXX */                   
X   = LISTDSI("DUMPREF  FILE")
DUMPDSN = SYSDSNAME           
SAY DUMPDSN   



Code:
//VALIDATE EXEC PGM=IKJEFT01,PARM='TEST'         
//SYSEXEC  DD DSN=MY LIBRARY,DISP=SHR
//SYSTSIN  DD DUMMY                             
//SYSPRINT DD SYSOUT=*                           
//SYSTSPRT DD SYSOUT=*                           
//DUMPREF  DD DSN=MY.DATASET,DISP=SHR


Code:
IKJ56701I MISSING DSNAME
READY                   
END   


I get the same message expat
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Thu May 28, 2009 8:54 pm
Reply with quote

It works fine for me.
Code:
/* REXX LISTDSN */                     
trace OFF                             
PARSE UPPER ARG DDN REST               
IF LENGTH(DDN) > 0 THEN DO             
  RCX = LISTDSI(DDN "FILE")           
  SAY '     DSN: SYSDSNAME  ' SYSDSNAME
END                                   
ELSE DO                               
  SAY 'PARM DDNAME MISSING'           
END                                   
                                       
Exit                                   
Code:
//STEP02 EXEC PGM=IKJEFT01,PARM='LISTDSN TESTDD1'         
//SYSEXEC  DD DSN=HLQ.REXX.EXEC,DISP=SHR             
//SYSTSIN  DD DUMMY                                       
//SYSPRINT DD SYSOUT=*                                   
//SYSTSPRT DD SYSOUT=*                                   
//*TESTDD1  DD DSN=HLQ.TEST.INPUT,DISP=SHR           
//TESTDD1   DD DSN=HLQ.TEST.GDG(+1),                 
//             DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=0),
//             DISP=(NEW,CATLG,DELETE),                   
//             UNIT=DISK,SPACE=(CYL,(1,1),RLSE)           
Code:
     DSN: SYSDSNAME   HLQ.TEST.GDG.G0007V00
READY                                           
END                                             
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu May 28, 2009 11:17 pm
Reply with quote

//VALIDATE EXEC PGM=IKJEFT01,PARM='TEST'

You know, that's a really poor choice of a name to use for a REXX exec, since TEST is a TSO command. Either change the name to something better, or make sure you use an implicit request for the exec named TEST by specifiying %TEST. icon_rolleyes.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
Search our Forums:

Back to Top