QUIP Software Logo

This example uses QGEN to convert an IBM mainframe printer file to a format that can be sent to a PC printer.

On the mainframe, text is sent to the printer one line at a time. The first character of each line is used for carriage control, that is, to indicate whether to skip any lines or to the top of the next page. 

Unlike the PC, Mac or Unix world, which use ASCII characters, mainframes use EBCDIC, and there are no end of line markers. Since the standard print width is 132 characters, each line of the printer file consists of exactly 133 characters, beginning with the carriage control character.

The following specs handle double and triple spacing and page skips, but overprinting (carriage control = "+") is ignored, since the effect depends on the physical device the file will be sent to.

* MFPR2PC1.QGS - 03-18-01 - Rev.00 - Mainframe print file converter
* ---------------------------------------------------------------------
* Converts an EBCDIC print file from a mainframe for printing on a PC.
* Output is ASCII text with form feeds inserted for page skips.
* Double, triple spacing are preserved, overprinting (CC = +) is not.

* Change the file names as needed for INTAP and OUTAP,
* or use command line parameters to pass them to QGEN.

* Input file is fixed length 133, for carriage control + 132 characters,
* change if print width is different (don't forget the carriage control).


* Output file is variable width, so trailing blanks will be dropped.
* Maximum width (not including the CR-LF end-of line marker) remains 133
* because lines that begin a new page are preceded by a form feed character.




  140        eta  1c1                             Carriage control character

  wrt        and  140c1@'0;-'                     Add line for double space
  wrt        and  140c1@'-'                       Add another for triple space
  skpFF      and  140c1@'1'                       New page - skip to FF

  141        eta  2c132                           Convert line text to ASCII
  skpEND     all                                  Skip over FF routine

_FF_         nop                        New page routine - insert form feed

  141r       add  k12                             Put form feed at beginning
  142        eta  2c132                           Convert line text to ASCII
  z1'1'      all                                  Count page skips


Change the input and output filenames as appropriate and run with QGEN.  For greater flexibility, change the INTAP and OUTAP statements to receive command line parameters and set up a batch file to pass it the file names.