Tuesday, December 29, 2009

LISTCAT command

To check if the PS file exists or not

You can check the existence of a file by LISTCAT cmd
//STEP005 EXEC PGM=IKJEFT01,DYNAMNBR=40,REGION=6144K
//ISPLOG DD DUMMY
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSTSIN DD *
LISTCAT ENTRIES ('File name')
/*
//COND01 IF STEP005.RC=0 THEN
****steps to be executed when the flat file exists****
// ENDIF
The JCL step STEP005 returns 0 if the file exists and 4 if not.

*******************************************************************
To check the availability of GDG versions

LISTCAT NONVSAM GDG LEVEL ('GDG base name')

No comments: