DRAWER (Drawer) keyword in printer files

You use this record-level keyword to specify the drawer from which noncontinuous forms are selected.

The format of the keyword is:
DRAWER(drawer-number | &drawer-number)
Drawer-number specifies the drawer from which the paper or the envelope is to be fed. Valid values are 1 - 255 and *E1 as follows:
1
The paper is fed from the first drawer on the sheet-feed paper handler.
2
The paper is fed from the second drawer on the sheet-feed paper handler.
n
The paper is fed from the nth drawer on the sheet-feed paper handler.
*E1
The envelope is fed from the envelope drawer on the sheet-feed paper handler.

You can specify the drawer number as a constant or a program-to-system field. When you specify the drawer number as a program-to-system field, the field must exist in the same record format as the DRAWER keyword. It must be defined as a length of 4, data type A and usage P.

If you do not specify the DRAWER keyword, the value specified on the DRAWER parameter of the CRTPRTF, CHGPRTF or OVRPRTF command determines the paper source drawer.

DRAWER is ignored at run time if it is not specified on a page boundary. The printer is on a page boundary when no named or constant fields are processed for a page. As soon as a named or constant field is processed, the printer is no longer on a page boundary. The printer is on a page boundary again when a SKIP, SPACE, or ENDPAGE keyword is processed that causes the printer to move to a new page.

DRAWER, SKIP, and SPACE keywords are processed in the following order:

SKIPB
SPACEB
DRAWER
SPACEA
SKIPA

DRAWER is in effect only for the record format specified. After records with the specified record format are processed, the paper-source drawer for the next record format (if the DRAWER keyword is not specified) is the drawer specified at the file level (CRTPRTF, CHGPRTF, or OVRPRTF command).

For files created with DEVTYPE(*SCS), if the DRAWER keyword is specified on a record format that spans several pages, it remains in effect only for the page on which it is specified.

You cannot specify DRAWER on the same record format with the CPI keyword or a record-level DFNCHR keyword. If any format in the file contains both DRAWER and either CPI or a record-level DFNCHR keyword, the file is not created.

Option indicators are valid for this keyword.

Note: Only one drawer keyword for each record format is valid at any time. Even with option indicators, it is not valid to specify more that one drawer keyword per record format.

Example

The following example shows how to specify the DRAWER keyword.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RECORD1                   SKIPB(3)
00020A            FIELD1        10         1SPACEA(1)
00030A            FIELD2         5         1SPACEA(1)
00040A
00050A          R RECORD2                   DRAWER(2)
00060A            FIELD3         5         1
00070A            FIELD4         5         6SKIPA(1)
00080A
00090A          R RECORD3                   DRAWER(2)
00100A            FIELD5        10         1SPACEA(1)
00110A            FIELD6        10         1SKIPA(1)
00120A            FIELD7        10         1SPACEA(1)
00130A            FIELD8        10         1SPACEA(1)
00140A
00150A          R RECORD4
00160A            FIELD9        10         1SKIPB(30)
00170A            FIELD10       10        21
00180A          R RECORD5                   SKIPB(3)
00190A            FIELD11       10         1SPACEA(1)
00200A            FIELD12       10         1SPACEA(1)
00210A          R RECORD6                   SKIPB(1) DRAWER(&FIELD14)
00220A            FIELD13       10         1
00230A            FIELD14        4   P

The printer is not on a page boundary after record format RECORD1 is processed. When record format RECORD2 is processed, DRAWER is ignored and paper continues to come from the source drawer previously specified (file level). Because SKIPA(1) is specified for FIELD4 of RECORD2, the printer is on a page boundary after RECORD2 is processed. The paper for both pages of RECORD3 comes from drawer 2. The paper source for record formats RECORD4 and RECORD5 is the drawer specified at the file level (drawer 1 in this example). But because RECORD4 starts in the middle of a page, it prints on the same page as RECORD3 (drawer 2). Record format RECORD5 prints on a different page (SKIPB(3)) and prints on paper from drawer 1. RECORD6 allows the application program to specify the drawer-number by setting field FIELD14.