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
 

 

COBOL FILE HANDLING

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: COBOL FILE HANDLING
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Mar 01, 2010 9:09 pm    Post subject: Reply to: COBOL FILE HANDLING
Reply with quote

Review the student sample programs -

http://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: 2150
Location: At my coffee table

PostPosted: Mon Mar 01, 2010 9:15 pm    Post subject:
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

Moderator Team Head


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

PostPosted: Mon Mar 01, 2010 9:18 pm    Post subject: Reply to: COBOL FILE HANDLING
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

Site Director


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

PostPosted: Mon Mar 01, 2010 9:51 pm    Post subject:
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    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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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