Specifications
42 IBM System z Personal Development Tool: Volume 3 Additional Topics
Shell script
We created a shell script named prt00E (the name is arbitrary) and placed it in our home
directory (/home/ibmsys1, in our case). The shell script contained the following:
CTL=”\033\105\033\050\163\060\160\061\066\056\066\067\150\070\056\166
\060\163\060\142\124\033\046\154\061\157\061\163\065\056\064\143
\055\061\060\060\060\132”
CTL2=”\014\033\105”
(/bin/echo -ne $CTL; cat /tmp/1403a; /bin/echo -ne $CTL2) | lpr -P optras1250
The CTL and CTL2 definition constants are printer control characters, written in octal.
11
The
octal format was the most convenient for use in a shell script. If you have good script writing
skills you can do this several ways. The particular control characters shown here are for the
Lexmark printers we mentioned. Your printer may require different controls. If you are printing
to the default Linux printer you do not need the -P parameter (and queue name) of the lpr
command.
The logic in the shell script is simple. It sends data (via a
pipe and lpr) to the queue we
defined earlier. It sends the CTL string (using echo), then sends the print data from the output
file we named in the devmap or awsmount command (using cat), and then sends the CTL2
string (using echo) to flush the printer buffer and reset the printer.
The CTL control string (for our Lexmark printers) resets the printer, switches to a fixed font,
sets a small type size pitch, changes to 8 lines/inch, uses a Courier font, uses landscape,
duplex printing, uses 5.4/48 line height, and a small line offset to better center the data. The
only unique requirement is that the format must use
exactly 66 lines per page in order to
synchronize with the pages produced by the 1403 emulator.
In the following strings \033 is the ESC character that is used to begin printer command
strings, and this is shown as a bold-face E in the character equivalents of the string. The octal
constants are the equivalent of the characters shown and the CTL string could be written with
characters (except for the ESC byte). The CTL commands are:
OCTAL constant....... Characters Comment
\033\105 EE Reset printer
\033\050\163\060\160 E(s0p Use a fixed font,
\061\066\056\066\067\150 16.67h with 16.67 inch character pitch
\070\056\166 8.v with 8 lines/inch characteristics
\060\163\060\142\124 0s0bT using upright, medium Courier
\033\046\154\061\157 E&l1o Use landscape format
\061\163 ls with duplex printing, long edge
\065\056\064\143 5.4c 5.4/48 inch line height
\055\061\060\060\060\132 -1000Z line offset
The CTL2 commands are:
\014\033\105 Force last page, reset printer
The CTL string was produced after some experimentation. It works for our printers, but it may
contain unnecessary elements. Notice that we hard-coded the file name (/tmp/1403a) in the
shell script; more skilled users may want to make this a command-line variable.
JES2 setup
Normal z/OS printing flows through JES2 and printers must be known to JES2. Recent
AD-CD systems do not have a printer defined for JES2; we need to define a 1403 at address
00E for JES2. (We use device number 00E because it is the traditional address for a 1403
11
CTL is shown as three lines here, but it is actually created as one long line containing 38 octal constants.










