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 Checking file is empty or not using COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: how to Checking file is empty or not using COBOL
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10457
Location: italy

PostPosted: Tue Feb 12, 2008 8:33 pm    Post subject: Reply to: how to Checking file is empty or not using COBOL
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    Post subject:
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

Moderator Team Head


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

PostPosted: Tue Feb 12, 2008 10:01 pm    Post subject: Reply to: how to Checking file is empty or not using COBOL
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    Post subject:
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    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 display offset thru cobol prog... tvinodkumar7 CICS 2 Sun Apr 22, 2018 8:42 pm
No new posts Linkage editor is part of COBOL, z/OS... ankit.jain COBOL Programming 4 Fri Apr 20, 2018 4:17 pm
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
No new posts IDCAMS RENAMING VSAM FILE ALONG WITH ... upendrasri JCL & VSAM 11 Tue Apr 17, 2018 10:42 pm
No new posts Call COBOL or PLI with a click from w... vaibhav gs All Other Mainframe Topics 1 Mon Apr 16, 2018 7:29 pm

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