View previous topic :: View next topic
|
Author |
Message |
anil_jdh
New User
Joined: 05 Apr 2006 Posts: 4
|
|
|
|
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 |
|
|
prav_06 Warnings : 1 Active User
Joined: 13 Dec 2005 Posts: 154 Location: The Netherlands
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
Or the AT END clause is taken on the first read. |
|
Back to top |
|
|
Pete Eagleton
New User
Joined: 14 Feb 2007 Posts: 11 Location: Chicago
|
|
|
|
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 |
|
|
Pete Eagleton
New User
Joined: 14 Feb 2007 Posts: 11 Location: Chicago
|
|
|
|
My previous reply assumes that you coded the 'FILE STATUS IS' clause on your SELECT. |
|
Back to top |
|
|
prav_06 Warnings : 1 Active User
Joined: 13 Dec 2005 Posts: 154 Location: The Netherlands
|
|
|
|
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 |
|
|
|