Rewrite VSAM in Cobol



Help for IBM's record-oriented filesystem VSAM, ESDS, KSDS, RRDS, LDS and Storage management Subsystems

Rewrite VSAM in Cobol

Postby sallyroselle » Wed Nov 09, 2011 9:14 pm

I am currently trying to rewrite a VSAM record in cobol. The record that I am replacing the original with is a different length, but is much shorter than the maximum length allowed to the variable length VSAM. I keep getting a VSAM file status of 44, meaning

A boundary violation exists because an attempt was made to rewrite a record to a file and the record was not the same size as the record being replaced, or an attempt was made to write or rewrite a record that was larger than the largest or smaller than the smallest record allowed by the RECORD IS VARYING clause of the associated file-name.

Do I have one of my definitions set up incorrectly? How can I rewrite this record without deleting the first one and writing a whole new one? Thanks!
sallyroselle
 
Posts: 12
Joined: Wed Nov 09, 2011 9:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Rewrite VSAM in Cobol

 

Re: Rewrite VSAM in Cobol

Postby NicC » Wed Nov 09, 2011 9:22 pm

You cannot unless the record length stays the same - it has to fit into the same space that the original record was in.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Rewrite VSAM in Cobol

Postby sallyroselle » Wed Nov 09, 2011 9:32 pm

I was thinking the same thing, but on the IBM site located here

http://publib.boulder.ibm.com/infocente ... pvsm18.htm

I found

Replacing records in a VSAM file

'For indexed files or variable-length relative files, you can change the length of the record you replace.'

are they referring to something else?

Thanks for your help!
sallyroselle
 
Posts: 12
Joined: Wed Nov 09, 2011 9:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Rewrite VSAM in Cobol

Postby BillyBoyo » Wed Nov 09, 2011 9:46 pm

Can you show your select/fd the message number and any other messages and a listcat of the dataset?

Are you reading the record before attempting to update it? If so, how are you reading it?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Rewrite VSAM in Cobol

Postby sallyroselle » Wed Nov 09, 2011 9:59 pm

FILE-CONTROL.                                               
    SELECT REQ-FILE ASSIGN TO EDVRTRQH                       
                    ORGANIZATION IS INDEXED                 
                    ACCESS       IS RANDOM                   
                    RECORD KEY   IS REQ-RECORD-KEY           
                    FILE STATUS  IS VSAM-FILE-STATUS-IND     
                                    VC-VSAM-CODE.           
                                                             
DATA DIVISION.                                               
                                                             
FILE SECTION.                                               
                                                             
FD  REQ-FILE                                                 
    BLOCK CONTAINS 0 CHARACTERS                             
    DATA RECORD IS REQ-FILE-RECORD.                         



I am reading it before I update it using with a straight read. I'm opening it with an open I-O.

I'm force dumping it after getting a 44 VSAM file status code.
sallyroselle
 
Posts: 12
Joined: Wed Nov 09, 2011 9:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Rewrite VSAM in Cobol

Postby Robert Sample » Wed Nov 09, 2011 10:24 pm

Does REQ-FILE-RECORD have an OCCURS DEPENDING ON in it? As someone asked, what does the LISTCAT look like for the VSAM file?
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: Rewrite VSAM in Cobol

Postby BillyBoyo » Wed Nov 09, 2011 10:39 pm

You say you have a new length record, but you need to show how you are doing that. Is it with ODO? If so, is your new record longer than the maximum on the DEPENDING ON field? Did you get any error message in the JES output for the job?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Rewrite VSAM in Cobol

Postby sallyroselle » Wed Nov 09, 2011 11:04 pm

01  REQ-FILE-RECORD.                                           
    03  REQ-RECORD-KEY.                                         
        05  RRK-ELEMENT               PIC X(6).                 
        05  RRK-RELEASE-DATE          PIC X(8).                 
        05  RRK-VERSION               PIC X.                   
    03  FILLER                        PIC X                     
        OCCURS 1 TO 1621 TIMES DEPENDING ON REQ-RECORD-LENGTH. 



When this record was first created, it ws 90 characters. I'm now expanding a message and it's trying to write 120 characters.
sallyroselle
 
Posts: 12
Joined: Wed Nov 09, 2011 9:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Rewrite VSAM in Cobol

Postby sallyroselle » Wed Nov 09, 2011 11:06 pm

It looks like the record length is getting set by the record that I read- is this the longest it could be? Maybe I should change how the record length is being set... (use the longer of the read record and the one I am trying to update it with)
sallyroselle
 
Posts: 12
Joined: Wed Nov 09, 2011 9:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Rewrite VSAM in Cobol

Postby BillyBoyo » Wed Nov 09, 2011 11:29 pm

Where are you getting REQ-RECORD-LENGTH?

EDIT: The reference you point to in the manual states that you can do it, and it is for the sort of thing you are trying to do. The message for your 44 is a little unclear. It first says you can't do it, which you can't for an ESDS, and then "an attempt was made to write or rewrite a record that was larger than the largest or smaller than the smallest record allowed by the RECORD IS VARYING clause of the associated file-name." You don't have RECORD IS VARYING. There is nothing I can find for any "default" value without that, so maybe you could try to include that? I don't know if it should help, because with the ODO Cobol should already know the records can vary. I don't imagine that your VSAM definition is the problem, even though we haven't seen it yet, because you are way away from the maximum. Are you definitely sure you have 120 when you do the re-write, not some ludicrous low or high count in there?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Next

Return to VSAM/SMS

 


  • Related topics
    Replies
    Views
    Last post