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


Pointer towards Record Descriptor Word(RDW) used in file.

Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message

New User

Joined: 28 Mar 2005
Posts: 7
Location: Bangalore

PostPosted: Mon Apr 25, 2005 6:59 pm    Post subject: Pointer towards Record Descriptor Word(RDW) used in file.
Reply with quote

Hi All

Please give me a pointer towards RDW used in Variable length record. I want to know the actual definition of RDW. It would be great if u could give me reference. Also i want to know the details about the processing of variable length record.

Thanking you in anticipation,.

Back to top
View user's profile Send private message


Super Moderator

Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Apr 26, 2005 6:06 am    Post subject:
Reply with quote

Hi Abinash,

It's difficult to find all the info needed to process variable files in COBOL. I put the following together to answer that need.

The usual caveats and copouts apply.

I've encountered two situations when attempting to process IBM's variable length records. Here's a description of the methods I use in each of those situations. This may also be valid for non-IBM environments.

1) Don't know the lengths of the recs in the file. (Use Method 1 below.)

2) Can identify each variable rec that you read by knowing the rec type field value of each rec. (Use Method 2.)

Method 1.

In your FD

 RECORD VARYING FROM 1 TO max len expected
               DEPENDING ON WS-REC-LEN

If you don't know the max len use 32K.

Define the FD 01 as:

01 IP-REC.
                   OCCURS FROM 1 TO nn DEPENDING ON WS-REC-LEN.

where, nn = max len expected used in VARYING stmt,
WS-REC-LEN is an unsigned numeric data item large enough to hold "max len expected".

When you read an IP rec, the length of the rec just read will appear in

If you decide to write the rec to an OP file it is your responsibility to populate that field with the appropriate length. If you decide to expand or reduce the size of the rec before you write it, you must first adjust the WS-REC-LEN field accordingly.

Method 2.

In the FD

 RECORD CONTAINS FROM 1 TO max len expected.

If you don't know the max len use 32K.

Define the FD 01 for as many types of recs as you have, e.g.:
(These could also be copybooks.)

01 IP-REC-1.
   05 REC-TYPE-1 PIC X.
   05 yada, yada, yada
01 IP-REC-2.
   05 REC-TYPE-2 PIC X.
   05 yada, yada, yada
01 yada, yada, yada

In the PD:

IF REC-TYPE-1 = '1'
   do stuff only using IP-REC-1 datanames
IF REC-TYPE-2 = '2'
   do stuff only using IP-REC-2 datanames

Note that you write the record, not the file.

Also, although I chose to make the rec type PIC X, it could be anything, so long as there is agreement that a given value will always reference a rec of a predetermined length and content.

If you need to update the file and create a new variable OP file
create an OP FD similar to that above. You can use the same copybook or you can create another rec description.

JCL Notes:

Variable recs are built by the access method in 2 parts: control data and user data.
The control data is composed of a 4 byte Block Descriptor Word (BDW) and a 4 byte Record Descriptor Word (RDW). In each the 1st 2 bytes contain a binary representation of the length.

So, when coding the LRECL and BLKSIZE add 4 or 8 bytes respectively to the longest area expected for your data.

Note that in the COBOL pgm you state the data area sizes only. The BDWs & RDWs are not considered in the pgm.

While I'm on the subject of data length, you can always specify a rec or block length LARGER than the ACTUAL largest rec/block in the file. Just make sure that the BLKSIZE is 4 bytes longer than the LRECL. The only downside is that you waste buffer space. This shouldn't present a hardship, but the technique is handy in those situations where you may not know the exact file attributes.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1


Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts File manager isuue ayerhs21 IBM Tools 4 Thu Oct 13, 2016 2:58 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts VSAM define for large file jerryte JCL & VSAM 9 Wed Oct 05, 2016 1:51 am
No new posts Obtaining file information pahiker COBOL Programming 25 Tue Sep 27, 2016 7:25 pm

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