Showing posts with label JCL. Show all posts
Showing posts with label JCL. Show all posts

Friday, March 5, 2010

JCL to find if a dataset is empty

In your batch job, if there is a need to check for empty dataset, you can do it using IDCAMS.


//*-------------------------------------------------------------------*/
//* This JCL is to find if a file is empty or not. If there are no */
//* records, the return-code will be 4. */
//*-------------------------------------------------------------------*/
//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//IN1 DD DISP=SHR,DSN=your.dataset.name
//SYSIN DD *
PRINT INFILE(IN1) COUNT(001)
/*


If you have ICETOOL at your site, you can use that as well.

//*-------------------------------------------------------------------*/
//* This JCL is to find if a file is empty or not using ICETOOL. */
//* If there are no records, the return-code will be 12 */
//*-------------------------------------------------------------------*/
//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DISP=SHR,DSN=your.dataset.name
//TOOLIN DD *
COUNT FROM(IN) EMPTY
/*

Sunday, March 8, 2009

JCL - REGION Parameter

Coding REGION parameter on a JOB step is different from coding it on a EXEC step.

A JOB statement REGION parameter applies to all steps of the job and overrides any EXEC statement REGION parameters.

When no REGION parameter is on the JOB statement, the system uses an EXEC statement REGION parameter, but only during the job step. Code EXEC statement REGION parameters when you want to specify a different region size for each job step.