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
 

 

How to check in COBOL whether a file is empty or not

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
anil_jdh

New User


Joined: 05 Apr 2006
Posts: 4

PostPosted: Thu Feb 15, 2007 4:59 pm    Post subject: How to check in COBOL whether a file is empty or not
Reply with quote

Hi,

How to check in COBOL whether a file is empty or not i,e whether the file
contains records or not.
Back to top
View user's profile Send private message

prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Thu Feb 15, 2007 5:08 pm    Post subject:
Reply with quote

Hi,

Once u read the file for the first time check for the file-status, if the file status is 10, then the file is an empty file.


Cheer's,

Thamilzan.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


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

PostPosted: Thu Feb 15, 2007 6:31 pm    Post subject:
Reply with quote

Or the AT END clause is taken on the first read.
Back to top
View user's profile Send private message
Pete Eagleton

New User


Joined: 14 Feb 2007
Posts: 11
Location: Chicago

PostPosted: Thu Feb 15, 2007 10:30 pm    Post subject: Re: Reading an Empty file
Reply with quote

You can also test for a status code of 39. this indicates that the input file has a different LRECL then that specified in your FD telling you that the file is either empty of not the input file you expect.
Back to top
View user's profile Send private message
Pete Eagleton

New User


Joined: 14 Feb 2007
Posts: 11
Location: Chicago

PostPosted: Thu Feb 15, 2007 10:32 pm    Post subject: Re: Reading an Empty file
Reply with quote

My previous reply assumes that you coded the 'FILE STATUS IS' clause on your SELECT.
Back to top
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Fri Feb 16, 2007 10:57 am    Post subject:
Reply with quote

Pete,

Code:
You can also test for a status code of 39. this indicates that the input file has a different LRECL then that specified in your FD telling you that the file is[b] either empty[/b] of not the input file you expect.


File staus 39 does not tell whether the file is empty, but tells that the lrecl in the cobol pgm is mismatching with the lrecl in the JCL.


Cheer's,

Thamilzan.
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 0 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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm


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