Variable Length Blocked File 
Author Message
 Variable Length Blocked File

I picked up the following from alt.cobol in a dejanews search:

Quote:

>  Each block of a variable blocked  file contains both a BDW (block

descriptor word) and an RDW (record descriptor word). The
Quote:
>  block looks something like:
>                    ------------------------------------------------
>                   |  BDW |  RDW |  data  | RDW | data    |  ..... |
>                  ------------------------------------------------

>                 COBOL does not have direct access to the RDW's nor the

BDW's.  These fields are controlled by the operating system.

Don't ask me why, but I need to do this.  I need to write a C program
that will read a blocked file with variable length records that has been
ftp'd from an IBM mainframe.  To accomplish this, I need a complete
description of what the file format will look like.  For instance, what
values will the BDW and RDWs contain?  (Looks to me like the length of a
block and the length of a record).  Are there any other "hidden" words
that will be interspersed?

Can anyone point me to the documentation that will describe this?

We don't have any problems reading fixed length files.

---------------------------
Greg Leman
President
Metagenix, Inc.
1800 W. Martin Luther King Pkwy
Suite 101
Durham, NC 27707
http://www.*-*-*.com/
Data migration, data profiling, Cobol, extract, transformation, and load
tools tightly integrated with DataStage.



Sun, 11 Nov 2001 03:00:00 GMT  
 Variable Length Blocked File

Quote:

>I picked up the following from alt.cobol in a dejanews search:
>>  Each block of a variable blocked  file contains both a BDW (block
>descriptor word) and an RDW (record descriptor word). The
>>  block looks something like:
>>                    ------------------------------------------------
>>                   |  BDW |  RDW |  data  | RDW | data    |  ..... |
>>                  ------------------------------------------------

>>                 COBOL does not have direct access to the RDW's nor the
>BDW's.  These fields are controlled by the operating system.

>Don't ask me why, but I need to do this.  I need to write a C program
>that will read a blocked file with variable length records that has been
>ftp'd from an IBM mainframe.  To accomplish this, I need a complete
>description of what the file format will look like.  For instance, what
>values will the BDW and RDWs contain?  (Looks to me like the length of a
>block and the length of a record).  Are there any other "hidden" words
>that will be interspersed?

>Can anyone point me to the documentation that will describe this?

The Block Descriptor Word and Record Descriptor Word contain 4 bytes each.
The first two bytes contain (binary) the length of the block or record and
the last two contain binary zeros.  Read 4 bytes into an unsigned char array
and
blocklength = 256 * achar[0] + achar[1];

The block or record length includes the length of the BDW's and RDW's so
subtract 4 before doing your fread(); for data.

HTH
Warren Porter -- Remove numbers to reply.



Sun, 11 Nov 2001 03:00:00 GMT  
 Variable Length Blocked File
Greg, you've pretty much got it.  You can get the exact info from IBM's
manual on Data Services (IDCAMS) or from numerous Mainframe manuals.

But yes, a VB file has Blocked Variable length records.
Record of n bytes
prefix by a 4 byte BINARY(power of 2's) length (of record - not counting
RBW)
prefix by the TOTAL number of Bytes in a 4 byte RDW not counting RDW

so 100 byte record + 110 + 50
4ByteBDW=272+4ByteRBW=100(100Bytes)+4ByteRBW=110(110Bytes)+4ByteRBW=50
(50Bytes)

Because the system reads a physical record  (or multiples)
checks 4byte BDW for number of Bytes to transfer to File Buffer
gets next 4 bytes to see how many bytes to put in record Buffer(1)
  moves that many bytes
gets next 4 bytes to see how many bytes to put in record Buffer(2)
  moves that many bytes
repeats till block empty

Quote:

>I picked up the following from alt.cobol in a dejanews search:


>>  Each block of a variable blocked  file contains both a BDW (block
>descriptor word) and an RDW (record descriptor word). The
>>  block looks something like:
>>                    ------------------------------------------------
>>                   |  BDW |  RDW |  data  | RDW | data    |  ..... |
>>                  ------------------------------------------------

>>                 COBOL does not have direct access to the RDW's nor the
>BDW's.  These fields are controlled by the operating system.

>Don't ask me why, but I need to do this.  I need to write a C program
>that will read a blocked file with variable length records that has been
>ftp'd from an IBM mainframe.  To accomplish this, I need a complete
>description of what the file format will look like.  For instance, what
>values will the BDW and RDWs contain?  (Looks to me like the length of a
>block and the length of a record).  Are there any other "hidden" words
>that will be interspersed?

>Can anyone point me to the documentation that will describe this?

>We don't have any problems reading fixed length files.

>---------------------------
>Greg Leman
>President
>Metagenix, Inc.
>1800 W. Martin Luther King Pkwy
>Suite 101
>Durham, NC 27707
>http://www.metagenix.com
>Data migration, data profiling, Cobol, extract, transformation, and load
>tools tightly integrated with DataStage.



Mon, 12 Nov 2001 03:00:00 GMT  
 Variable Length Blocked File

Quote:

> Don't ask me why, but I need to do this.  I need to write a C program
> that will read a blocked file with variable length records that has been
> ftp'd from an IBM mainframe.  To accomplish this, I need a complete
> description of what the file format will look like.  For instance, what
> values will the BDW and RDWs contain?  (Looks to me like the length of a
> block and the length of a record).  Are there any other "hidden" words
> that will be interspersed?

> Can anyone point me to the documentation that will describe this?

> We don't have any problems reading fixed length files.

Greg,

The FTP from the mainframe automatically strips the RDW from the
records so you do not even see them (implicitly the BDW as well).
In order to get the RDW you must set a special option on the FTP
to get them (sorry RTFM).  Once you do get them I am reasonably
sure that you will not see the BDW at all.

I worked somewhere that did something similar to AFP files
(advanced function print).  The records (without RDW) contained
the length just after the start code so we did not need the RDW at
all.  Look for something similar and ignore the RDW if you can.

If you need the RDW (checking that the BDW gets lost) there will
be no interspersed filler.

Good luck
Ken



Mon, 12 Nov 2001 03:00:00 GMT  
 Variable Length Blocked File
If the file has been ftp'd, you should now have ASCII records separed by
CR+LF.
If the ftp kept BDW and RDW and the target system is not EBCDIC, you will
have strange values in BDW and RDW.

In any case these are the IBM variable files format:
BDW: 4 bytes - XXYY - where XX = binary block length (BDW included)
                                                  YY = used by the system
(LOW-VALUE)
RDW: 4 bytes - XXYY - where XX = binary record length (RDW included)
                                                  YY = used by the system
(LOW-VALUE)
DATA:

Then if you write 100 bytes of data, your RDW contains 104 and your BDW
contains at least 108.

Quote:

> I picked up the following from alt.cobol in a dejanews search:


> >  Each block of a variable blocked  file contains both a BDW (block
> descriptor word) and an RDW (record descriptor word). The
> >  block looks something like:
> >                    ------------------------------------------------
> >                   |  BDW |  RDW |  data  | RDW | data    |  ..... |
> >                  ------------------------------------------------

> >                 COBOL does not have direct access to the RDW's nor the
> BDW's.  These fields are controlled by the operating system.

> Don't ask me why, but I need to do this.  I need to write a C program
> that will read a blocked file with variable length records that has been
> ftp'd from an IBM mainframe.  To accomplish this, I need a complete
> description of what the file format will look like.  For instance, what
> values will the BDW and RDWs contain?  (Looks to me like the length of a
> block and the length of a record).  Are there any other "hidden" words
> that will be interspersed?

> Can anyone point me to the documentation that will describe this?

> We don't have any problems reading fixed length files.

> ---------------------------
> Greg Leman
> President
> Metagenix, Inc.
> 1800 W. Martin Luther King Pkwy
> Suite 101
> Durham, NC 27707
> http://www.metagenix.com
> Data migration, data profiling, Cobol, extract, transformation, and load
> tools tightly integrated with DataStage.



Mon, 12 Nov 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Processing variable length/variable data files

2. Getting true length of a variable length record - IBM Mainframe

3. Finding Variable-Length Record Length

4. Problem when formating a variable delimited file to fixed length

5. processing variable length records in text file

6. Import dos file variable record length

7. Reading variable-length records from a file

8. Variable length file access

9. How to access files with variable length records?

10. How to access files with variable length records?

11. Variable Length Files- Fujitsu 5.0

12. Sorting a file with variable length records.

 

 
Powered by phpBB® Forum Software