IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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

Senior Member


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

PostPosted: Thu Feb 15, 2007 6:31 pm
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top