Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Eliminating blanks after record is added

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Eliminating blanks after record is added
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: 2150
Location: At my coffee table

PostPosted: Fri Apr 09, 2010 5:11 am    Post subject:
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    Post subject: Reply to: Eliminating blanks after record is added
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: 2150
Location: At my coffee table

PostPosted: Fri Apr 09, 2010 5:27 am    Post subject: Re: Reply to: Eliminating blanks after record is added
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    Post subject: Reply to: Eliminating blanks after record is added
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Apr 09, 2010 6:05 am    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Fri Apr 09, 2010 6:40 am    Post subject: Re: Eliminating blanks after record is added
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: 7913
Location: Bellevue, IA

PostPosted: Fri Apr 09, 2010 6:46 am    Post subject:
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    Post subject: Reply to: Eliminating blanks after record is added
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Apr 09, 2010 8:17 am    Post subject: Reply to: Eliminating blanks after record is added
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us