FIELD Command
The FIELD command is used to identify a field in a Data Record to be formatted and placed on the page. FIELD must follow the LAYOUT command, and parameters that are not specified on FIELD are inherited from the previous LAYOUT. This topic describes the new keywords on FIELD that are used with record formatting.
Page numbering can be accomplished by specifying FIELD with the PAGENUM parameter. Most often, you specify FIELD PAGENUM with other formatting information such as position and alignment, which causes the current page number to print at the specified position. The current page number is calculated based on the specification of the PAGECOUNT parameter on the previous PAGEDEF or PAGEFORMAT command. You can override the page number to a specific value with the RESET parameter on the FIELD command. For details, see Page Numbering.
You can retrieve the value of the Record ID for printing with the RECID keyword on FIELD. RECID also has START and LENGTH subparameters to allow only portions of the Record ID to be printed. Normally, you use the RECID parameter only for debugging your application by tracing which Record IDs are being processed, although it can be used for anything that makes sense for your application.
You can also specify the POSITION, COLOR, DIRECTION, and ALIGN keywords with the PAGENUM or RECID parameters on FIELD. The BARCODE and SUPPRESSION keywords are not allowed with PAGENUM or RECID, but can be used with other text fields from the Data Record.
ALIGN is a keyword that is allowed with the START/LENGTH or TEXT forms of the FIELD command, but only if you are doing record formatting. You use ALIGN to specify whether the field text is LEFT or RIGHT aligned at the given horizontal position.
If your Data Records are stored in a database, the fields might be separated with field delimiters instead of just being positional within the record. The DELIMITER keyword on the preceding LAYOUT command is used to specify the 1-byte or 2-byte value that is used to separate fields in the Data Records.
If your data uses field delimiters, you can also specify the FLDNUM parameter on the FIELD command to indicate the number of the field within the record to be extracted, rather than the START position. Fields are numbered from left to right beginning with 1. You can also use the starting position (START) and LENGTH keywords with the FLDNUM to indicate that only part of the field is to be formatted. An example of a typical command is:
COMMANDS
.
.
.
LAYOUT 'abc' DELIMITER '*';
FIELD FLDNUM 1 START 2 LENGTH 8 ALIGN RIGHT
POSITION 5.6 in CURRENT
FONT varb ; /* Variable text - Amount */
FIELD FLDNUM 2 ALIGN LEFT
POSITION 1.1 in .9 in
FONT varb ; /*variable - customer name */
DATA
abc *Here is some data*more data*
FIELDS used
1st field 'ere is s'
2nd field 'more data'