MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Rewrite problem with VB file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
begin0404
Beginner


Joined: 14 Jul 2004
Posts: 11
Topics: 4

PostPosted: Thu Aug 12, 2004 9:40 am    Post subject: Rewrite problem with VB file Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Aug 12, 2004 10:30 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
begin0404
Beginner


Joined: 14 Jul 2004
Posts: 11
Topics: 4

PostPosted: Thu Aug 12, 2004 2:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Fri Aug 13, 2004 9:58 pm    Post subject: Reply with quote

Hi,

I think Kolusu might have been in error when he wrote "27994" in his example code. Try "27990".

Regards, Jack.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group