View previous topic :: View next topic
|
Author |
Message |
shreya19
New User
Joined: 13 Mar 2014 Posts: 34 Location: USA
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
shreya19
New User
Joined: 13 Mar 2014 Posts: 34 Location: USA
|
|
|
|
Thanks a lot everyone
I used the one suggested by steve-myers
It runs perfectly fine |
|
Back to top |
|
|
|