View previous topic :: View next topic
|
Author |
Message |
sreejith2612
New User
Joined: 25 Jun 2007 Posts: 8 Location: India
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
sreejith2612
New User
Joined: 25 Jun 2007 Posts: 8 Location: India
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
What you want to do and what you can do are often not the same. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
sreejith2612
New User
Joined: 25 Jun 2007 Posts: 8 Location: India
|
|
|
|
Hi All,
Thank you very much.. The program ran successfully once I included the "DEPENDING ON" clause...
Thanks,
Sreejith. |
|
Back to top |
|
|
|