POSITION (Position) keyword in printer files

You use this field-level keyword to define the location of a named field on the page.

The format of the keyword is:

POSITION(position-down | &position-down-field
position-across | &position-across-field)

The position-down parameter is required and defines the vertical starting point of the field 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 field 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:

  • POSITION(3.56 6.24)
  • POSITION(&field1 9.625)
  • POSITION(0.5 &field2)
  • POSITION(&field3 &field4)

Field1, field2, field3, and field4 are the names of program-to-system fields. The fields must exist in the same record format as the POSITION keyword and be defined as having length 5 with 3 decimal positions, data type S (zoned decimal), and usage P (program-to-system).

Note: The UOM parameter on the CRTPRTF command determines the units of measure for the position-down and position-across parameter values. If the value specified for a parameter is outside the valid range, it is flagged when the spooled file is created.

An error message is issued at print time if the field does not fit on the page.

An error message is issued at creation time if line and position values, columns 39 through 44, are also specified.

Because the POSITION keyword allows a field to be positioned anywhere on the page, a new page is not generated by the use of the position keyword. The ENDPAGE keyword should be used to end the current page and proceed to the next page.

If the POSITION keyword is specified for a field, all fields in the record format must also have the POSITION keyword specified. Location entries in positions 39 through 44 are not allowed.

You can specify constant fields where the POSITION keyword is also specified. You just need to use a special name (*NONE).

Specify DEVTYPE(*AFPDS) on the CRTPRTF command when POSITION 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 cannot specify POSITION with the following keywords:

  • SPACEA
  • SPACEB
  • SKIPA
  • SKIPB

Option indicators are valid for this keyword.

Example

The following example shows how to specify the POSITION keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
     A*
     A          R REC1
     A            FLD1           6S 2       POSITION(2.0 1.983)
     A*
     A            FLD2          42A         POSITION(&FLD2A &FLD2B)
     A            FLD2A          5S 3P
     A            FLD2B          5S 3P
     A*
Note: The UOM parameter on the CRTPRTF command determines the units of measure for the parameter values.

In REC1, FLD1 prints 2.0 units down and 1.983 units across from the margins specified on the FRONTMGN or BACKMGN parameter on the CRTPRTF command.

The application program determines the position of FLD2 by assigning values to program-to-system variables FLD2A and FLD2B.