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: 962
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


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