Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 10274
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: 4649
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 Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us