ITEM: D8127L

How do I read a tape file of variable record lengths?




Question:

I have a variable block length tape created by a mainframe computer
that I am trying to read onto an AIX 3.2.4 computer.  It is a single
data file on the tape, but the record lengths are different.  If I use
the cbs flag with the dd command, the smaller records are padded with
NULL's, which is not desireable.  The maximum record length on the tape
is 3204 bytes.  The tape hardware is a 1/2" 9- track.  How do I read this
file without padding it with garbage?

RESPONSE:

The dd command does not have the capability to read data from various
record lengths (block sizes) from a tape and write them at that same block
size since most AIX devices use fixed block sizes. 

The only way that the dd command can read this file is with the cbs flag, 
which will pad the smaller records.  The alternative is to use the dd command to
read only one record at a time. This assumes that the user knows the size
of each record on the tape. 

In order to read the file off of the tape, a script must be written to:

1) Use the tctl command to read the record length at the beginning of each
     record (the 1st four bytes, according to the customer).  
2) Use the tctl command to rewind the tape to the beginning of the record
     (since step \#1 probably skipped the record).  
3) Use the dd command to read the correct number of bytes out of the
     record.  Use the bs=1 and count=\#bytes options.
4) Loop back to \#1 for each record on the tape.



Support Line: How do I read a tape file of variable record lengths? ITEM: D8127L
Dated: September 1993 Category: N/A
This HTML file was generated 99/06/24~13:30:55
Comments or suggestions? Contact us