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
 

 

Checking availability of a file using JCL

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

Active User


Joined: 14 Dec 2008
Posts: 103
Location: India

PostPosted: Thu May 21, 2009 4:23 pm    Post subject: Checking availability of a file using JCL
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

Moderator Team Head


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

PostPosted: Thu May 21, 2009 4:33 pm    Post subject: Reply to: Checking availability of a file using JCL
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: 103
Location: India

PostPosted: Thu May 21, 2009 5:38 pm    Post subject: Re: Reply to: Checking availability of a file using JCL
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: 8593
Location: Back in jolly old England

PostPosted: Thu May 21, 2009 5:44 pm    Post subject: Re: Reply to: Checking availability of a file using JCL
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: 103
Location: India

PostPosted: Thu May 21, 2009 8:23 pm    Post subject:
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

Site Director


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

PostPosted: Thu May 21, 2009 9:17 pm    Post subject:
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    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7255

PostPosted: Mon Mar 19, 2012 6:16 pm    Post subject: Reply to: Checking availability of a file using JCL
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    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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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