Page 1 of 1

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

Posted: Mon Jun 19, 2023 11:41 am
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.

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

Posted: Mon Jul 03, 2023 11:37 pm
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.