Page 1 of 2

How to check an empty file in JCL

PostPosted: Fri Mar 16, 2012 6:23 pm
by madhavan
How to check an empty file in jCL?

Re: JCL

PostPosted: Fri Mar 16, 2012 6:46 pm
by enrico-sorichetti
don' t You think it would have been more intelligent to use a more descriptive title :?: :evil:

Re: JCL

PostPosted: Fri Mar 16, 2012 6:52 pm
by BillyBoyo
And to specify more exactly what you want to do? What type of dataset? How might it become empty? How is it created?

Re: JCL

PostPosted: Fri Mar 16, 2012 7:44 pm
by Robert Sample
Check it for what? As the others stated, your post lacks almost ALL information needed to answer your question. Data sets can be sequential, partitioned, indexed, direct, VSAM (ESDS, KSDS, RRDS, LDS), on disk or tape, and so forth.

Re: How to check an empty file in JCL

PostPosted: Fri Mar 16, 2012 10:42 pm
by Frank Yaeger
madhavan,

Depending on exactly what you want to do, the "Set RC of 12, 8 or 4 if file is empty, has more than n records, etc ​" Smart DFSORT Trick at:

http://www.ibm.com/support/docview.wss? ... g3T7000094

might have the answer you're looking for. If not, you'll need to do a much better job of describing what it is you want to do exactly.

Re: How to check an empty file in JCL

PostPosted: Sat Mar 17, 2012 2:56 pm
by madhavan
I want to check whether the input dataset is empty or not

Re: How to check an empty file in JCL

PostPosted: Sat Mar 17, 2012 4:23 pm
by BillyBoyo
Then try what Frank has suggested, it should, with or without amendments to the example, do what you want.

My worry is that you might mean one thing by "empty" and actually having a different situation. But, if you are unwilling to be accurate, you are now left to find that out for yourself. I hope that you and the system agree on terminology.

Re: How to check an empty file in JCL

PostPosted: Sun Mar 18, 2012 1:02 am
by steve-myers
JCL, by itself, cannot determine if a dataset is "empty." The term "empty" has several possible meanings.
  • A sequential dataset
    • Has no data. A program must open and read the dataset, and report 0 records.
    • Is on disk and has never been written to. A program must analyze the dataset label. Many times a program will open and then close the dataset, and the label will effectively report the dataset is "empty," but that is not a guarantee.
  • A PDS
    • Has no members. A program must analyze the directory, and report there are no members.
    • A PDS member has no data. A program must open the member and report it has no data, just like a sequential dataset.
  • Any other kind of dataset. Here "empty" is basically meaningless.
Do not ever forget that the purpose of JCL is to define an environment for a program.

Re: How to check an empty file in JCL

PostPosted: Tue Mar 20, 2012 10:37 am
by madhavan
Thanks

Re: How to check an empty file in JCL

PostPosted: Sat Apr 28, 2012 11:21 am
by pushkal2gud
U can use IDCAMS or ICETOOL for it and read the records in the file.