How to check whether a sequential file (PS) or VSAM file is empty or not?

Sometimes we may face a requirement to check the file is empty or not, if it is empty stop the process other wise proceed with further steps using JCL. Here are some of the commonly used methods to check whether a Physical Sequential (PS) or VSAM File is empty or not.


By Using IDCAMS utility we can check whether the file is empty or not. If the return code is 4 (RC=4), then it is considered as empty.

Here is the JCL for this purpose


By using IDCAMS repro also empty check can be done.

If the return code is 4 (RC=4), then the file is empty.


By using ICETOOL

If the return code is Zero (RC=0) then file is not empty otherwise it is empty and return code would be 12 if it is empty .


Leave a Reply

Your email address will not be published. Required fields are marked *