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

how to Checking file is empty or not using COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue Feb 12, 2008 8:22 pm
Reply with quote

Hi All

I need to check whether the file is empty or not

I have 2 files called File-1 and File-2 having record length of 81

In step1 - File-1 will be appended with the character 'K' at the 82 position

In Step2- File-2 will be appended with the character 'T' at the 82 position

In Step3 - Both the File-1 and File-2 merged using same DD name

For example : DDname DD DSN=File1,Disp=shr
DD DSN=File2,Disp=shr

Now my criteria is to check wether the file is empty or not

1) how to check if the both the files(o/p file from 3rd step i.emerged file) are empty.

2) How to check if FILE-1 is empty

3) how to check if File-2 is empty

Please let me know if you need more information
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Feb 12, 2008 8:33 pm
Reply with quote

EXECIO 1 DISKR ddname ( STEM REC. FINIS

if rec.0 = 0 then .... the dataset was empty..

But You have to be sure that the dataset has been written to
even if only to write the EOF
Back to top
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Tue Feb 12, 2008 8:52 pm
Reply with quote

hi enrico

could you please explain it (EXECIO 1 DISKR ddname ( STEM REC. FINIS)

i am not familiar with this.

I need it using cobol.

Thanks for reply
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Feb 12, 2008 10:01 pm
Reply with quote

I think this same topic was just discussed here.
Back to top
View user's profile Send private message
venktv

New User


Joined: 29 Mar 2006
Posts: 59
Location: Montreal

PostPosted: Thu Feb 14, 2008 12:26 pm
Reply with quote

Hi..

Read the file once in your COBOL prog, and check condition AT END, if the file is empty the condition will satisfied at first read, and u can take the appropriate decision.

READ file-name INTO rec-name
AT END imperative stat.


Thanks
Venkat
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top