View previous topic :: View next topic
|
Author |
Message |
rambabu Currently Banned New User
Joined: 18 Apr 2005 Posts: 67
|
|
|
|
can any body tell me
what is the diff bettwen fixedlength record and variable length record?which one is best ? what is the uses? in the variable length record 4 bytes it will take length where it will be stored? |
|
Back to top |
|
|
vishal_a
New User
Joined: 24 May 2005 Posts: 45 Location: Noida
|
|
|
|
Hi rambabu
Fixed length record and variable length records are the two terminology of VSAM files . The KSDS facility contains both fixed length as well as Variable length records . But going a little deeper RDF contains Variable records of 3 bytes each whereas the variable length recods contains 4 bytes each.
thanks regards |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi rambabu,
Vishal is correct when he says that VSAM recs can be V and F, but flat file recs can also be V and F.
V recs require a 4 byte RDW (Record Descriptor Word) at the beginning of each V rec; F recs do not. V and F recs can be blocked (with 1 or more recs to a block). In this case V recs require a BDW at the beginning of each block; F recs do not.
When V recs are processed by a COBOL pgm the RDW and/or the BDW are not read into the COBOL pgm and only the data portion of the rec(s) should be described (and counted as the rec len) in the pgm.
In the JCL the max LRECL s/b 4 bytes larger than the largest rec expected and the BLKSIZE s/b 4 bytes larger than the block size desired. When determining the BLKSIZE the 4 byte RDW for each contained rec s/b considered.
Here's what a VB block of data might look like:
|BDW|RDW|....data....|RDW|...........data...........|RDW|..data..|
The "|"s, of course, are not part of the rec. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Forgot the other part of your ques.
Example:
Suppose you have to report on customer orders. Customers will have a variable # per period, so you might elect to put the order info for each cust into a table and each order for a cust will occupy an entry in their table.
But cust #1 may have 5 orders; cust#2, 15; cust#3, 9; etc. This results in variable length recs.
You could handle this w/fixed length recs, but you'll waste a lot of file space.
You could also say, can't I use a separate rec for each order? But now you must perform an I/O for each order, rather than 1 for each cust. That may be even more expensive. |
|
Back to top |
|
|
|