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

LISTCAT on a dataset with symbolic parameters


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shreya19

New User


Joined: 13 Mar 2014
Posts: 34
Location: USA

PostPosted: Fri Apr 07, 2017 5:43 pm
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: 2455
Location: Hampshire, UK

PostPosted: Fri Apr 07, 2017 5:54 pm
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 07, 2017 6:33 pm
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: 917
Location: The Universe

PostPosted: Fri Apr 07, 2017 7:15 pm
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: 1353
Location: Israel

PostPosted: Sun Apr 09, 2017 6:43 pm
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: 34
Location: USA

PostPosted: Mon Apr 10, 2017 11:21 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
Search our Forums:

Back to Top