How to check whether a PS file is cataloged or not in a JCL?

All sort of Mainframes Interview Questions.
Post Reply
User avatar
AD991
Registered Member
Posts: 93
Joined: Wed May 08, 2013 7:36 pm
India

How to check whether a PS file is cataloged or not in a JCL?

Post by AD991 »

Hi All

How to check whether a PS file is cataloged or not in a JCL, need to use the same PS JCL in the second step of the JCL?

I have tried IDCAMS using LISTCAT but it's return zero even when dataset is not found.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: How to check whether a PS file is cataloged or not in a JCL?

Post by Anuj Dhawan »

Try this:

Code: Select all

//STEP01   EXEC PGM=IDCAMS       
//SYSPRINT DD  SYSOUT=*           
//SYSIN    DD  *                 
  LISTCAT ENTRIES('your.dataset.name')
/*
Above step will generate return code 4 if 'your.dataset.name' is not cataloged.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”