Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extract the Dataset name in the input DDNAME to a variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Extract the Dataset name in the input DDNAME to a variable
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: 8593
Location: Back in jolly old England

PostPosted: Thu May 28, 2009 2:55 pm    Post subject:
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    Post subject: Reply to: Extract the Dataset name in the input DDNAME to a
Reply with quote

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

Moderator Team Head


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

PostPosted: Thu May 28, 2009 3:24 pm    Post subject: Reply to: Extract the Dataset name in the input DDNAME to a
Reply with quote

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

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu May 28, 2009 3:25 pm    Post subject:
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    Post subject:
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

Moderator Team Head


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

PostPosted: Thu May 28, 2009 7:23 pm    Post subject: Reply to: Extract the Dataset name in the input DDNAME to a
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    Post subject: Reply to: Extract the Dataset name in the input DDNAME to a
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: 8593
Location: Back in jolly old England

PostPosted: Thu May 28, 2009 7:46 pm    Post subject:
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: 7912
Location: Bellevue, IA

PostPosted: Thu May 28, 2009 8:07 pm    Post subject:
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    Post subject: Reply to: Extract the Dataset name in the input DDNAME to a
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    Post subject:
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

Moderator Team Head


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

PostPosted: Thu May 28, 2009 11:17 pm    Post subject: Reply to: Extract the Dataset name in the input DDNAME to a
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 4 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us