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

COBOL FILE HANDLING


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
azar.mhd

New User


Joined: 22 Feb 2010
Posts: 14
Location: Hyderabad

PostPosted: Mon Mar 01, 2010 8:58 pm
Reply with quote

Hi ALL,

Can any one tell me about REWRITE comd in file handling. Please check my following requirement.

file1 , file2 and file3. All are sequential files.

I tried to open the files in input-output, output and input mode respectively.

I have read the records from file1 into file2 and written to file2. Then after i tried to read the file3 and written to the file1 using WRITE command. There am getting abend error when i tried to run it.

So can i use rewrite in this scenario...

And one more thing that ..

if i want to use rewrite command on a particular file, is that mandatory to open that file in i-o mode.

Thanks
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Mar 01, 2010 9:09 pm
Reply with quote

Review the student sample programs -

www.ibmmainframes.com/programs.php

Bill
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Mon Mar 01, 2010 9:15 pm
Reply with quote

You could start with Coding input and output statements for QSAM files in the Programming Guide...
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Mon Mar 01, 2010 9:18 pm
Reply with quote

This stuff can be found in the COBOL reference manuals:

Table 45. Permissible statements for sequential files

Code:

________________________________________________________
|Statement |Input open|Output open|I-O open|Extend open|
|          |      mode|       mode|    mode|       mode|
|__________|__________|___________|________|___________|
|READ      |X         |           |X       |           |
|__________|__________|___________|________|___________|
|WRITE     |          |X          |        |X          |
|__________|__________|___________|________|___________|
|REWRITE   |          |           |X       |           |
|__________|__________|___________|________|___________|
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Mar 01, 2010 9:51 pm
Reply with quote

Hello,

Note: The data to be rewritten must be the same lentgh as the data read. . .

None of the sites i've ever supported permits REWRITE on any sequential files . . . Typically, there is a requirement that the file be "copied" with the changes applied (often requiring audit informaton about what was changed).
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 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
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
Search our Forums:

Back to Top