Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 26
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: 1932
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: 8201
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: 587
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: 1252
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: 26
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 File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
This topic is locked: you cannot edit posts or make replies. Selecting two copybooks of different ... Vignesh Sid COBOL Programming 8 Tue Sep 05, 2017 7:28 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us