Using Non-CICS printers

Here are the steps to use a printer managed outside CICS®:

  1. Format your output in the manner required by the application or subsystem that controls the printer you wish to use.
  2. Deliver the output to the application or subsystem that controls the printer in the form required by that application.
  3. If necessary, notify that application that the output is ready for printing.

Formatting for non-CICS printers

For some printers managed outside CICS, you can format output with BMS, as we explain in Programming for non-CICS printers. However, for most printers, you need to meet the format requirements of the application that drives the printer. This may be the device format or an intermediate form dictated by the application. For conventional line printers, formatting is simply a matter of producing line images and, sometimes, adding carriage-control characters.

Non-CICS printers: Delivering the data

Print data is usually conveyed to an application outside of CICS by placing the data in an intermediate file, accessible to both CICS and the application. The type of file, as well as the format within the file, is dictated by the receiving application. It is usually one of those listed in the first column of Table 33. The second column of the table shows which groups of CICS commands you can use to create such data.

Table 33. Intermediate files for transferring print data to non-CICS printers
File type Methods for writing the data
Spool files CICS spool commands (SPOOLOPEN, SPOOLWRITE, etc.)
Transient data commands (WRITEQ TD)
Terminal control and BMS commands (SEND, SEND MAP, etc.)
BSAM CICS spool commands (SPOOLOPEN, SPOOLWRITE, etc.)
Transient data commands (WRITEQ TD)
VSAM CICS file control commands (WRITE)
DB2® EXEC SQL commands
IMS™ EXEC DLI commands or CALL DLI statements

Programming for non-CICS printers

If you are using VSAM, DB2, or IMS, the CICS application programming commands you can use are determined by the type of file you are using.

For BSAM and spool files, however, you have a choice. The CICS definition of the file (or its absence) determines which commands you use. The file may be:

Both transient data queue definitions and sequential terminal definitions point to an associated data definition (DD) statement in the CICS start-up JCL, and it is this DD statement that determines whether the file is a BSAM file or a spool file. Files created by CICS spool commands do not require definition before use and are spool files by definition.

If the printing application accepts BSAM or spool file input, there are several factors to consider in deciding how to define your file to CICS:

System definitions
Files created by the SPOOLOPEN command do not have to be defined to CICS or the operating system, whereas transient data queues and sequential terminals must be defined to both before use.
Sharing among tasks
A file defined as a transient data queue is shared among all tasks. This allows you to create a print file in multiple tasks, but it also means that if your task writes multiple records to the queue that must be printed together (lines of print for a single report, for example), you must include enqueue logic to prevent other tasks from writing their records between yours. This is the same requirement that was cited for intrapartition queues in Printing with transient data. In the case of extra-partition transient data, however, CICS does not offer the recoverability solution, and your program must prevent the interspersing itself.

In contrast, a file created by a SPOOLOPEN can be written only by the task that created it. This eliminates the danger of interleaving output, but also prevents sharing the file among tasks.

A spool file associated with a sequential terminal can be written by only one task at a time (the task that has the terminal as its principal facility). This also prevents interleaving, but allows tasks to share the file serially.

Release for printing
Both BSAM and spool files must be closed in order for the operating system to pass them from CICS to the receiving application, and therefore printing does not begin until the associated file is closed. Files created by SPOOLOPEN are closed automatically at task end, unless they have already been closed with a SPOOLCLOSE command. In contrast, an extrapartition transient data queue remains open until some task closes it explicitly, with a SET command. (It must be reopened with another SET if it is to be used subsequently.) So transient data gives you more control over release of the file for processing, at the cost of additional programming.

A file that represents the output of a sequential terminal does not get closed automatically (and so does not get released for printing) until CICS shutdown, and CICS does not provide facilities to close it earlier. If you use a sequential terminal to pass data to a printer controlled outside of CICS, as you might do in order to use BMS, you should be aware of this limitation.

Formatting
If you define your file as a sequential terminal, you can use BMS to format your output. This feature allows you to use the same maps for printers managed outside of CICS--for example, line printers managed by the MVS™ job entry subsystem (JES)--that you use for CICS display and printer terminals.

If you choose this option, remember that BMS always sends a page of output at a time, using the page size in the terminal definition, and that the data set representing the output from a sequential terminal is not released until CICS shutdown.

Spool file limits
Operating systems identify spool files by assigning a sequential number. There is an upper limit to this number, after which numbers are reused. The limit is usually very large, but it is possible for a job that runs a very long time (as CICS can) and creates a huge number of spool files (as an application under CICS can) to exceed the limit. If you are writing an application that generates a very large number of spool files, consult your systems programmer to ensure that you are within system limits. A new spool file is created at each SPOOLOPEN statement and each open of a transient data queue defined as a spool file.

Notifying the print application

When you deliver the data to a print application outside CICS, you might need to notify the application that you have data ready to process. You do not need to do this if the application runs automatically and knows to look for your data. For example, to print on a printer owned by the MVS job entry system (JES), all you need to do is create a spool file with the proper routing information. JES does the rest.

However, sometimes you need to submit a job to do the processing, or otherwise signal an executing application that you have work for it.

To submit a batch job from a CICS task, you need to create a spool file which contains the JCL for the job, and you need to direct this file to the JES internal reader. You can create the file in any of the three ways listed for spool files in Table 33, although if you use a sequential terminal, the job does not execute until CICS shuts down, as noted earlier. For files written with spool commands, the information that routes the file to the JES internal reader is specified in the SPOOLOPEN command. For transient data queues and sequential terminals, the routing information appears on the first record in the file, the "JOB card".

The output to be printed can be embedded in the batch job (as its input) or it can be passed separately through any form of data storage that the job accepts.

[[ Contents Previous Page | Next Page Index ]]