reblock (infiles, outfiles, file_list)
REBLOCK is a procedure to copy disk or tape resident files to disk or tape. Multiple tape files or a single disk input file may be specified. If multiple files are output to disk the output file names will be generated by concatenating the tape file number onto the output file name. The user may request magnetic tape output to begin at a specific file on tape, e.g. mta1600[5] in which case file five will be overwritten if it exists, or at BOT or EOT. If no file number is specified REBLOCK asks whether the tape is new or old and begin writing at BOT or EOT as appropriate.
Before beginning the copy, the user may request reblock to skip n (default 0) blocks (tape input) or logical records (disk input). The user can also specify that only n (default all) blocks (tape input) or records (disk input) are to be copied. Before the copy the data may be optionally word-swapped (default no) and/or byte-swapped (default no). If verbose is specified (default yes) reblock prints the input and output file names, the number of blocks read and written and the number of records read and written.
Reblock uses the default buffer sizes supplied by mtio and file i/o to determine the maximum number of bytes which can be read in a single read call. For tapes this corresponds to the maximum number of bytes per block permitted by the device. Mtio will not read more than one block per read call. Therefore the actual number of bytes read will be less than or equal to the mtio buffer size. For disk files the default buffer size set by IRAF is a multiple of the disk block size. If the disk file is smaller than one block or the last block is partially full, the number of bytes read will be less than the default buffer size. All magtape and disk reads are done with the file i/o read procedure and a call to fstati determines the number of bytes actually read.
If all the defaults are set, a binary copy is performed. In tape to tape copies the block and record sizes are preserved, but the density may be changed by specifying the appropriate output file name e.g. mta800 or mta1600. Reblocking occurs in tape to disk transfers, if records, are trimmed, padded or counted, or if blocks are padded. If a disk to tape transfer is requested the output block size will be the default file i/o buffer size. The last block in a file may be short. If uniform sized blocks are desired, pad_block must be set, in which case trailing partially filled blocks will be padded with padchar.
Logical records are distinguished from blocks (physical records). The input and output record sizes default to the size of the input and output blocks respectively. Logical records may be shorter or longer than the block sizes.
Copy a magnetic tape preserving the record sizes but changing the density from 800 bpi to 1600 bpi.
da> reblock mtb800, "mta1600[1]", "1-999"
Reblock a magnetic tape changing the block size from 4000 bytes to 8000 bytes and padding the last block.
da> reblock mtb1600, "mta1600[1]", "1-999", outb=8000, padb+
Trim the records of a disk file.
da> reblock input, output, inrec=80, outrec=72
Pad the records of a disk file with blanks.
da> reblock input, output, inrec=81, outrec=82, padchar=" "