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
 

 

LISTCAT on a dataset with symbolic parameters

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
shreya19

New User


Joined: 13 Mar 2014
Posts: 25
Location: USA

PostPosted: Fri Apr 07, 2017 5:43 pm    Post subject: LISTCAT on a dataset with symbolic parameters
Reply with quote

I want to look if the dataset is present or not, using listcat. The dataset name has yymm in it. so how can I code it for listcat?
LISTCAT LEVEL('ABC.D&YYMM') doesn't work.

Passing the dataset name to INDD and then giving LISTCAT(INDD) doesn't work too. It gives JCL error if dataset doesn't exist.
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1846
Location: UK

PostPosted: Fri Apr 07, 2017 5:54 pm    Post subject:
Reply with quote

If you have the right level of OS and your LISCAT control card is in-stream then you can use a symbolic parameter. Otherwise you cannot so you would have to use a program of some kind to generate the LISTCAT statement with the YYMM resolved.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8132
Location: East Dubuque, Illinois, USA

PostPosted: Fri Apr 07, 2017 6:33 pm    Post subject:
Reply with quote

Is this a one-time job or is it something you plan on running every month? If it will be running every month, explore the capabilities of your job scheduler -- several of them allow symbolic substitution in in-stream parameters. Otherwise, if you're running z/OS 2.1 or higher you can use SET, EXPORT SYMLIST= and SYMBOLS= in your JCL to pass the symbol to your in-stream data.

If you're not running 2.1 or higher, or you are not using in-stream data, then you are limited to writing a program to generate the LISTCAT statement(s) as Nic said.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 546
Location: The Universe

PostPosted: Fri Apr 07, 2017 7:15 pm    Post subject:
Reply with quote

Don't forget (or if you didn't know) – not only is LISTCAT an IDCAMS command, it is also a TSO command, which opens up all sort of possibilities. For example -
Code:
//        SET  YMM='1207'
//A       EXEC PGM=IKJEFT01,
// PARM='LISTCAT ALL ENT(''&SYSUID..BKUP.D&YMM'')'
//SYSTSPRT DD  SYSOUT=*
//SYSTSIN  DD  DUMMY
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1235
Location: Israel

PostPosted: Sun Apr 09, 2017 6:43 pm    Post subject:
Reply with quote

This is also an option:
Code:
//*-------------------------------------------
//STEP01   EXEC  PGM=SORT                     
//SORTIN   DD    *                           
  LISTCAT LEVEL(ABC.D????)                   
//SORTOUT  DD    DISP=(NEW,PASS),DSN=&LSTC,   
// SPACE=(TRK,(1,1)),UNIT=VIO
//SYSOUT   DD    SYSOUT=*                     
//SYSIN    DD    *                           
  SORT     FIELDS=COPY                       
  INREC    IFTHEN=(WHEN=(22,4,CH,EQ,C'????'),
           OVERLAY=(82:&DATE2,22:84,4))       
  OUTREC   BUILD=(1,80)                       
//*-------------------------------------------
//STEP02   EXEC  PGM=IDCAMS                   
//SYSPRINT DD    SYSOUT=*                     
//SYSIN    DD    DISP=(OLD,DELETE),DSN=&LSTC 
//*-------------------------------------------

1. No need to have a date hardcoded.
2. I didn't find how to get the date as YYMM, so I had to use column 82 trick.
3. It is possible to calculate previous month if necessary.
Back to top
View user's profile Send private message
shreya19

New User


Joined: 13 Mar 2014
Posts: 25
Location: USA

PostPosted: Mon Apr 10, 2017 11:21 am    Post subject:
Reply with quote

Thanks a lot everyone icon_smile.gif
I used the one suggested by steve-myers
It runs perfectly fine icon_smile.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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Unable to copy data from spool in a d... srikant314 JCL & VSAM 8 Fri Jul 28, 2017 9:10 pm
No new posts Paasing symbolic parameter to instrea... Robert Sample JCL & VSAM 2 Thu Jul 27, 2017 1:22 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts Browse dataset cvnlynn CLIST & REXX 4 Tue Jul 18, 2017 3:52 am
No new posts Fileaid 2 commands instream work. In ... descann Compuware & Other Tools 2 Tue May 16, 2017 3:31 pm


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