Accessing Files Programmer's Guide (32650-90885)

128 Chapter8
Writing to a File
Writing User Data in ANSI Labels
for counter := 1 to 80 do {Loop to fill array with }
user_label [counter] := ' '; {ASCII blanks. }
user_label := 'tape01 user header label no. 1'; {Overwrite first }
{30 bytes with label name }
FWRITELABEL (labeled_tape_file, {Required parameter }
user_label, {Required parameter }
label_length {Optional parameter }
);
if ccode = CCL or CCG {check FWRITELABEL condition code }
then handle_file_error (labeled_tape_file);
.
.
.
If ccode indicates that the FWRITELABEL intrinsic encountered an error condition (either
CCL or CCG), an error handling procedure handle_file_error is invoked. For more
information about FWRITELABEL intrinsic parameters, refer to the MPE/iX Intrinsics
Reference Manual. For more information about opening files, refer to chapter 5, "Opening a
File".
Writing User Data in ANSI Labels
It is possible to write data into bytes 5/21 of the HDR1 record of an ANSI tape label. In all,
17 bytes are available. If you write more than 8 bytes into the record, the 9th byte (Byte
13) must be a period (".").
For example, to write the string "FRANKSTN COUNCIL" into bytes 5/21, mount your tape
and then do this:
FILE FRANKSTN.COUNCIL;DEV=TAPE;REC=-80,,F,ASCII;LABEL=BUDGET,ANS
FCOPY FROM=
datafile
;TO=*FRANKSTN.COUNCIL
where
datafile
is the name of a disk file. This coerces the string
"FRANKSTN.COUNCIL" into bytes 5/21 of the HDR1 record, and it places "BUDGET"
into the VOL1 record of the tape.
The "file" and "group" names are right-justified.
In order to retrieve the string recorded in bytes 5/21, you must create a program that uses
the intrinsics FOPEN (or HPFOPEN) and FFILEINFO. The program must do two things:
It must FOPEN (or HPFOPEN) the tape device.
It must employ FFILEINFO with option 45 to retrieve the "file" identifier.
The tape containing such a label must be mounted before you run the program.
5678910 11 12 13 14 15 16 17 18 19 20 21
FRANKS T N . C O U N C I L