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

Eliminating blanks after record is added


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Nirav721

New User


Joined: 11 Feb 2008
Posts: 53
Location: NJ

PostPosted: Fri Apr 09, 2010 4:50 am
Reply with quote

Hi,

I am having an issue rewriting a record to VSAM file from a variable block sequential file. My vsam file can have up to 5000 byte record.

Here is the scenario:
I am reading in a 800 byte record from variable block sequential file. Then, I read a vsam record with the key I need to replace (record will always be present). Then I overlay my vsam record area with my sequential file area for the length of the sequential record I just read in, and then perform rewrite. This works, but I end up with X'40' after 800 bytes... 801-5000 bytes contain X'40'.

Is there an option I am missing?

My VSAM def. is:

Code:
     SELECT INVSAM-FILE                     
********************************************
         ASSIGN TO INVSAM                   
         ORGANIZATION IS INDEXED           
         ACCESS MODE IS RANDOM             
         RECORD KEY IS ID-NO               
         FILE STATUS IS F-STAT, VSAM-STATUS.


Code:
FD INVSAM-FILE               
   DATA RECORD IS INVSAM-REC.


My sequential def. is:

Code:
FD INREC                                                     
   RECORDING MODE IS V                                       
   RECORD IS VARYING FROM 1 TO 4996 DEPENDING ON REC-LENGTH 
   BLOCK CONTAINS 0 RECORDS                                 
   LABEL RECORDS ARE STANDARD                               
   DATA RECORD IS INREC-REC.                                 
                                                             


My move statement is:

Code:
MOVE INREC-REC(1:REC-LENGTH) TO INVSAM-REC     
REWRITE INVSAM-REC                             


Any help would be great!

Thanks!
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Apr 09, 2010 5:11 am
Reply with quote

This is important, how are the 01 and lower levels of the FDs defined? For both input and output....
Please post them.
Back to top
View user's profile Send private message
Nirav721

New User


Joined: 11 Feb 2008
Posts: 53
Location: NJ

PostPosted: Fri Apr 09, 2010 5:20 am
Reply with quote

Thank you for looking into this...

Sequential file layout:

Code:
01 INREC-REC.                       
   05 INREC-KEY.                     
      10 VSAM-KEY         PIC X(8). 
      10 VSAM-INDEX       PIC X(6). 
   05 INREC-REST.                   
      10 REM-RECORD      PIC X(4982).
   05 INCMR-SEQ REDEFINES INREC-REST.
      10 FILLER          PIC X(49). 
      10 SEQ-KEY         PIC X(8).   
      10 FILLER          PIC X(4925).


INVSAM-REC def...


Code:
01  INVSAM-REC.                       
    05 ID-NO.                         
       10 KEY-recNO       PIC X(8).   
       10 KEY-INDEX       PIC X(6).   
    05 ID-K REDEFINES ID-NO.           
       10 KEY-K           PIC X(14).   
    05 ID-DISPLAY-KEY REDEFINES ID-NO.
       10  TERM-DIGIT     PIC X(4).   
       10  FRNT-DIGIT     PIC X(4).   
       10  FILLER         PIC X(6).   
    05 KEY-O              PIC X(4982).
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Apr 09, 2010 5:27 am
Reply with quote

Nirav721 wrote:
Code:
01 INREC-REC.                       
   05 INREC-KEY.                     
      10 VSAM-KEY         PIC X(8). 
      10 VSAM-INDEX       PIC X(6). 
   05 INREC-REST.                   
      10 REM-RECORD      PIC X(4982).
   05 INCMR-SEQ REDEFINES INREC-REST.
      10 FILLER          PIC X(49). 
      10 SEQ-KEY         PIC X(8).   
      10 FILLER          PIC X(4925).
Where is the 'variableness' of this?
Quote:
Code:
01  INVSAM-REC.                       
    05 ID-NO.                         
       10 KEY-recNO       PIC X(8).   
       10 KEY-INDEX       PIC X(6).   
    05 ID-K REDEFINES ID-NO.           
       10 KEY-K           PIC X(14).   
    05 ID-DISPLAY-KEY REDEFINES ID-NO.
       10  TERM-DIGIT     PIC X(4).   
       10  FRNT-DIGIT     PIC X(4).   
       10  FILLER         PIC X(6).   
    05 KEY-O              PIC X(4982).
And where is the 'variableness' of this?
How do you know what the actual length of the input is and how do you specify the length of the output?
Back to top
View user's profile Send private message
Nirav721

New User


Joined: 11 Feb 2008
Posts: 53
Location: NJ

PostPosted: Fri Apr 09, 2010 5:35 am
Reply with quote

Thanks...I was under the impression VSAM calcs length on its own based on input specified? For the sequential, it is based on FD definition - REC-LENGTH.... which is what I am using to move data into VSAM...

Doesn't VSAM use RDF (sorry, don't remember it exactly) and not the first four bytes??
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: Fri Apr 09, 2010 6:05 am
Reply with quote

Hello,

How about RDW (record Descriptor Word). There should be no rdw for a Fixed length file. . .

The short move to the long field causes the trailing spaces, but the re-write is the length of the vsam data.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Apr 09, 2010 6:40 am
Reply with quote

Nirav721 wrote:
Code:
FD INVSAM-FILE               
   DATA RECORD IS INVSAM-REC.
01  INVSAM-REC.                       
    05 ID-NO.                         
       10 KEY-recNO       PIC X(8).   
       10 KEY-INDEX       PIC X(6).   
    05 ID-K REDEFINES ID-NO.           
       10 KEY-K           PIC X(14).   
    05 ID-DISPLAY-KEY REDEFINES ID-NO.
       10  TERM-DIGIT     PIC X(4).   
       10  FRNT-DIGIT     PIC X(4).   
       10  FILLER         PIC X(6).   
    05 KEY-O              PIC X(4982).

My sequential def. is:
Code:
FD INREC                                                     
   RECORDING MODE IS V                                       
   RECORD IS VARYING FROM 1 TO 4996 DEPENDING ON REC-LENGTH 
   BLOCK CONTAINS 0 RECORDS                                 
   LABEL RECORDS ARE STANDARD                               
   DATA RECORD IS INREC-REC.
01 INREC-REC.                       
   05 INREC-KEY.                     
      10 VSAM-KEY         PIC X(8). 
      10 VSAM-INDEX       PIC X(6). 
   05 INREC-REST.                   
      10 REM-RECORD      PIC X(4982).
   05 INCMR-SEQ REDEFINES INREC-REST.
      10 FILLER          PIC X(49). 
      10 SEQ-KEY         PIC X(8).   
      10 FILLER          PIC X(4925).

My move statement is:
Code:
MOVE INREC-REC(1:REC-LENGTH) TO INVSAM-REC     
REWRITE INVSAM-REC                             
How about an additional 01 for the output?
Code:
FD INVSAM-FILE               
   RECORDING MODE IS V .
01  INVSAM-REC.                       
    05 ID-NO.                         
       10 KEY-recNO       PIC X(8).   
       10 KEY-INDEX       PIC X(6).   
    05 ID-K REDEFINES ID-NO.           
       10 KEY-K           PIC X(14).   
    05 ID-DISPLAY-KEY REDEFINES ID-NO.
       10  TERM-DIGIT     PIC X(4).   
       10  FRNT-DIGIT     PIC X(4).   
       10  FILLER         PIC X(6).   
    05 KEY-O              PIC X(4982).
01  INVSAM-VAR-REC PIC X OCCURS 1 TO 4996 DEPENDING ON REC-LENGTH.

Code:
(possiblely)
MOVE REC-LENGTH TO REC-LENGTH
(an old hold back....grin.....)
MOVE INREC-REC(1:REC-LENGTH) TO INVSAM-REC.       
or
MOVE INREC-REC(1:REC-LENGTH) TO INVSAM-VAR-REC.       
or
MOVE INREC-REC TO INVSAM-REC.       
or
MOVE INREC-REC TO INVSAM-VAR-REC.       
But this one is important....
REWRITE INVSAM-VAR-REC                             
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 09, 2010 6:46 am
Reply with quote

So your VSAM file FD has one 01 fixed with 5000 bytes. Your VSAM FD does not have RECORD VARYING. Therefore, your program is telling VSAM to write 5000 bytes each and every time. You can:

1. Use OCCURS DEPENDING ON in the 01 for the VSAM FD.
2. Use multiple 01's in the VSAM FD, one have 800 bytes and one having 5000 bytes (more could be used if needed), then REWRITE the appropriate 01 level.
3. Add RECORD VARYING to the VSAM FD and set that variable to the correct length before attempting to do the write.

But as your code is constituted, you are not writing a variable length record -- you are writing a fixed length 5000 byte record.
Back to top
View user's profile Send private message
Nirav721

New User


Joined: 11 Feb 2008
Posts: 53
Location: NJ

PostPosted: Fri Apr 09, 2010 7:45 am
Reply with quote

Thank you everyone for your support. Using 'depending on' and adding one more '01' level to FD, I was able to get what I want!

Much appreciated! As you can probably tell..I am fairly new to cobol vsam programming world and sorry if it made anyone think 'what a wash this guy is!' :-)
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: Fri Apr 09, 2010 8:17 am
Reply with quote

You're welcome icon_smile.gif

Quote:
sorry if it made anyone think 'what a wash this guy is!'
Not to worry icon_cool.gif

Good to hear your question is answered - thanks for letting us know.

When there are other "opportunities", someone will be here,

d
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top