1758136 Members
2847 Online
108868 Solutions
New Discussion юеВ

dd

 
Steve_3
Frequent Advisor

dd

I am trying to use dd to cut a tape for the IRS. They need block size of 6900 and record length of 275.

Using dd if=xxx of=xxx cbs=512 conv=unblock.

Each record comes out nicely on its own row but surpass the length of 275.

How do I chop off the rest of the record from 276 to the end of that record?
7 REPLIES 7
Rodney Hills
Honored Contributor

Re: dd

If you want fixed length records, then-

dd if=xxx of=xxx obs=6900 cbs=275 conv=block


-- Rod Hills

There be dragons...
A. Clay Stephenson
Acclaimed Contributor

Re: dd

I'm working from memory here but I am almost positive that they will except either a 275 or a 276 byte record. The preferred blocking factor is 25. There is no LF in these records.

In your case, I would do this:

dd if=xxx ibs=275 obs=6875 of=/dev/rmt/yyy
If it ain't broke, I can fix that.
Steve_3
Frequent Advisor

Re: dd

The result of that only return 1 record.

thanks,
steve
Rodney Hills
Honored Contributor

Re: dd

I did the following and it did the right thing-

$ cat >that
This
and
that
and
the
other
thing
^D
$ dd if=that of=this obs=128 cbs=6 conv=block
0+1 records in
0+1 records out
pegasus homeroot # od -c this
0000000 T h i s a n d t h a t
0000020 a n d t h e o t
0000040 h e r t h i n g

Notice each record is fixed length at 6 bytes.

Is your input data a unix text file or some cobol generated output file?

-- Rod Hills
There be dragons...
Rodney Hills
Honored Contributor

Re: dd

That last od output didn't look so good, here is an xd with the hex values.

0000000 5468 6973 2020 616e 6420 2020 7468 6174
T h i s a n d t h a t
0000010 2020 616e 6420 2020 7468 6520 2020 6f74
a n d t h e o t
0000020 6865 7220 7468 696e 6720
h e r t h i n g
000002a

-- Rod Hills
There be dragons...
Steve_3
Frequent Advisor

Re: dd

It is a text file generated from Oracle.

Thanks,
steve
Rodney Hills
Honored Contributor

Re: dd

The 1 record count is ok, since it is going to a fixed length record format. Did you run a dump on the resultant tape to see if it is formatted correctly?

If this tape is for the IRS, and needs to be fixed length records, then do you know if the data needs to be EBCDIC?

The text file generated by oracle, is it a true variable length ascii file seperated with ascii \012?

Does this need to be fixed length records, or just records with a max size of 275?

dd can handle conversion between different formats, so it's just a matter of determining the correct blocking factor, record type, and character code.

-- Rod Hills
There be dragons...