How to identify in JCL that an input file is empty without
reading it?

Answers were Sorted based on User's Feedback



How to identify in JCL that an input file is empty without reading it?..

Answer / mainframeking

Usinf IDCAMS we can check:

//step01 dd exec pgm=idcams
//sysprint dd sysout=*
//input dd dsn=file name to check, disp=shr
//sysin dd *
print infile(input)character count(1)

if return code is 0, file is not empty
if return code is 4, file is empty

Is This Answer Correct ?    17 Yes 3 No

How to identify in JCL that an input file is empty without reading it?..

Answer / gajendra

We can also Fileaid for the same

Is This Answer Correct ?    4 Yes 2 No

How to identify in JCL that an input file is empty without reading it?..

Answer / sivakumar sekharannair

You can use IEBCOMPR
Used to compare two sequential data sets, two partitioned data sets or two PDSEs at the logical record level to verify a backup copy. Fixed, Variable, or undefined records from blocked or unblocked data sets or members can also be compared. However, you should not use IEBCOMPR to compare load modules.

Is This Answer Correct ?    1 Yes 0 No

How to identify in JCL that an input file is empty without reading it?..

Answer / jeeva225

//job331ab job notify=&sysuid
//step1 exec pgm=idcams
//sysprint dd sysout=*
//input dd dsn=job331ab.prasad.infile,disp=shr
//sysin dd*
print infile(input)count(1)
/*
if return code rc=00 then it is not empty file,
return code rc=04 then it is empty

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More JCL Interview Questions

What is the difference between specifying DISP=OLD and DISP=SHR for a dataset?

2 Answers  


i have 6 steps in my jcl program after going to 5th step i want to execute 3rd step.....how can i do it....by using(RESTART) can i do it or not?

2 Answers   Wipro,


what is d/f b/w sysout & sysprint

4 Answers   TCS,


what is use of dsn parameter in dd statement?

0 Answers   IBM,


Is there any command to check wether the ps file is in sorted order?

4 Answers  






a input file contains 1000 records, how to move the first 500 record into one out put file and how to move to second 500 records to anothere output file

6 Answers   ITC Infotech,


What do you understand by the term “keyword” with respect to jcl and what is the opposite of the term?

0 Answers  


I have a Symbolic Parameter which can have a value say 01 or 02 etc. Now consider i have another Symbolic parameters which is used to get 3 digit code of months (JAN, FEB, etc) but for that i need to check the first symbolic parameter's value and provide its corresponding month's name in the second symbolic parameter. Say IF sym1 = 01 then sym2='Jan' ENDIF etc... In JCL, IF condition is used for RC, ABEND purposes of a step etc. When i use Symbolic parameter in IF clause it is showing Error message. Is there a way to get the above result possible in JCL. If you could provide me with an example, i would understand it better.

0 Answers  


Suppose i have 2 steps in my pgm. Step1- creates a file, Step2 - generates report from file in step1, What changes have to be made in Step2, so that if the file in Step1 is empty Step2 should not be executed? No changes to be made to Step1.

4 Answers   TCS,


Why block size is multiple of lrecl in jcl?

0 Answers  


I have 3 duplicate records in a file . I want to eliminate 1st, 2nd and copy 3rd one only . HOW ?

3 Answers   CTS, DELL,


How do you override a parameter in Positional parameters?

4 Answers   Thomson Reuters,


Categories