IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Display a message for empty file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rameshvaamshy
Currently Banned

New User


Joined: 19 Aug 2007
Posts: 14
Location: bangalore

PostPosted: Mon May 19, 2008 6:36 pm
Reply with quote

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
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Mon May 19, 2008 6:42 pm
Reply with quote

Have a counter after every read . Validate this counter to check if the file is empty or not.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Mon May 19, 2008 6:53 pm
Reply with quote

Doesn't seem to hard for even a beginner programmer - is there something else going on you did not mention?
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Tue May 20, 2008 10:10 am
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue May 20, 2008 11:43 pm
Reply with quote

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
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Wed May 21, 2008 6:18 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top