Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Display a message for empty file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Display a message for empty file
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    Post subject:
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

Active Member


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

PostPosted: Mon May 19, 2008 6:53 pm    Post subject:
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    Post subject:
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    Post subject:
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.

http://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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us