How to send print formatting commands or printer initialization strings to a TCP/IP printer?

Document ID : KB000030703
Last Modified Date : 21/05/2018
Show Technical Document Details
Introduction:

Introduction:

If you need to send print formatting commands or printer initialization strings to a TCP/IP defined printer, you may do so via print driver options and a PCLLIB / BINLIB / PJLLIB resource member.

Solution:

To send print formatting commands or printer initialization strings to a TCP/IP defined printer you would use a print driver and a print driver option to read a resource member from a PCLLIB,  BINLIB or PJLLIB resource member.

These activate a print driver with a specific print driver option and include read support of a resource library member for a printer node.

TCPDRIV=ddddB (Include ASCII PCL commands from a BINLIB. Mostly used for LPR and DSO print drivers since there is no auto formatting for them)
TCPDRIV=ddddF (Include EBCDIC PCL commands from a PCLLIB + turn on Auto Formatting)
TCPDRIV=ddddG (Include EBCDIC PCL (only PCL) commands from a PCLLIB without Auto Formatting for print drivers PJL, PJL4, PJL5 and PCL5)
TCPDRIV=ddddg (Include EBCDIC commands (any data) from a PCLLIB without Auto Formatting for print drivers LPR ,DSO ,PJL, PJL4, PJL5, and PCL5)
TCPDRIV=ddddK (Include EBCDIC PCL commands if found at the bottom of a PJLLIB resource member, as well as all formatting provided by the "F" option)

BINLIB, PCLLIB or PJLLIB members with IBM prefix naming conventions contain strings, that are sent to the printer before each file is printed. These resources can be invoked by specifying the file attributes in JCL or set in NODE and DESTID statements.

Examples:

DESTID QDEST=PRT1,FFORM=STD1 or FFCB=6 or FCHARS=CR12

DEFNODE TCPPRT,TCPIP,FORM=STD1 or FCB=6 

NODE PRT1,TCPPRT,FORM=STD1 or FCB=6

PCL resources searched in a PCLLIB are the files actual FORM, FCB and CHARS values prefixed with: 'FORM', 'FCB2' and 'CHAR' respectively. Therefore, if a file is created with FORM=STD, FCB=8 and CHARS=CR12, the resource names looked for are: 'FORMSTD', 'FCB28' and 'CHARCR12' respectively.

BIN resources searched in a BINLIB are the files actual FORM, FCB and CHARS values prefixed with: 'FORM', 'FCB2' and 'CHAR' respectively. Therefore, if a file is created with FORM=STD, FCB=8 and CHARS=CR12, the resource names looked for are: 'FORMSTD', 'FCB28' and 'CHARCR12' respectively.

PJL resources searched in a PJLLIB are the files actual FORM, FCB and CHARS values prefixed with: 'FORM', 'FCB2' and 'CHAR' respectively. Therefore, if a file is created with FORM=STD, FCB=8 and CHARS=CR12, the resource names looked for are: 'FORMSTD', 'FCB28' and 'CHARCR12' respectively.

Here is a list of the common print driver options that use either auto or non auto formatting.

  • B- Activates auto include of existing FCB, Form and Chars BINLIB resource members used for all print drivers except IPDS.
  • F -Activates auto include and auto formatting for print drivers PJL4, PJL5, and PCL5. For the standard LPR driver and the DSO driver, activates support of LINECNT or FCB page length for NOCC files and for single page ASA files. Activates FCB-based auto formatting if the text wrappers are used for print drivers DISK, SMTP, SAR, JES, ESF, FTP, XCOM and C:D.
  • G -Activates auto include of existing FCB, Form and Chars PCLLIB resource members for print driver PJL, PJL4, PJL5, and PCL5.
  • K -Include EBCDIC PCL commands if found at the bottom of a PJLLIB resource member, as well as all formatting provided by the "F" option for print driver PJL4 and PJL5.

The difference between the parameters is the library used; (BINLIB, PCLLIB or PJLLIB) and the auto formatting done on the file. Best results may be obtained using print driver option "G" because this turns off auto formatting. When you code your PCL commands and use the "F" print driver option, your PCL commands will be sent first followed by auto print formatting commands sent by CA Spool which could completely change and override the commands you originally wanted to use. You can read the PCL commands in ISPF. If you define your print formatting commands in a BINLIB which is done in ASCII, you need to switch to "HEX on" in ISPF EDIT to code and see the BINLIB member's contents.

Note: Multiple members can be also read from the resource libraries and sent to the printer in case you have the need to send more than one per print operation.

The optional PCLLIB, BINLIB and PJLLIB resource libraries must be allocated as RECFM=VB partition data sets, with LRECL=259 and BLKSIZE=2594.

  • A PCLLIB may contain predefined FORM, FCB2 and CHARs PCL commands in EBCDIC, which are automatically included in front of the actual print data if print driver option "F" is specified with automatic EBCDIC to ASCII translation.
  • A BINLIB may contain predefined FORM, FCB2 and CHARs BINARY commands in ASCII, which are automatically included in front of the actual print data if print driver option "B" is specified and no translation occurs.
  • A PJLLIB may contain predefined FORM, FCB2 and CHARs PJL commands in EBCDIC, which are automatically included in front of the actual print data if print driver option "G" is specified with automatic EBCDIC to ASCII translation.

Note: CA Spool requires the use of FCBs and searches the System Image Library (SYS1.IMAGELIB) first, then searches the libraries allocated by the IMAGELIB DD statement in the CA Spool procedure. If the FCB is not found error message: "ESF427 - FCB IMAGE (LINE) NOT FOUND" will be issued and the resource library will not be searched and the report will not be formatted as expected. If you plan to use FCB's to pass printer formatting commands or initialization strings the FCB must reside in an Image Library accessible to CA Spool to properly process channel skips within the file. To get an FCB resource to work correctly if not named with one of the standard provided IBM FCBs you need a 'dummy' FCB named with the same name of the resource member. For example, FCB2PORT created in the PCLLIB would also require an FCB2PORT in an accessibly Image library. The easiest way to accomplish this is to copy the standard FCB26 from SYS1.IMAGELIB to the new name FCB2PORT in your USER.IMAGELIB.

Format of a PCLLIB member:

A PCLLIB resource member must contain valid PCL commands in EBCDIC preceded by an EBCDIC escape character ( <esc> = x'27' ).

Note: Auto EBCDIC to ASCII translation occurs before the PCL commands are sent to the printer.

For example, a FORM=PORT PCL resource member called FORMPORT to pass portrait orientation and 6 lines per inch would have the following PCL commands:

<esc>&l0O
<esc>&l6D

To support different printer capabilities, a PCLLIB resource member can contain multiple sets of PCL commands selected by the actual device type of the printer node. These PCL command sets must be separated and identified by special DEVICE=device type, statements. For example, enter the default PCL command set first, followed by a special PCL command set for device type 'HPLJ5SI' as follows:

<esc>&l0O
<esc>&l6D
DEVICE=HPLJ5SI
<esc>&l0O
<esc>&l8D

Here are a couple of examples showing how the PCL resource members are actually coded.

Example 1:

  EDIT       CAI.ESF.PCLLIB(FORMPORT) - 01.02       Columns 00001 00072
  Command ===> hex on                                   Scroll ===> CSR
  ****** ********************* Top of Data ****************************
  000001 &l0O
         259FD444444444444444444444444444444444444444444444444444444444
         70306000000000000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  000002  &l6D                                                                
         259FC444444444444444444444444444444444444444444444444444444444
         70364000000000000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  ****** ******************** Bottom of Data **************************
  &l0O means in PCL language: "turn your print orientation to portrait"

Example 2:

  EDIT       CAI.ESF.PCLLIB(FORMLAND) - 01.02       Columns 00001 00072
  Command ===> hex on                                   Scroll ===> CSR
  ****** ********************* Top of Data ****************************
  000001  &l1O                                                         
         259FD444444444444444444444444444444444444444444444444444444444
         70306000000000000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  000003 DEVICE=HPLJ5SI                                               
         CCECCC7CDDDFEC444444444444444444444444444444444444444444444444
         455935E8731529000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  000004  &l1O                                                        
         259FD444444444444444444444444444444444444444444444444444444444
         70306000000000000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  000005  &l8D                                                         
         259FC444444444444444444444444444444444444444444444444444444444
         70384000000000000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  ****** ******************** Bottom of Data **************************

&l1O means in PCL language: "turn your print orientation to landscape" which is the default setting.

The next two commands are only sent for printers with a device type of HPLJ5SI.

&l1O says in PCL language: "turn your print orientation to landscape"
&l8D says in PCL language: "set your lines per inch to 8"

A printer's modified configuration can be reset back to factory default values by sending a RESET command to the printer after each file has printed. For example, a member called RESET in the PCLLIB could be used to reset the printer default settings to the factory default values, as follows. This member is auto translated from EBCDIC to ASCII before sending the command to the printer.

  EDIT       CAI.ESF.PCLLIB(RESET) - 01.02          Columns 00001 00072
  Command ===>                                          Scroll ===> CSR
  ****** ********************* Top of Data ****************************
  000001  E
         2C444444444444444444444444444444444444444444444444444444444444
         75000000000000000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  ****** ******************** Bottom of Data **************************

Format of a BINLIB member:

A BINLIB resource member must contain valid binary commands in ASCII.

Note: No translation is done when the binary commands are sent to the printer.

A FORM=STDP binary resource member called FORMSTDP to pass portrait orientation would have binary commands coded as shown in example 1 below.

A FORM=STDL binary resource member called FORMSTDL to pass landscape orientation would have binary commands coded as shown in example 2 below.

Also note that DEVICE=device type is supported in a BINLIB resource as shown in example 2 below.

Example 1:

  EDIT       CAI.ESF.BINLIB(FORMSTDP) - 01.00       Columns 00001 00072
  Command ===> hex on                                   scroll ===> CSR
  ****** *********************** Top of Data **************************
  ---------------------------------------------------------------------
  000001   % |
         12634444444444444444444444444444444444444444444444444444444444
         B6C0F000000000000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  ****** ********************** Bottom of Data ************************

Example 2:

  EDIT       CAI.ESF.BINLIB(FORMSTDL) - 01.00       Columns 00001 00072
  Command ===> hex on                                   scroll ===> CSR
  ****** ************************ Top of Data *************************
  ---------------------------------------------------------------------
  000001   % |
         12634444444444444444444444444444444444444444444444444444444444
         B6C1F000000000000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  000002 DEVICE=HPLJ5SI                        
         CCECCC7CDDDFEC444444444444444444444444444444444444444444444444
         455935E8731529000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  000003   % |                                 
         12634444444444444444444444444444444444444444444444444444444444
         B6C1F000000000000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  000004   ?     ?                             
         12733233444444444444444444444444444444444444444444444444444444
         B8315E00800000000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  ****** ********************** Bottom of Data ************************

As already explained above the factory default configuration can be modified by sending a RESET command to the printer after each file has ben sent. For example, a binary resource member called RESET could be used to reset the default environment variables on the printer to their factory default values, as shown below. You can also use a RESET member to send printer controls if necessary after each file such as a 0D or 0C or 0A or a combination of them. Anything that a printer needs that may not be done by CA Spool that is a printer command can be coded in a RESET member in the printer language.

Example:

  EDIT       CAI.ESF.BINLIB(RESET) - 01.02          Columns 00001 00072
  Command ===>                                          Scroll ===> CSR
  ****** ********************* Top of Data ****************************
  000001 ?                                
         14444444444444444444444444444444444444444444444444444444444444
         B5000000000000000000000000000000000000000000000000000000000000
  ---------------------------------------------------------------------
  ****** ******************** Bottom of Data **************************

Format of a PJLLIB member:

A PJLLIB resource member must contain valid printer job language(PJL) commands in EBCDIC.

Note: Auto EBCDIC to ASCII translation occurs before the PJL commands are sent to the printer.

A FORM=STD1 PJL resource member called FORMSTD1 to pass portrait orientation and set lines to 60 would have PJL commands coded as shown in example 1 below.

A FORM=STD2 PJL resource member called FORMSTD2 to pass landscape orientation and set lines to 48 would have PJL commands coded as shown in example 2 below.

Also note that DEVICE=device type is supported in a PJLLIB resource as shown in example 2 below.

Example 1:

  EDIT       CAI.ESF.PJLLIB(FORMSTD1) - 01.05       Columns 00001 00072
  Command ===>                                          Scroll ===> CSR
  ****** ******************** Top of Data *****************************
  000001 @PJL SET ORIENTATION=PORTRAIT                                
  000002 @PJL SET FORMLINES=60                                         
  ****** ******************* Bottom of Data *************************** 

Example 2:

  EDIT       CAI.ESF.PJLLIB(FORMSTD2) - 01.05       Columns 00001 00072
  Command ===>                                          Scroll ===> CSR
  ****** ********************* Top of Data ****************************
  000001 @PJL SET ORIENTATION=LANDSCAPE                  
  000002 @PJL SET FORMLINES=48
  000003 DEVICE=HPLJ5SI
  000004 @PJL SET ORIENTATION=LANDSCAPE   
  000005 @PJL SET FORMLINES=45 
  000006 @PJL SET LPARM:PCL PITCH=15.00                               
  ****** ******************* Bottom of Data ***************************

A printers default configuration can be modified by sending PJL INITIALIZE, RESET, and DEFAULT PJL commands to the printer. For example, a FORM=DEF0 PJL resource member FORMDEF0 could be used to reset the PJL default environment variables on the printer to their factory default values, as shown below. Remember that this FORMDEF0 is only sent before each print file.

@PJL SET ORIENTATION

Another way to reset your printer if necessary is to define a RESET member in your PJL resource library and specify "@PJL SET ORIENTATION" to reset the orientation back to the printer configuration. A RESET resource member is always sent after the print file.

Additional Information:

To sum up:

  1. Allocate CAI.ESF.PCLLIB PDS with LRECL=259, BLKSIZE=2594, RECFM=VB
  2. Define //PCLLIB DD DISP=SHR,DSN=CAI.ESF.PCLLIB in your CA Spool procedure
  3. Create CAI.ESF.PCLLIB(FORMPORT) with content "<esc>&l0O"
  4. Change NODE statement: TCPDRIV=PCL5G,FORM=PORT
  5. Add DESTID QDEST=yournode,FFORM=PORT
  6. WARM restart your CA Spool main region to add the new PCLLIB DD statement
  7. Create and print your file

Note: If you need to debug print formatting commands being sent to your printer you can do that by changing your NODE statement to add print driver option "T"; TCPDRIV=PCL5GT and issue a REINIT command to CA Spool. Print driver option "T" will create a TCPTRACE file, on hold, under your printer you can use to verify the proper commands are sent before or after the print file queued to the printer.

Instructions:
Please Update This Required Field