Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 33
Handling Padding Characters
Padding Short Records With Blanks When Writing
Use the WRITE^PAD flag with the OPEN^FILE procedure or the SET^FILE
SET^WRITE^PAD operation to pad a short record with blanks before writing the record
to a file. By default, write-blank-padding is turned on for disk files with fixed-length
records and turned off for all other files.
The following statement uses the OPEN^FILE procedure to turn on write-blank-
padding:
CALL OPEN^FILE(COMMON^FCB,
DFILE,
!block^buffer!,
!block^bufferlen!,
WRITE^PAD,
WRITE^PAD);
The following statements have the same effect using SET^FILE:
LITERAL ON = 1;
.
.
CALL SET^FILE(DFILE,
SET^WRITE^PAD,
ON);
In the next example, the WRITE^FILE procedure would normally write 16 bytes of data
into the logical record in the data file of variable-length records. However, because the
WRITE^PAD flag is set in the OPEN^FILE call, the record gets padded with trailing
blanks up to the length of the logical record:
RECORD^LENGTH := 24;
CALL SET^FILE(DFILE,
ASSIGN^RECORDLENGTH,
RECORD^LENGTH);
VST071.VSD