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.
- An extra-partition transient data queue (see Transient data control for information about transient data queues)
- The output half of a sequential terminal (see Using sequential terminal support and Support for non-3270 terminals )
- A spool file (see CICS interface to JES )
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.
- 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 later.) 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 typically large, but it is possible for a job that runs a 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 large number of spool files, consult your system 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.