|
SPOOLING MAINFRAME SAS/GRAPH OUTPUT TO ASCII PRINTERS
Abstract
Introduction
The root of the problem is that your IBM mainframe is an EBCDIC machine while your ASCII printer is indeed just that... ASCII. Data generated or stored on an IBM mainframe is usually in EBCDIC representation, but most non-IBM printers (including HP LaserJet printers) only support ASCII representation. What makes spooling of mainframe graphics output to ASCII printers a difficult task is making sure that a proper EBCDIC-to-ASCII translation takes place between the EBCDIC mainframe and the ASCII printer (or in certain situations, that no EBCDIC-to-ASCII translation takes place at all). You also have to ensure that any third-party software, such as mainframe spooling software or 3270 emulation software, does not add characters (such as carriage returns, line feeds, new line commands, etc.) to the graphics data stream. In many cases, any characters added to a graphics data stream will cause problems. The remainder of this article will discuss how to deal with these problems and incompatibilities and how to produce graphics output on your ASCII printer. Hardware Considerations
For the remainder of this article, the term "protocol converter" refers to the first two options mentioned while the term "PC-attached printer" refers to the last two options mentioned. For example, you use SAS/GRAPH the same way with an ASCII printer attached to a stand-alone protocol converter as you would an ASCII printer with a 3287-coax card. Software Considerations
If your printer is attached to a PC or LAN, another consideration is the software that you have running on the PC or LAN which allows you to define your printer as a mainframe printer. This software is typically either a 3270 emulation program (such as Attachmate Extra! for Windows) or some type of print spooling software (such as Novell's NetWare HostPrint software). Using SAS/GRAPH with a Protocol Converter
One important note to remember is that the protocol converter does not operate in hex transparency mode all of the time. If it did, you would not be able to send regular text reports to an ASCII printer attached to a protocol converter. Hex transparency mode is not necessary for text since there is a direct EBCDIC-to-ASCII translation for all printable text characters. This is not the case when the data stream contains unprintable characters. Note that an HP-PCL data stream contains many unprintable characters (such as the ASCII escape character). 3287-type protocol converters operate a majority of the time in regular text mode (doing a straight EBCDIC-to-ASCII translation). The converter only goes into hex transparency mode upon receiving a special sequence of starting trigger characters. It then continues to operate in hex transparency mode until it receives another special sequence of ending trigger characters. Upon receiving the ending trigger characters, the protocol converter resets back to text mode. When spooling mainframe SAS/GRAPH output to an ASCII printer which is attached to the mainframe via a protocol converter, it is important that there is a match between:
For example, assume that you want to send a PRINTER RESET character sequence to an HP LaserJet printer which is attached to the mainframe via a protocol converter. Also assume that the protocol converter has been configured to go into hex transparency mode upon receiving the starting trigger sequence of '%<' and to go back into text mode upon receiving the ending trigger sequence of '>%'. If you want to send a PRINTER RESET character sequence to the LaserJet, it normally would be an ASCII hex '1B45'x. The data stream that you would need to generate on the mainframe to send two bytes of ASCII hex '1B45'x data to the printer would be the four byte EBCDIC text string '1B45' imbedded between the starting and ending triggers characters like this: %< 1B45 >% Upon receiving the '%<' starting trigger sequence, the protocol converter will go into hex transparency mode. The converter, still in hex transparency mode, will read the first two bytes of EBCDIC data (1B) and will create a single byte of ASCII data ('1B'x) to send to the printer. The protocol converter then reads the next two bytes of EBCDIC data (45) and will create a single byte of ASCII data ('45'x) to send to the printer. The protocol converter will go back into text mode upon receiving the '>%' ending trigger sequence. SAS/GRAPH statements and parameters
filename gsasfile 'host_parameters';
goptions device = driver_name
gaccess = gsasfile
gprotocol = protocol_module
gsflen = gsf_length /* On MVS, gsf_length is typically */
/* either 80 or 128. On CMS, */
/* gsf_length is usually 64. */
gsfmode = replace
trantab = gtabcms; /* On MVS, specify trantab=gtabcms */
/* when driver_name is set to a */
/* PostScript device driver. */
title 'SAS/GRAPH Test';
proc gslide;
run; quit;
filename gsasfile clear;
Here are some details concerning the graphics options specified above:
identifies the SAS/GRAPH device driver for the particular printer or hardcopy device you are using. Here is a partial list of SAS/GRAPH device drivers for ASCII printers:
------------------------------------------------------------------------
| | |
| SAS/GRAPH | Supported |
| device driver | device(s) |
| | |
------------------------------------------------------------------------
| | |
| HPLJS2 | HP LaserJet Series 2 and compatibles (HP-PCL mode) |
| | |
------------------------------------------------------------------------
| | |
| HPLJS3 | HP LaserJet Series 3, 4, and 5 (HP-PCL mode) |
| | |
------------------------------------------------------------------------
| | |
| HPLJGL2 | HP LaserJet Series 3, 4, and 5 (HP-GL/2 mode) |
| | |
------------------------------------------------------------------------
| | |
| HPLJ3SI | HP LaserJet Series 3Si (HP-PCL mode) |
| | |
------------------------------------------------------------------------
| | |
| HPGL3SI | HP LaserJet Series 3Si (HP-GL/2 mode) |
| | |
------------------------------------------------------------------------
| | |
| LJ3SIPS | HP LaserJet Series 3Si (PostScript mode) |
| | |
------------------------------------------------------------------------
| | |
| LJ3SIPSL | HP LaserJet Series 3Si (PostScript mode, thin |
| | lines) |
| | |
------------------------------------------------------------------------
| | |
| PS300 | Any black and white or gray-scale PostScript |
| | printer (300 DPI) |
| | |
------------------------------------------------------------------------
| | |
| PSCOLOR | Any printer which supports color PostScript |
| | |
------------------------------------------------------------------------
| | |
| LJIV600 | HP LaserJet Series 4 and 5 (600 DPI in HP-PCL |
| | mode). Note that this driver is only available |
| | with Version 6.08 (TS420) and above |
| | |
------------------------------------------------------------------------
| | |
| LJIVPS | Any black and white or gray-scale PostScript |
| | printer which supports 600 DPI. Note that this |
| | driver is only available with Version 6.08 |
| | (TS420) and above |
| | |
------------------------------------------------------------------------
You can display a list of all SAS/GRAPH device drivers by submitting the following SAS program:
proc gdevice c=sashelp.devices nofs;
list _all_;
run;
quit;
GACCESS= specifies where the output from the device driver is sent. You can specify GACCESS=GSASFILE to direct output to the location referenced by the fileref GSASFILE. Note that the name of GSASFILE is a special name reserved by SAS/GRAPH for use with the GACCESS= graphics option. If you want to use a name other than GSASFILE, use the GSFNAME= graphics option instead of GACCESS=. The 'host_parameters' you specify on the FILENAME statement for GSASFILE will vary depending on your operating system and site-specific requirements. For direct spooling on MVS, the FILENAME statement for GSASFILE is typically coded as follows:
filename gsasfile sysout=sysout_class dest=printer_destination;
where 'sysout_class' is the SYSOUT class normally used to send regular text output to your printer and 'printer_destination' is the destination for your ASCII printer. On CMS, if you want to route the graphics data stream directly to a disk file, code the FILENAME statement for GSASFILE as follows: filename gsasfile 'filename filetype filemode'; If you want to route the graphics data stream directly to RSCS PRINT, add CMS SPOOL and TAG commands as follows: x cp spool prt to rscs noh cont; x cp tag dev prt printer_dest 50; filename gsasfile printer; GPROTOCOL= identifies the type of protocol converter to which the printer is attached (if at all). The GPROTOCOL= graphics option can also be used to specify how the graphics data stream is to be formatted. Here is a list of the valid values for the Version 6 GPROTOCOL= graphics option: ---------------------------------------------------------------------------- | | | | | Protocol | Protocol | Trigger characters | | Module | Converter(s) | | | | | | ---------------------------------------------------------------------------- | | | | | SASGPLCL | Andrew Corp, Local | Start: |^ (vertical bar followed | | | Data, KMW | by logical not sign) | | | | End: $ | | | | | ---------------------------------------------------------------------------- | | | | | SASGPAGL | AGILE | A cent sign followed by a count | | | | byte at the beginning of each | | | | record | | | | | ---------------------------------------------------------------------------- | | | | | SASGPISI | ISI, | A cent sign followed by a dollar | | | AGILE | sign at the beginning of each | | | | record | | | | | ---------------------------------------------------------------------------- | | | | | SASGPNET | I-DATA, | Start: &&??% %% | | | Netcommander, | End: % | | | various others | | | | | | ---------------------------------------------------------------------------- | | | | | SASGPDCA | DCA's IRMAprint, | Start: ^ (logical not) | | | IRMAprint II, | End: ^ (logical not) | | | QMS AFPlink, | | | | TEK 4512 | | | | | | ---------------------------------------------------------------------------- | | | | | SASGPVAT | Avatar | Start: broken vertical bar | | | | followed by a slanted | | | | single quote (hex '6A79') | | | | End: $ | | | | | ---------------------------------------------------------------------------- | | | | | SASGPIDX | IDEX | Start: `C2 (hex '79C3F2') | | | | | | | | End: ` (hex '79') | | | | | ---------------------------------------------------------------------------- | | | | | SASGPIDA | I-DATA | Start: &&??: | | | | | | | | After the starting trigger | | | | sequence, SASGPIDA formats the | | | | graphics data as straight EBCDIC | | | | except that it precedes each | | | | unprintable character in the | | | | data stream with a : | | | | | ---------------------------------------------------------------------------- | | | | | SASGPDAT | VII DATA | SASGPDAT formats the graphics data | | | | as straight EBCDIC except that it | | | | precedes each unprintable | | | | character in the data stream with | | | | a ^ (logical not sign) | | | | | ---------------------------------------------------------------------------- | | | | | SASGPAXI* | AXIS | Start: %< | | | | End: >% | | | | | ---------------------------------------------------------------------------- | | | | | SASGPIOC* | I/O Corp. | Start: &% | | | | End: &% | | | | | ---------------------------------------------------------------------------- | | | | | SASGPCAB* | Cablenet | Start: &% | | | | End: $ | | | | | ---------------------------------------------------------------------------- | | | | | SASGPCHK* | Cherokee | Start: %%-%% | | | | End: %%+%% | | | | | | | | SASGPCHK also places the string | | | | %% before and after each record | | | | in the GSF | | | | | ----------------------------------------------------------------------------* These protocol modules are only valid beginning with the Version 6.09 Enhanced (TS450) release of the SAS System. Several generic Version 6 protocol modules are available that format a graphics data stream that is not specific to any one protocol converter. These protocol modules are as follows: ---------------------------------------------------------------------------- | | | | Protocol | Description | | Module | | | | | ---------------------------------------------------------------------------- | | | | SASGPASC | Formats the graphics data stream in "straight" ASCII | | | format. | | | | ---------------------------------------------------------------------------- | | | | SASGPSTD | Formats the graphics data stream in "straight" EBCDIC | | | format. | | | | ---------------------------------------------------------------------------- | | | | SASGPSCS | Formats the graphics data stream in SCS transparency | | | mode. This mode is also known as hex '35' | | | transparency mode. Each record of graphics data | | | written out by SASGPSCS is the same as SASGPASC, except | | | that the SASGPSCS module writes a hex '35' in column | | | one of each record and writes a count byte (which does | | | not include the hex '35' or the count byte itself) in | | | column two of each record. | | | | ---------------------------------------------------------------------------- | | | | SASGPHEX | Formats the graphics data stream in hex transparency | | | mode, similar to the protocol modules available for | | | specific protocol converters except that SASGPHEX | | | does not write out any starting or ending trigger | | | characters. | | | | ---------------------------------------------------------------------------- GSFLEN= specifies the length of the records written to a printer or to a graphics stream file. When using one of the protocol modules specified above (except for SASGPASC, SASGPSTD, and SASGPSCS), the actual length of the records written to a printer or to a graphics stream file will be twice the value you specify for GSFLEN (since each byte of ASCII data is expanded to two bytes of EBCDIC data). For example, if you specify GPROTOCOL=SASGPLCL and you send the graphics data stream to RSCS PRINT (which limits the length of records to 132), set GSFLEN=64. Due to additional overhead required by SAS/GRAPH device drivers, it is recommended that you set the GSFLEN value low enough so that once it is multiplied by two, the result is still at least four bytes shorter than the record length of the actual GSF. GSFMODE= specifies how the graphics data stream is written. GSFMODE= should be either REPLACE (which replaces any data that has previously been written to a file) or APPEND (which appends the output to an existing file). When writing a graphics stream file to the JES spool (on MVS) or RSCS (on CMS), you get the same results with GSFMODE=REPLACE as you would with GSFMODE=APPEND. The only time there is a difference between REPLACE and APPEND is when writing the graphics data stream to a disk file. TRANTAB= specifies the SAS/GRAPH translate table that the device driver will use. In general, when running on the MVS operating system and using a PostScript device driver, specifying the CMS translate table (GTABCMS) enables the PostScript driver to utilize the correct ASCII values for left and right square bracket characters used by the PostScript language. Otherwise, do not specify the TRANTAB= graphics option. Using PC-attached ASCII printers
Note that SAS/GRAPH Software does not support direct spooling of mainframe graphics to PC-attached or LAN-attached ASCII printers. In many instances, problems arise because the graphics data stream produced by SAS/GRAPH gets modified or corrupted by another software product after the GSF is created but before it reaches the printer. In most situations, your best solution for having success when trying to directly spool mainframe graphics to PC-attached printers is to use GPROTOCOL=SASGPASC. This will cause the SAS/GRAPH driver to format the graphics data as straight ASCII data. You must then make sure that the graphics stream file is spooled to the printer in "ASCII passthrough" mode. Spooling the data in ASCII passthrough mode is the same as performing a binary download of an ASCII file on disk. In "ASCII passthrough" mode, the ASCII data is sent to the printer "as is", with no EBCDIC-to-ASCII conversion being done and no additional characters added to the data stream (such as carriage returns, line feeds, or new line commands). Creating a GSF suitable for downloading to a PC
Using SAS/GRAPH with VPS
filename gsasfile sysout = vps_transparency_class
dest = printer_dest;
goptions device = driver_name
gaccess = gsasfile
gprotocol = sasgpasc
gsflen = 80
gsfmode = replace;
title 'SAS/GRAPH Test';
proc gslide;
run; quit;
filename gsasfile clear;
For example, if you have defined the VPS parameter TRN CLASSES for your printer to be the SYSOUT class of T and the VPS destination for your ASCII printer is PRTHPLJ, code the FILENAME statement for GSASFILE as follows:
Here are some additional VPS parameters to be aware of. Note that any changes to VPS parameters are usually done by the VPS support person at your site. XLATE= By default, the XLATE (ie, printer translate) parameter in VPS is set to Y (for YES). This tells VPS to translate characters that would normally be unprintable on the mainframe to blanks. When attempting to spool straight EBCDIC graphics data or straight ASCII graphics data with VPS, you typically need to set the XLATE parameter to N (for NO). This will prevent VPS from translating unprintable characters to blanks. NCC SPACE= If the VPS parameter NCC SPACE is set to a non-zero value, VPS may insert CR (carriage return) and/or LF (line feed) commands into the graphics data stream. In certain situations, such as attempting to spool an HP-PCL data stream in straight ASCII format, these additional CR/LF commands can cause problems. To prevent VPS from inserting these additional CR/LF commands into the data stream, set the NCC SPACE parameter to 0 (zero). AUTONL= In certain situations, VPS may insert NL (new line) commands into the data stream that it spools to an ASCII printer. Once again, the insertion of NL commands into the graphics data stream may cause problems once the graphics data stream reaches the printer. To prevent VPS from inserting NL commands into the data stream, set the AUTONL parameter in VPS to a value of YES. If you set AUTONL to YES, VPS assumes that the printer will handle the new line character itself, and will not insert NL commands into the data stream. TRAIL BLANK= By default, VPS will normally truncate blanks (hex '40') if those blanks are found at the end of a data line VPS is spooling to a printer. This action by VPS may cause problems when spooling an HP-PCL data stream to an ASCII printer and the HP-PCL data stream contains one or more hex '40' characters at the end of a record. To prevent VPS from truncating trailing blanks, set the VPS parameter TRAIL BLANK to YES. Conclusion Directly spooling mainframe graphics to ASCII printers can be a difficult process. When attempting to do this for the very first time, your best plan of action is to gather as much information about your configuration as possible. Here are some of the issues you will need to resolve:
SAS, SAS/GRAPH, and Observations are registered trademarks or trademarks of
SAS Institute, Inc.
|