How to identify where file is empty or not? How many ways are
there to identifying?

Answers were Sorted based on User's Feedback



How to identify where file is empty or not? How many ways are there to identifying?..

Answer / bala

1) Use IDCAMS
SYSIN DD *
PRINT INDATASET(file name) COUNT(1)
gives RC 04 if the file is an empty file.

2)Compare the file with a known empty file using IEBCOMPR
utility. Comparing two empty files gives Nonzero RC

Is This Answer Correct ?    6 Yes 1 No

How to identify where file is empty or not? How many ways are there to identifying?..

Answer / swapnilkumar

There are two ways to check for the file empty or not.
1) With FILEAID
2) With IEBPTPCH

//STEPXX EXEC PGM=FILEAID
//DD01 DD DSN=P1.SEQUEN.INPUT.FILE,DISP=SHR
//DD01O DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD DUMMY
other is

//STEPXX EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=P1.SEQUEN.INPUT.FILE,DISP=SHR
//SYSUT2 DD DUMMY
//SYSIN DD DSN=SYS1.CTLLIB(P1CTL),DISP=SHR

where CTL card has
PRINT TYPORG=PS,CNTRL=1

The either of above step gets RC=04 then the file is empty
else if its zero then file has some data in it.

Is This Answer Correct ?    5 Yes 2 No

How to identify where file is empty or not? How many ways are there to identifying?..

Answer / fred

There are so many ways this can be done.

DFSORT/SYNCSORT
ICETOOL/SYNCTOOL
IDCAMS
FILEAID/FILEMANAGER
IEBPTPCH
ISRSUPC
EASYTRIEVE
Using REXX checking with EXECIO / LISTDSI



Using SORT is the easiest:

//jobcard

//S010 EXEC PGM=SORT,PARM='NULLOUT=RC4'
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=<datasetname>
//SORTOUT DD DUMMY
//SYSIN DD *
SORT FIELDS=COPY
/*


-- RC 4 if Empty
RC 0 if there is data.

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More JCL Interview Questions

Is CPU time (TIME parameter) assigned to a JOB and JOBSTEP BOTH, by default ?

6 Answers   IBM,


Hi, Say I have 10 flat files and I want to copy all these 10 flat files to a GDG versions flat files (I have GDG base: FDWS01.TEST.RESTORE) in one shot. Can we do that in one shot using a JCL. May be by using IEBGENER. It's a bit urgent. So anyone's fast rely would be appreciated.. Thanks in advance.. 10 flat files ----------------------------------- FDWS01.SUB.RESTORE1 FDWS01.SUB.RESTORE2 FDWS01.SUB.RESTORE3 ; ; FDWS01.SUB.RESTORE10 TO GDG versions ----------------------- FDWS01.TEST.RESTORE.G0001V00 FDWS01.TEST.RESTORE.G0002V00 FDWS01.TEST.RESTORE.G0003V00 ; ; FDWS01.TEST.RESTORE.G0010V00

2 Answers  


How do you check the syntax of a JCL without running it?

17 Answers  


I have a JCL with 10 steps, want to execute first 5 steps only, what are ways of doing it?is it possible to control through JOB card?

5 Answers   iGate,


How many types we can give input to JCL

5 Answers   UHG,






how can we override data definitions in jcl. can any one give detailed example

3 Answers   TCS,


in ways data can be passed to a COBOL program from JCL?

0 Answers  


How to send different PARM values based on the any condition to the program in a JCL? For example :- If the time is before 12:00 pm, I want to send "A" to some program and if it past 12:00 pm , I want to send "B" as a PARM value to that program. How to do it thur JCL only?

0 Answers   UHG,


What does the TIME parameter signify ? What does TIME=1440 mean ?

6 Answers   Accenture, TCS,


Explain how can a jobs execution priority be modified?

0 Answers  


What are the basic JCL Statements for a Job?

1 Answers  


How much space OS allocates when you create a PS or PDS?

4 Answers  


Categories