CPI (Characters Per Inch) keyword in printer files

This record- or field-level keyword specifies the horizontal printing density for the record format or field that you are defining.

Use CPI to:
  • Darken logos and other printed graphics that you create using the DFNCHR keyword
  • Place more data in less space on printed forms
  • Fit the appearance of a form to your needs
The format of the keyword is:
CPI (10 | 15)

10 or 15 specifies the number of characters per inch.

This keyword is valid only for the 5224 and 5225 SCS printers. If you do not specify CPI, the density is set by the CPI parameter on the Create Printer File (CRTPRTF), Change Printer File (CHGPRTF), or Override with Printer File (OVRPRTF) command.

If you specify CPI at the record level, all fields in the record format are at the same density except those for which you specify CPI at the field level.

If you specify CPI at the field level, you can specify different densities for fields printed on the same line. The position you specify for each field (in positions 42 through 44) is based on the value of the CPI parameter on the CRTPRTF, CHGPRTF, or OVRPRTF command (see the following examples).

When you specify CPI at the field level, overlapping fields are not diagnosed.

A warning message results at creation time if you specify CPI in a file created with DEVTYPE(*IPDS) or DEVTYPE(*AFPDS). To change the CPI, you must specify the FONT keyword.

You cannot specify CPI on the same record format as the DRAWER keyword.

Option indicators are valid for this keyword.

Examples

The following examples show how to specify the CPI keyword for a record format.

Example 1:

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RECORD1
00020A  02                                  CPI(15)
00030A            FLD1         20       3  1
00040A            FLD2          5  0      +2
00050A          R RECORD2                   SPACEB(1)
00060A            FLD3                     1
     A

In this example, if option indicator 02 is set to on, both FLD1 and FLD2 in RECORD1 are printed at 15 characters per inch. If option indicator 02 is set to off, FLD1 and FLD2 are printed at the density specified for the CPI parameter on the CRTPRTF, CHGPRTF, or OVRPRTF command.

The printer spaces one line before printing RECORD2. FLD3 in RECORD2 is printed at the density specified for the CPI parameter on the CRTPRTF, CHGPRTF, or OVRPRTF command.

Example 2:

The following example shows what happens when a field at 15 CPI is printed between fields printed at 10 CPI.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RCDA                      SPACEA(1)
00020A            FLD1          10         1
00030A            FLD2          10        11CPI(15)1
00040A            FLD3          10        21
     A
In this example, all positions entries 1 refer to columns measured at 10 CPI (as specified on the CRTPRTF, OVRPRTF, or CHGPRTF command). Therefore, RCDA is printed as follows:
11111111112222222222     3333333333
FLD2, being compressed at 15 CPI, uses less room than FLD1 or FLD3. To avoid the gap, specify FLD3 more to the left. To calculate the position of FLD3, add the length of FLD2 to the specified position of FLD2. To calculate the length of FLD2, use the following formula:
length specified X file density = printed length
density for the field
or, for FLD2:
10 X 10 = 10 X 2 = 6.67 (rounded up to 7)
15        3
Add 7 to 11, the specified position of FLD2, as follows:
7 + 11 = 18
The resulting corrected DDS for Example 2 becomes:
R RCDA                     SPACEA(1)
FLD1            10      1
FLD2            10     11CPI(15)
FLD3            10     18
The record format then prints as follows:
11111111112222222222 3333333333

Example 3:

The following example shows what happens when a field at 10 CPI is printed between fields printed at 15 CPI.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RCDB                      SPACEA(1)
00020A            FLD4          10          1
00030A            FLD5          10         11CPI(10)  1
00040A            FLD6          10         21
     A
In this example, the positions entries 1 refer to positions measured at 15 CPI (as specified on the CRTPRTF, OVRPRTF, or CHGPRTF command). The system uses the following formula to calculate the beginning position of fields printed at 10 CPI within files printed at 15 CPI:
2(specified position - 1)  + 1 = printed position (truncated if fractional)
3
or, for FLD5:
2(11-1)  + 1 = 7.67 (truncated to 7)
3
The truncation can cause overprinting of FLD4 by FLD5, as shown in the following example:
44444444445555556666666666666

To avoid the overprinting, specify FLD5 one more position to the right (position 12).

To calculate the position of FLD6, add the length of FLD5 to the position of FLD5. To calculate the length of FLD5, use the following formula:
length specified X density for the file = printed length
density for the field
or, for FLD5:
10 X 15 = 15 (rounded up if necessary)
10
Add 15 to the (adjusted) position of FLD5:
15 + 12 = 27
The resulting corrected DDS for Example 3 becomes:
R RCDB                SPACEA(1)
FLD4       10      1
FLD5       10     12CPI(10)
FLD6       10     27
The record format then prints as follows:
4444444444 5555555555 6666666666

Example 4:

The following example shows the effect of the CPI keyword on how the system truncates or folds fields at the right side of the printer form. This depends on the values of the FOLD and PAGESIZE parameters on the CRTPRTF, CHGPRTF, or OVRPRTF commands.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RCDC                      SPACEA(1)
00020A            FLD7          10       140
00030A            FLD8          10       150CPI(10)
     A
In this example, if the file is being printed at 15 CPI with a forms width of 160, FLD7 and FLD8 are printed as follows:
  • FLD7 starts at position 140 for a print length of 10 at 15 CPI (16.9 mm or 0.667 inch).
  • FLD8 starts at position 150 for a print length of 10 at 10 CPI (25.4 mm or one inch).
Printing FLD8 at position 150 calculated at 15 CPI causes FLD8 to extend beyond the right margin. Therefore, FLD8 is either truncated or folded onto the next line (depending on the FOLD parameter on the CRTPRTF, CHGPRTF, or OVRPRTF command). To calculate the length of FLD8, use the following formula:
length specified X density for the file = printed length
density for the field
or, for FLD8:
10 X 15 = 15 (truncated to next lower integer if necessary)
10
Note: When a file printed at 15 CPI contains fields printed at 10 CPI, the right margin of the form is adjusted for all fields according to the following formula:
2(specified length of the field - 1) + 1 = adjustment
3                                 (truncated if fractional)
Related reference
FONT (Font) keyword in printer files