Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 973
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 How to convert 2 bytes into single by... pkmurali DB2 4 Fri May 25, 2018 1:41 pm
No new posts BAMAD file IO Error m1985nehal CICS 1 Fri May 25, 2018 11:51 am
No new posts SYSADATA - COBOL - Structure displace... ganasrinivasan COBOL Programming 3 Thu May 24, 2018 9:45 pm
No new posts Process file after 7 days of hold charlessxavier All Other Mainframe Topics 4 Tue May 22, 2018 3:54 pm
No new posts TRAILER3 is creating blank record in ... kodeesm DFSORT/ICETOOL 3 Fri May 18, 2018 5:45 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us