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

Readng and rewriting into a VB file.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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: 1436
Location: Bangalore,India

PostPosted: Mon Jul 02, 2007 6:46 pm
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: 1436
Location: Bangalore,India

PostPosted: Mon Jul 02, 2007 6:49 pm
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
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
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
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

Moderator Emeritus


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

PostPosted: Wed Jul 04, 2007 11:17 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top