View previous topic :: View next topic
|
Author |
Message |
rameshvaamshy Currently Banned New User
Joined: 19 Aug 2007 Posts: 14 Location: bangalore
|
|
|
|
I get a file from the client on daily basis which contains the details of employees working in an organization. on Saturday no employee was worked hence i got an empty file.by reading this file i have to display a message that no 'employee worked'. Please suggest me how can do it . |
|
Back to top |
|
|
Manuneedhi K
Active User
Joined: 07 May 2008 Posts: 115 Location: Chennai
|
|
|
|
Have a counter after every read . Validate this counter to check if the file is empty or not. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
Doesn't seem to hard for even a beginner programmer - is there something else going on you did not mention? |
|
Back to top |
|
|
the_gautam
Active User
Joined: 05 Jun 2005 Posts: 165 Location: Bangalore
|
|
|
|
another way to check the file to be having records or not is to OPEN the file in I/O mode. If its empty, it will come up with a FileStatus of 35. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
The link below explores the 2 types of "empty" files that can be encountered.
The 1st can be detected by Gautam's approach. (But note that other conditions can return a file status 35 (e.g. missing/misspelled DD, I think).
The 2nd is detected by an EOF condition encountered at the 1st read of the file.
www.ibmmainframes.com/viewtopic.php?t=8869&highlight=empty+file |
|
Back to top |
|
|
the_gautam
Active User
Joined: 05 Jun 2005 Posts: 165 Location: Bangalore
|
|
|
|
you may check this in JCL also by using the PRINT command. you will get a return code of 4 if the file is empty.
put this logic in a step prior to the step of your program executing step and execute the second step according to the return code of the first step. |
|
Back to top |
|
|
|