PAGNBR (Page Number) keyword in printer files

Use this field-level keyword to specify the location of an unnamed, 4-digit, zoned decimal field to contain the page number.

Start of changeSpecify only the PAGNBR keyword, the location of the field (the location of the field can be either position only, or line number and position), or name the field with the special name *NONE if the POSITION (Position) keyword is used in the record to specify the location of the fields. Optionally, you can specify the CHRSIZ, COLOR, FONT, HIGHLIGHT, UNDERLINE, or TEXT keyword.End of change

This keyword has no parameters.

When the printer file is opened, the i5/OS™ operating system sets the page count to zero and increases it by one before it prints each new page. This is done even if you do not specify the PAGNBR keyword. The page number is printed each time any field for which the PAGNBR keyword is specified is printed. The page number does not increase beyond 9999; it stays 9999 until it is reset. To reset the page count, condition PAGNBR with option indicators. The i5/OS operating system resets the page number when your program selects PAGNBR (see the following examples).

You can also specify EDTCDE or EDTWRD with the PAGNBR keyword.

Option indicators are valid for this keyword.

You can specify the field (location only) and the keyword on one line with no indicators or on separate lines with separate indicators. The following sections explain the differences.

Example 1: Specify on one line with no indicators in printer files

The page number is always printed, and you cannot reset the page number to one, as shown in the following example.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00100A          R RECORD
00110A                                  1 60'PAGE:'
00120A                                    +1PAGNBR
     A
Note: On lines 110 and 120 two constant fields are specified: 'PAGE:' and the page number itself (location specified as +1).

Example 2: Specify on separate lines with separate indicators in printer files

If the field indicator (01 in the following example) is off, the field is not printed, even if the keyword indicator (02 in the following example) is set on. If the field indicator is on, the field is printed. The page count is increased when the keyword indicator is off. The page count is reset to one when the keyword indicator is on. The page number prints whether the keyword indicator is off or on.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00100A          R RECORD
00110A  01                              1 60'PAGE'
00120A  01                                +1
00130A  02                                  PAGNBR
     A
Related concepts
Constant fields in printer files