Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 31
Handling Padding Characters
The next example uses the SET^FILE procedure to permit long writes. Here, the write-
fold feature is turned on just before a record is written to the file. Then it is turned off
again after the record is written. Subsequent writes are then limited to one logical
record.
LITERAL ON = 1;
LITERAL OFF = 0;
RECORD^LENGTH := 16;
CALL SET^FILE(DFILE,
ASSIGN^RECORDLENGTH,
RECORD^LENGTH);
CALL OPEN^FILE(COMMON^FCB,
DFILE);
.
.
BUFFER ':=' "This write operation is more than 16 bytes"
-> @S^PTR;
CALL SET^FILE(DFILE,
SET^WRITE^FOLD,
ON);
CALL WRITE^FILE(DFILE,
BUFFER,
@S^PTR '-' @SBUFFER);
CALL SET^FILE(DFILE,
SET^WRITE^FOLD,
OFF);
By default, the write-fold feature is turned off.
When reading records that were written using the write-fold feature, you must issue
one READ^FILE procedure call for each logical record.
Handling Padding Characters
Several options to the OPEN^FILE and SET^FILE procedures can affect the way blank
padding is applied to records written and read by SIO procedures.
The SIO routines support the following operations:
Trimming trailing blanks from a logical record before writing
Padding short logical records with blanks before writing
Trimming trailing blanks from logical records after reading
The following paragraphs explain how to accomplish these operations using SIO
procedures.