CICS Printing

In this newsletter we discuss printing from a CICS application to a Virtel 3270 printer. The CICS API support for printing is the same as that for writing to a display terminal with some additional print format considerations. Terminal control commands (SEND) and BMS commands (SEND MAP, SEND TEXT, etc.) are both supported. In our sample CICS application we use SEND TEXT commands to build up a 3270 buffer image. When the buffer image is complete we issue a SEND PAGE which causes CICS to send the buffer to the Virtel 3270 printer. To CICS the Virtel printer looks like any supported IBM 3270 printer, an IBM 3287 for example. Depending on the Virtel printer configuration will dictate how Virtel processes the 3270 print buffer. For 3270 data streams Virtel will convert the buffer image into a HTML template and forward this on to the browser to be displayed in a separate browser window. For SCS data streams Virtel doesn’t convert the data but instead stores it on disk in its raw format for further processing.

CICS supported printers and print orders.

CICS supports two different types of printers, printers that support 3270 data streams which contain buffer control and print format orders (SBA, SF orders, etc.) and non-3270 printers that support only the SNA character set (SCS). A 3270 data stream printer is normally referred to as a LU type 0 or LU type 3, whereas a SCS printer is known as a LU type 1. Printers can be configured within CICS to support different characteristics – line count, line width, page size etc. Most of these settings are associated with the printer’s Terminal and Typterm CICS table entries.

Two issues associated with CICS printing are:-

  1. The formatting considerations.

  2. Associating a task to the printer.

In our examples there are no formatting considerations other than pagination and newline processing. This is taken care of by the CICS NLEOM route option and by inserting a FormFeed within the CICS printer buffer area during the buffer build process.

We associate a task to the destination printer by using the CICS ROUTE command and build a route list storage area identifying our target printer within the CICS application.

Virtel printer support

Virtel provides support for both SCS (LU Type 1) and 3270 data stream (LU Type 0/3) printers. Virtel can also be configured to pre-allocate or dynamically allocate the printer LU. Dynamically allocating the printer LU means that the printer can be shared amongst 3270 applications, only using the printer as and when required by the application. Depending on the support printer depicts different Virtel behavior when the browser receives the print data. Virtel provides support for PCL data print controls streams embedded within SCS using the SCS x’35’ command order. Virtel performs no conversion on SCS data streams but instead just saves the raw data to disk as a PCL file. PCL to PDF conversion using external services such as a third party server or conversion product are available through Virtel’s scenario API.

In the following printer examples we look at various configuration and supported features.

Example 1 – 3270 data stream printing

Virtel Configuration.

In this example we have configured the Virtel display terminal REHVT000 and its associate relay printer terminal REHIP000 with the following characteristics.

image0

Fig. 1 - Terminal Display

Display REHVT000 has an associate relay of REHIP000 which is defined as a Type = P. Type = P indicates that this is a dynamically allocated printer LU, supporting 3270 data streams. Both the display and printer LUs belong to the *W2HPOOL of terminals. The non-dynamic alternative is to specify TYPE=2 which means Virtel will allocate the printer terminal LU at start up.

CICS configuration.

In CICS we have defined the following terminal definitions. EHT0 representing the display LU REHVT000 and EHS0 representing the printer LU REHIP000.

image1

Fig. 2 -CICS Display definition

image2

Fig. 3 - CICS Printer Definition

Note that the characteristics for each device is determined by the TYpeterm association. For the printer we are using a user defined Typeterm called IMP3270P.

image3

Fig. 4 - CICS Typeterm definition for the printer

Within the Typeterm definition the following Operation properties are set to enable dynamic printer acquirement and release with CICS. The Typeterm definition is also associated with a Device type of 3270P.

image4

Fig. 5 - CICS Printer Operational Properties

The CICS application we use is a simple customer inquiry application which has a print facility. Logging onto the application using Virtel produces the following messages in the Virtel log.

VIRHT51I HTTP-CLI CONNECTING CLVTA079 TO 192.168.092.056:49318
VIR0919I CLVTA079 RELAY REHVT000(W2HTP000) ACTIVATED
VIR0919I CLVTA079 RELAY REHIP000(W2HIP000) ACTIVATED

Message VIRHT51I represents the browser connecting our workstation to Virtel’s HTTP engine on IP address 192.168.092.056. The two VIR0919I messages relate to Virtel activating two VTAM applications that will represent the 3270 display (REHVT000) and printer (REHIP000) to CICS. The Virtel CICS logon screen looks like this with the Virtel associated LUs displayed in the bottom right corner.

image5

Fig. 6 - Logging onto CICS

After logging onto CICS we access the application by entering the transaction id MENU. This displays a menu list of available options with the CICS application.

image6

Fig. 7 -CICS Application Menu

Option 1 is selected to bring up the customer inquiry panel and then a customer number is entered to bring up the relevant customer detail.

image7

Fig. 8 - Application inquiry display

PF9 is selected to trigger a print operation. A small print ICON box appears in the Virtel tool bar on the right hand side and a message appears in the application notification area indicating that a print request has been sent to printed id EHS0.

image8

Fig. 9 - Print request acknowledgment

If we look at the Virtel log we can see the following messages.

VIR0906I SPCICST CONNECTING LUTYPE 00 PRINTER W2HIP000(REHIP000) TO CLVTA079

This indicates that Virtel has received the 3270 print data stream from CICS. Pressing the Virtel Printer ICON will open and trigger the browser to display the printer template that Virtel has created within another browser window.

Note that no pagination and minimal formatting takes place in this print mode.

image9

Fig. 10 - Virtel printo output display

If we right click and view the source of this template we can see that Virtel has imbedded pagination tags as required by the CICS transaction. We can see a page-break-after:always style control associated with a HTML DIV tag. This will control the pagination when we request a print of the document.

image10

Fig. 11 - Virtel inserted print formatting controls

Closing this browser window and then right click and print on the printer template display will drive the browser printer interface. From here the printer window will open and we can print the document. The document is available to print and consists of 3 pages which is what we would expect. At this point we can of course print the document of even save it as a PDF.

image11

Fig. 12 - Browser Print Window

One we have processed the document the browser window will close and we are returned to the application display. Pressing enter will clear the print ICON and print message.

image12

Fig. 13 - Pressing enter to clear print request

Sharing Virtel printers

It will often be the case that a Virtel printer will be required to be shared by 3270 applications. Although CICS has acquired the printer in the above example another separate application can request that CICS release the printer so that it can send a print to it. In the following example we demonstrate GDDM’s ADMPRINT program sending a print to the REHIP000 printer. The printer terminal state within CICS look like this after completing the print request in the CICS application.

image13

Fig. 14 - CICS Printer State after printing in CICS

From within TSO we issue the following commands to drive a GDDM print request towards REHIP000.

# Allocate the GDDM print queue.

alloc f(ADMPRNTQ) DA(REQUEST.QUEUE) SHR REUSE

# Send a print request.

Call 'gddm.sadmmod(admoprt)' 'gddm.smallprt on rehip000'

Once GDDM determines that there is a pending print request in the queue it allocates a session with the Virtel printer LU REHIP000 and sends the output to the printer LU. In our CICS session we again see the ICON appear in the tool bar, but in this case there is no CICS message indicating a CICS print request. This is because this request has come from GDDM and not CICS.

image14

Fig. 15 - Printer Sharing

In the Virtel log we can see the following messages. This time it is application GDDMPRTS that is connecting to the printer and not SPCICST.

VIRT906I HTTP-CLI SOCKET 00020000 CALL FROM 192.168.092.056:49408
VIR0906I GDDMPRTS CONNECTING LUTYPE 00 PRINTER W2HIP000(REHIP000) TO CLVTA079

If we process the print request by selecting the print request ICON, Virtel will open a new browser window and display the print template. Within this window we can right click and select print. This will trigger the browser’s printer support and enable the document to be processed. Once the print is processed we can close the print browser template display and press enter on the CICS application display to indicate that the print request has been processed. This action will clear the printer ICON from the tool bar display. If we press PF9 again whilst in the CICS Inquiry menu the Print ICON will again appear indicating that a print request is available. This demonstrates that following the GDDM print, CICS has re-acquired the printer LU and can process further print requests. A Virtel printer LU can be serviced and shared by other applications.

Example 2 - SCS printing and PCL.

Any SCS data stream requires a Virtel input scenario to process the print request. Virtel will detect a SCS print request type and will attempt to associate a scenario with that request. Normally, SCS printing is associated with data streams that have transparent PCL commands embedded within the data. This, however, may not always be the case as shown in this example. 3270 print orders can also be handled as part of a SCS data streams. In this example we will use the same source data as in the previous example but this time using a SCS destination printer.

The difference in Virtel behaviour between 3270 printing and SCS printing is that in 3270 printing Virtel will open a new browser window and convert the data to a HTML template. In SCS printing the data is saved in its raw format on disk without any Virtel conversion.

If there is a mismatch between the CICS table definitions and Virtel then the print request will more than likely fail. For example in the following scenario we have modified CICS so that printer EHS0 is now a SCS printer. We did this by executing the following CICS commands.

  1. Change the TypeTerm definition from IMP3270P to SCS on the CICS EHS0 terminal definition.

  2. Place EHS0 out of service.

  3. Install EHS0.

When will select PF9 from the CICS application Virtel pops up a box which indicates a print failure. Note that different printer ICON. This indicates a SCS print.

image15

Fig. 16 - Failed SCS print request

If we look into the Virtel log we can see the following messages.

VIR0906I SPCICST CONNECTING LUTYPE 01 PRINTER W2HIP000(REHIP000) TO CLVTA079
VIRC122E ERROR CLVTA079 IS SENDING A SCENARIO PF KEY BUT SCENARIO IS
MISSING IN TRANSACTION 'CLI-10 ' ENTRY POINT 'CLIWHOST'

Virtel has detected that the print data stream is SCS (LU Type 1) and that it is connecting this print request to the printer REHIP000 which is still defined as a 3270 printer in Virtel (Type=P) and not a SCS printer (Type=S).

If we look at the Virtel Transaction CLI-10 we can see the following display.

image16

Fig. 17 - Transaction with no input scenario

We can see that no input scenario is associated this application. SCS printing will require a scenario. Three scenarios are available:-

  1. SCENFPDF Converts SCS data stream into PDF document.

  2. SCENFPCL Downloads raw data as a file.

  3. SCENPPDF Sends SCS data to external server to be converted to a PDF. PDF file is returned to Virtel as an attachment.

Attaching SCENFPCL as an input scenario to the CICS transaction will enable Virtel to process the print request sent by CICS. We update our Virtel transaction definition and add the scenario SCENFPCL.

image17

Fig. 18 - Transaction with input scenario

After restarting Virtel and repeating the print request we are presented with a dialog box which enables us to save the raw print data stream to a file of file type PCL.

image18

Fig. 19 - Successful print with SCS

In the Virtel log we can see the following messages.

VIR0906I SPCICST CONNECTING LUTYPE 01 PRINTER W2HIP000(REHIP000) TO CLVTA079
VIRT922W HTTP-CLI SOCKET 00010000 ENDED FOR 192.168.092.056:49920
VIRT906I HTTP-CLI SOCKET 00020000 CALL FROM 192.168.092.056:49938
APPLHOLT CLVTA079 REHIP000 SCENFPCL DELIVERED DOCUMENT REHIP000-20160510 135830 TO TERMINAL

If we open the downloaded PCL file with an editor we have the following. Again the pagination will not be respected until we print the file but Virtel will insert the correct print orders so that the document prints correctly.

image19

Fig. 20 - SCS Print file

Correcting the Virtel definitions for SCS printing

Although Virtel is intelligent enough to determine that it is receiving a SCS data stream and overrides the original printer definition for REHIP000 (LU Type 0) we should correct the Virtel definitions so that the correct type of printer is defined. In this case a SCS printer type rather than the overridden 3270 printer type. In Virtel SCS printer types are defined as TYPE=S. We update the terminal definition (REHVT000) to associate it with a SCS printer REHIM000. The terminal display now looks like this.

image20

Fig. 21 - Defining a Virtel SCS printer terminal

We also have to correct the CICS definition so that the terminal EHS0 is associated with the Virtel printer definition REHIM000. We use CEDA to alter and reinstall the terminal. Here is the new CICS table definition.

image21

We put the CICS printer EHS0 out of service and then re-install so that the correct LU name is picked up. A CICS CEMT display now shows this for CICS terminal EHS0.

image22

After updating the terminal definitions and logging onto CICS we can now see that the display terminal is associated with Virtel printer relay REHIM000, a Virtel SCS printer. See the bottom right corner.

image23

Pressing PF9 initiates a print request as before but this time to the Virtel LU printer definition REHIM000 which is correctly defined to Virtel as a SCS printer.

Virtel Auto-Print Option

For 3270 printing, Virtel has an auto-print settings option.

image24

Fig. 22 - Auto Print Option

When selected this has the effect of automatically opening the browsers printer support window after receiving a print request. You do not have to right click “print” in the printer template window.

image25