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: 962
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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