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

Checking availability of a file using JCL


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

Active User


Joined: 14 Dec 2008
Posts: 107
Location: India

PostPosted: Thu May 21, 2009 4:23 pm
Reply with quote

Hi,

I have a JCL for which the input file is the latest version of a GDG. But, there are cases when the latest version of GDG is not avilable, and only GDG base is available. The JCL throws up JCL error in these cases. Is there any way to check the availability of a file using a JCL? If the file is present the JCL should be doing a certain set of operation, and if the file is not present it should do another set of operations..

Thank you,
Ravi.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu May 21, 2009 4:33 pm
Reply with quote

Yes, you can run the IDCAMS LISTCAT command in batch, and then follow a set of processes depending on the results.
Back to top
View user's profile Send private message
hiravibk
Warnings : 1

Active User


Joined: 14 Dec 2008
Posts: 107
Location: India

PostPosted: Thu May 21, 2009 5:38 pm
Reply with quote

SuperK,
Thank you so much for your suggestion.
superk wrote:
Yes, you can run the IDCAMS LISTCAT command in batch, and then follow a set of processes depending on the results.


Could you please provide me a sample JCL for this??

Thank you,
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu May 21, 2009 5:44 pm
Reply with quote

hiravibk wrote:
Could you please provide me a sample JCL for this??
Thank you,

Why, can you NOT read a manual yourself or at least google it ?
Back to top
View user's profile Send private message
hiravibk
Warnings : 1

Active User


Joined: 14 Dec 2008
Posts: 107
Location: India

PostPosted: Thu May 21, 2009 8:23 pm
Reply with quote

Hi,


I tried the below code,
Code:
//STEP0100 EXEC PGM=IKJEFT01                       
//SYSTSPRT DD DSN=aa333.output,disp=shr                             
//SYSTSIN  DD *                                   
  LISTCAT ENT('aa7788.check.ds') ALL           
     
//*


I understand that i get a return code of 4 if the file 'aa7788.check.ds' is not found and a return code of 0 if the file is found. but i have a problem in using the code for checking the latest version of GDG..To check for the latest version of GDG, i need to mention the GDG name as 'a999.eeee.r(0)'...but the system does not accept this and throws a JCL error saying value 'a999.eeee.r(0)' should have been an entry name...Please tell me how can i solve this issue..
Thank you,
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu May 21, 2009 9:17 pm
Reply with quote

Hello,

You need to scan the output of the listcat and see if any generations are currently cataloged.
Back to top
View user's profile Send private message
krunalbafna
Warnings : 1

Active User


Joined: 18 Jan 2010
Posts: 143
Location: Pune

PostPosted: Mon Mar 19, 2012 5:37 pm
Reply with quote

Hi,
My file name is in passed as parameter to proc.
INFILE=AAA.BBB

I want to check for above file if it exists or not in proc using symbolic override. May you let me know how to use it:

for testing i tried using SET parameter as follow:
// SET DSNUT1=AAA.BBB
//JS10 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTCAT ENTRIES("&INFILE")
/*

But i am getting JCL error.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 19, 2012 5:42 pm
Reply with quote

though there is an exception
(that i forget / actually ignore/ i am sure someone will post the exception)
instream data can not contain symbolics

it can, but the substitution will not be made.

a quick and dirty change would be:

//INFILE DD DSN=smbolic


listcat entry(INFILE)
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Mar 19, 2012 6:16 pm
Reply with quote

You've tailgated an old topic. Please don't, but start a new topic for a new question.

You did not get a JCL error (not with what you posted) you got an error in IDCAMS.

If you were on the latest z/OS you should be able to do it, so you're not.

If you want to know if it exists, just including it on a DD name will tell you, as the Job will fail if the file doesn't exit.

What are you actually trying to do?
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top