Use this record-level keyword to print a horizontal or vertical line.
The format of the keyword is:
LINE(position-down | &position-down-field position-across | &position-across-field line-length | &line-length-field line-direction line-width | &line-width-field [line-pad] [color value])
The position-down parameter is required and defines the vertical starting point of the line relative to the margins specified on the FRONTMGN or BACKMGN parameter on the CRTPRTF command. Valid values are 0 to 57.790 cm (0 to 22.750 in.).
The position-across parameter is required and defines the horizontal starting point of the line relative to the margins specified on the FRONTMGN or BACKMGN parameter on the CRTPRTF command. Valid values are 0 to 57.790 cm (0 to 22.750 in.).
You can specify the position-down and position-across parameters as constants, program-to-system fields, or a combination of both, as shown in the following examples:
Field1, field2, field3, and field4 are the names of program-to-system fields. The fields must exist in the same record format as the LINE keyword and be defined as having length 5 with 3 decimal positions, data type S (zoned decimal), and usage P (program-to-system).
The line-length parameter is required and defines the length of the line. Valid values are 0.001 to 57.790 cm (0.001 to 22.750 in.). The parameter can be a program-to-system field. The field must exist in the same record format as the LINE keyword and be defined as having length 5 with 3 decimal positions, data type S (zoned decimal), and usage P (program-to-system).
Value | Line width |
---|---|
*NARROW | 12/1440 in. (0.008 in., 0.022 cm) |
*MEDIUM | 24/1440 in. (0.017 in., 0.042 cm) |
*WIDE | 36/1440 in. (0.025 in., 0.064 cm) |
The line-direction parameter is required and can have a value of horizontal (*HRZ) or vertical (*VRT).
The line-pad parameter is optional. It specifies where the line-width value is placed in relationship to the actual line coordinates. For example, if line-width is 5 and line-pad is *TOP, the line extends above the point identified by the position-across and position-down parameters. Valid values are *TOP and *BOT for *HRZ lines, and *LEFT and *RIGHT for *VRT lines. The defaults are *BOT for horizontal lines and *RIGHT for vertical lines.
The optional color parameter lets you specify the color of the line. Specify the color as an expression in one of the following forms:
When the LINE keyword is specified on a record format, all fields within the record format must be positioned using the POSITION keyword.
An error message is issued if a constant field is specified in a record format where the LINE keyword is also specified.
An error message is issued at print time if the line does not fit on the page.
Specify DEVTYPE(*AFPDS) on the CRTPRTF command when LINE is specified in the file. If DEVTYPE is changed to anything other than *AFPDS, the keyword is ignored and a warning message is issued at print time.
You can specify this keyword a maximum of 40 times on a record.
You cannot specify LINE with the following keywords:
Option indicators are valid for this keyword.
The following example shows how to specify the LINE keyword.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A* A R REC1 LINE(1.5 3.0 4.25 *HRZ 0.2 *TOP) A* A R REC2 LINE(2.1 1.5 7.5 *HRZ 0.05 *BOT) A LINE(&FLD1 &FLD2 4.25 *VRT 0.01 + A *LEFT) A FLD1 5S 3P A FLD2 5S 3P A* A R REC3 A 02 LINE(1.0 1.1 6 *HRZ 1) A* A R REC4 LINE(3.5 6.0 4.25 *HRZ 0.2 *TOP + A* (*COLOR *RGB 20 15 75)) A A
REC1 prints a horizontal line 4.25 units long. The line starts 1.5 units down and 3.0 units across from the margins specified on the FRONTMGN or BACKMGN parameter on the CRTPRTF command. The line is 0.2 units wide. The extra width is added at the top of the line.
REC2 prints two lines. The first line, printed horizontally, starts 2.1 units down and 1.5 units across from the margins specified on the FRONTMGN or BACKMGN parameter on the CRTPRTF command. The line is 7.5 units long and 0.05 units wide. The extra width is added below the line.
The position of the second line is determined by the value assigned to program-to-system fields FLD1 and FLD2. The line, printed vertically, is 4.25 units long and 0.01 units wide. The extra width is added on the left side of the line.
REC3 prints a line only if indicator 02 is on. The extra width is added on the bottom of the line.
REC4 prints a line with the RGB color model and specifies color values of 20, 15, and 75.
The following coding example uses DDS and P-fields.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 * R REC1 LINE(4 3 5 *HRZ .01) LINE(&FLD1&FLD2 2 *VRT .015 *RIGHT) FLD1 5S 3P FLD2 5S 3P
The following example illustrates the location of the lines using the previous DDS code, when the application assigns a numeric value of 3 to FLD1 and a numeric value of 5 to FLD2. Both the FRONTMGN and BACKMGN parameters on the CRTPRTF command are set to 2. Line 1 starts at 4 down and 3 across and its horizontal length is 5. Line 2 starts at 3 down and 5 across and its vertical length is 2.