Generating an SCS data stream

To generate spooled files that will print on certain printers attached to the server, an SNA Character Stream (SCS) data stream must be created. (SCS is a text-based, EBCDIC data stream that can be printed on SCS printers, IPDS™ printers, or to PC printers.) SCS can be printed by converting it using an emulator or the host print transform on the server.

You can use the SCS writer classes to generate such an SCS data stream. The SCS writer classes convert Java™ Unicode characters and formatting options into an SCS data stream. Five SCS writer classes generate varying levels of SCS data streams. The caller chooses the writer that matches the final printer destination to which the caller or end user will be printing.

Use the following SCS writer classes to generate an SCS printer data stream:

SCS writer class Description
SCS5256Writer The simplest SCS writer class. Supports text, carriage return, line feed, new line, form feed, absolute horizontal and vertical positioning, relative horizontal and vertical positioning, and set vertical format.
SCS5224Writer Extends the 5256 writer and adds methods to set character per inch (CPI) and lines per inch (LPI).
SCS5219Writer Extends the 5224 writer and adds support for left margin, underline, form type (paper or envelope), form size, print quality, code page, character set, source drawer number, and destination drawer number.
SCS5553Writer Extends the 5219 writer and adds support for character rotation, grid lines, and font scaling. The 5553 is a double-byte character set (DBCS) data stream.
SCS3812Writer Extends the 5219 writer and adds support for bold, duplex, text orientation, and fonts.

To construct an SCS writer, the caller needs an output stream and, optionally, an encoding. The data stream is written to the output stream. To create an SCS spooled file, the caller first constructs a SpooledFileOutputStream, and then uses that to construct an SCS writer object. The encoding parameter gives a target EBCDIC coded character set identifier (CCSID) to convert the characters to.

Once the writer is constructed, use the write() methods to output text. Use the carriageReturn(), lineFeed(), and newLine() methods to position the write cursor on the page. Use the endPage() method to end the current page and start a new page.

When all of the data has been written, use the close() method to end the data stream and close the output stream.

Example

The following example shows how to generate a SCS data stream using the SCS3812Writer class, and how to write the stream to a spooled file on the server:

Example: Creating SCS spooled files