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
 

 

Readng and rewriting into a VB file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sreejith2612

New User


Joined: 25 Jun 2007
Posts: 8
Location: India

PostPosted: Mon Jul 02, 2007 6:07 pm    Post subject: Readng and rewriting into a VB file.
Reply with quote

I have a VB file of LRECL=32756 and Blocksize=32760, which is to be read and re-written using a COBOL program.

I gave the file details as follows in the pgm:-

FD filename
BLOCK CONTAINS 0 RECORDS
RECORD IS VARYING IN SIZE FROM 1 TO 32752
RECORDING MODE IS V
DATA RECORD IS recname.
COPY cpybk.

"cpybk" is the Copybook having "recname" as the record of total length = 32752. I gave this as 1st 4 places in a VB file isn't to be considered.
But i am getting an Abend 'S002 R=00000004'.
Also when i tried out with diff. lengths in the 'VARYING IN SIZE' line (like 32760,32756), i got a Mismatch error.

Could anyone help me out with this?
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Jul 02, 2007 6:40 pm    Post subject:
Reply with quote

1. You need to add a record contains nnn to nnn characters depending on ws-variable clause to your FD.
2. Who told you that you can rewrite a sequential file?
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Jul 02, 2007 6:46 pm    Post subject:
Reply with quote

Craq Giegerich,

Quote:
Who told you that you can rewrite a sequential file?


Re-verify please.


sreejith,
Remove blocksize and let system decide the optimum figure.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Jul 02, 2007 6:49 pm    Post subject:
Reply with quote

sreejith,

Taken from QW for 'S002 R=00000004'. Could be one of the reason.


Quote:
o The BDW contained a length greater than the blocksize
specified in the data control block (DCB).
Back to top
View user's profile Send private message
sreejith2612

New User


Joined: 25 Jun 2007
Posts: 8
Location: India

PostPosted: Mon Jul 02, 2007 6:56 pm    Post subject:
Reply with quote

murmohk1 wrote:
Craq Giegerich,

Quote:
Who told you that you can rewrite a sequential file?


Re-verify please.


sreejith,
Remove blocksize and let system decide the optimum figure.




Hi,
The file is already existing and I have no option other than to use it as it is. Also, its an IMS DB unload file with numerous records of which i have to edit a few based on conditions and further use the same file in other jobs. Hence the need for Rewrite.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Jul 02, 2007 8:07 pm    Post subject:
Reply with quote

What you want to do and what you can do are often not the same.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Jul 04, 2007 9:23 pm    Post subject:
Reply with quote

Hi sreejith,

You have 2 choices:

1) If you're using seq disk files you can modify each record and REWRITE it back to the same physical file. I checked the COBOL manual and didn't see any prohibition against using REWRITE with variable length files.

2) With either tape or disk files you can modify each record and recreate the file to another file and rename it later.

If you plan on changing the length of any of the original recs you can only use option 2.

In either case you must use the "depending on" technique suggested by Craq, unless you're using multiple record definitions in your FD.

If you plan to change the length of any of the existing recs you must keep track of the new length and move it to the depending on field before the WRITE.
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: Wed Jul 04, 2007 11:17 pm    Post subject:
Reply with quote

Hello,

If you are changing values in a file created by an unload, i'd suggest creating a new file for continued use and keeping the original in case there are ever questonis about the unloaded content.

For whatever reason, it may become important that what was actually unloaded can be verified.
Back to top
View user's profile Send private message
sreejith2612

New User


Joined: 25 Jun 2007
Posts: 8
Location: India

PostPosted: Thu Jul 05, 2007 10:35 am    Post subject: Re: Readng and rewriting into a VB file.
Reply with quote

Hi All,

Thank you very much.. The program ran successfully once I included the "DEPENDING ON" clause...

Thanks,
Sreejith.
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 1 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