View previous topic :: View next topic |
Author |
Message |
begin0404 Beginner
Joined: 14 Jul 2004 Posts: 11 Topics: 4
|
Posted: Thu Aug 12, 2004 9:40 am Post subject: Rewrite problem with VB file |
|
|
Hi,
I am facing the problem when trying to REWRITE a VB record into the same file.My requirement is like this.
I am yhaving 2 files.Say A and B
A is a VB file and the file attributes are like below.
Organization . . . : PS
Record format . . . : VB
Record length . . . : 27994
Block size . . . . : 27998
B is a VSAM ksds file.
I need to read the file A and if the value in particular position(in my case it is 101) matches with the file B key values I need to modify the another field in position '121' in first file.
When I try am trying to use the Re write option,it is giving file status 44 error.
It seems I am having the problem in the FD section.Can any body explore on this with some example program?
Thanks |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Aug 12, 2004 10:30 am Post subject: |
|
|
begin0404,
When you are writting a variable block file you need to consider populating the length of the record. And it is advisable to read the record INTO a working storage variable.
ex:
Code: |
FD INPUT-FILE
RECORDING MODE IS V
RECORD IS VARYING IN SIZE FROM 10 TO 27994 CHARACTERS
DEPENDING ON WS-INPUT-LGTH.
01 INPUT-RECORD PIC X(27994 ).
WORKING-STORAGE SECTION.
01 WS-LGTH-REC.
05 WS-INPUT-LGTH PIC S9(09) COMP.
01 WS-RECORD PIC X(27994 ).
PROCEDURE DIVISION.
READ INPUT-FILE INTO WS-RECORD.
your processing logic will update the fields in ws-record
REWRITE OUTPUT-RECORD FROM WS-RECORD.
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
begin0404 Beginner
Joined: 14 Jul 2004 Posts: 11 Topics: 4
|
Posted: Thu Aug 12, 2004 2:13 pm Post subject: |
|
|
Hi Kolusu,
I am getting the file mismatch error when I use the FD entries as mentioned by you.
First I got compilation error for S sign in the WS-INPUT-LGTH.
So I removed it and used the PIC X(09) only.Then I compiled it and during running I got the error in file mismatch attributes.The error is
A file attribute mismatch was detected.File INPUT-FILE in program XXXXXX had a record length of 27998.and the file specified in the ASSIGN clause had a record length of 27994.
Then I incread the values to 27998 ,Both in the INPUT-RECORD and
RECORD VARYING CLAUSE INTO 27998,but now the same error came but it is showing the lengths as 28002 and 27994.
Any suggestion?
Thanks |
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Fri Aug 13, 2004 9:58 pm Post subject: |
|
|
Hi,
I think Kolusu might have been in error when he wrote "27994" in his example code. Try "27990".
Regards, Jack. |
|
Back to top |
|
|
|
|