Deckmate — A Punched Card Deck's Best Mate

GNU Unifont
Unicode Tutorial
Hangul Fonts
Japanese Fonts
Retro Fonts
Fontforge Poll
Checking .sigs

Pretty Printing Fixed Format Punched Card Decks

The deckmate package prints old fixed-format 80-column program listings (historically from punched card decks, hence the name) and 132-column line printer printouts on simulated line printer paper output as a PostScript file. Language-specific field separators are marked in the printout. The program optionally will mark fields with user-specified dashed gray lines. The popular ps2pdf utility can convert these PostScript output files to PDF.

The default printout provides column numbers from 01 to 80 or 132 across the top of each page, with 6 white lines of listing followed by alternating three line groups of green and white lines, as on old line printer paper. The green striped lines can be customized to a different color, including white for a plain white background.

Printout options for COBOL, FORTRAN, and Report Program Generator (RPG) have dashed and solid vertical lines in a listing to mark fields in early fixed-format versions of those languages. COBOL programs also show a dashed vertical line at the Margin B boundary.

COBOL, FORTRAN, and RPG program lines with anything other than spaces or a single decimal number in the first five columns are treated as IBM or CDC NOS Job Control Language (JCL) and do not show solid vertical field separator lines between fields. The "DD=" option also allows specification of an IBM Data Definition JCL ddname that begins data set input, at which point no further vertical field separators for COBOL, FORTRAN, or RPG will appear. This allows language-specific field delimeters in those three languages to show while not interfering with program input data having different field boundaries.

deckmate also accepts an option to output dashed gray lines at user-specified columns for other languages (such as assembler) and to separate fields in fixed-format data sets.

RPG still uses fixed-format statements with field boundaries dependent upon each statement type, which maintains some modern relevance to these old languages.

Files that use FORTRAN carriage control characters in the first column support overstriking. If a letter is overstruck over the same letter that appeared in the preceding non-overstruck line, it will appear in boldface.

The default font for listings is the built-in Type 1 Courier PostScript font. Three alternatives for listing font can be selected: Cardpunch, DOTwriter, and DOTwriterAPL. The DOTwriterAPL font implements the ISO-IR-68 APL encoding. See http://unifoundry.com/retro/ for details.

Example — COBOL with IBM 370 JCL


Jay Moseley kindly gave permission for this example of an IBM 370 COBOL Report Writer program that includes IBM JCL. This shows the PostScript output of deckmate converted to a PDF file with the ps2pdf utility. Note the dashed gray line at column 12 to mark the start of COBOL Margin B, and lines following the line beginning with IBM JCL Data Definition line starting with "//GO.DATAIN" no longer show COBOL vertical field separators. Copyright © 2008 Jay Moseley. The commands to generate this file's PostScript and final PDF are:

     deckmate -i JRWEX01.CBL -o jrwex01.ps -l cobol DD=GO.DATAIN
     ps2pdf jrwex01.ps

Here are the input source file and the PDF final output:

Example — FORTRAN IV


This is the very first FORTRAN program I wrote that did anything non-trivial, using Digital Equipment Corporation's RT-11 FORTRAN IV compiler. Amazingly, this code still compiles with the GNU gfortran compiler 40+ years later. Note how the FORTRAN continuation column, column 6, is not ruled within the comment line in the final output to provide additional clarity. Copyright © 1977, 2020 Paul Hardy. The commands to generate this file's PostScript and final PDF are:

        deckmate -i PRIME.FOR -o prime.ps -l fortran
        ps2pdf prime.ps

Here are the input source file and the PDF final output:

Example — ISO-IR-68 APL


This program modifies a sample prime number program from Wikipedia to generate the same range of prime numbers between 11 and 50 as the FORTRAN IV program above. With APL, one program line replaces many lines of FORTRAN. When the DOTwriterAPL font is selected, unrecognized characters are printed as the APL "squish quad" symbol. Copyright © 2020 Wikpedia and Paul Hardy. The commands to generate this file's PostScript and final PDF are:

        deckmate -i PRIMES.APL -o aplprimes.ps -F DOTwriterAPL
        ps2pdf aplprimes.ps

Here are the input source file, PDF final output, and ISO-IR-68 encoding:

Example — RPG


Jay Moseley also wrote this RPG program. RPG uses fixed format input with different field locations depending upon the type of RPG program statement. This listing includes RPG Header, File Description, Extension, Line Counter, Input, Calculation, and Output form types. Note that comment lines do not include vertical markings for separate fields, for additional clarity. Copyright © 2015 Jay Moseley. The commands to generate this file's PostScript and final PDF are:

        deckmate -i EXAMP8.RPG -o examp8.ps -l rpg
        ps2pdf examp8.ps

Here are the input source file and the PDF final output:

Example — IBM 370 Assembler


Jay Moseley wrote this IBM 370 assembler program. deckmate does not have a special mode for marking field boundaries in IBM mainframe assembler listings. For such cases, column boundaries for drawing dashed vertical gray lines can be provided on the command line; here the "-t 10,16,72" option adds dashed vertical gray lines down the start of columns 10, 16, and 72. Copyright © 1996, 1997, 1998, 1999, 2000 Jay Moseley. The commands to generate this file's PostScript and final PDF are:

        deckmate -i IFMTFILL.ALC -o ifmtfill.ps -t 10,16,72
        ps2pdf ifmtfill.ps

Here are the input source file and the PDF final output:

Example — 132-Column Output (PDP-11 Assembler Output)


The "-w" option produces a "wide" output in landscape mode. This is suitable for many types of line printer output. Here is an example of printing the 132-column output from the PDP-11 RT-11 MACRO-11 assembler. It was created with these commands:

        deckmate -i BOOTRL.LST -o bootrl-lst.ps -w -t 9,17,25,33,41,49,57,73,121
        ps2pdf bootrl-lst.ps

Here are the input source file and the PDF final output. Note: the BOOTRL.LST file is ASCII, but your browser might not recognize it as such — it begins with a Carriage Return character with no Line Feed, and ends with trailing nulls that the RT-11 MACRO-11 assembler generated when creating the file. deckmate handles such input properly:

Example — Overprinting and Boldface


A text file that contains backspaces will overprint the preceding character. If the current character is the same as the character that preceded the backspace, it will be printed as boldface. It was created with these commands:

        deckmate -i OVERPRINT.TXT -o overprint.ps
        ps2pdf overprint.ps

Here are the input source file and the PDF final output.

Example — FORTRAN (ASA) Carriage Control


A text file with FORTRAN / ASA carriage control characters in column 1 will skip the desired number of lines. The '+' carriage control character will overstrike the preceding line. If the non-overprinting preceding line contains the same character, the result will be in boldface. The "-CC 3,7 option sets custom vertical carriage control line numbers for the printer's first two carriage control line positions to lines 3 and 7, respectively. It was created with these commands:

        deckmate -i FORCC.TXT -o forcc.ps -CC 3,7
        ps2pdf forcc.ps

Here are the input source file and the PDF final output.

Example — Changing Stripe Colors


The "-c" option allows specification of a Red,Green,Blue color triplet. The values are floating point PostScript values, each with a range of 0 (respective color component is completely off) to 1 (respective color component is completely on). Here is an example of a light blue stripe, using the RPG program EXAMP8.RPG from above. The commands to generate this file's PostScript and final PDF are:

        deckmate -i EXAMP8.RPG -o examp8-blue.ps -l rpg -c 0.8,.93,1
        ps2pdf examp8-blue.ps

The blue element, with a value of 1, is the only color component at full intensity. Here is the PDF final output:


To produce a completely white background, specify the option "-c 1,1,1".



The Unix-style man (manual) page for deckmate is avaiable at this link:



The source tarball and GnuPG signature file are at these links:

No punched cards were bent, folded, spindled, or mutilated in the creation of this software.

Installing Deckmate

Compiling the package requires a C compiler and the Unix make utility. To compile and install the Deckmate package on a system with a Unix-style command line interface (GNU/Linux, BSD, Mac OS X, Cygwin, etc.), type these commands in a terminal window:

     make check
     make install
     make clean

The "make check" command will run 15 tests using sample fixed-format program listings in COBOL, FORTRAN, RPG, IBM 370 assembler, and PDP-11 assembler that are in the "examples" directory.

The "make install" command might need to be run as "sudo make install" on your system. Following installation, a check of proper functioning of the installed package can be verified with the command:

     make installcheck

By default, the standalone program, deckmate, will be installed in "/usr/local/bin" and the man (manual) page will be installed in "/usr/local/share/man/man1". To override these defaults, see the detailed instructions in the INSTALL file in the source package.


The software on this site, unless otherwise noted, is released under the terms of the GNU General Public License (GNU GPL) version 2.0, or (at your option) a later version.

The deckmate source code is Copyright ©2020 Paul Hardy.

The Cardpunch, DOTwriter, and DOTwriterAPL fonts are Copyright ©2020 Paul Hardy and licensed under the SIL Open Font License (OFL) version 1.1. Any output files containing those embedded fonts thus are covered under the terms of embedded SIL OFL fonts.

See the AUTHORS file in the source package for full details.

Valid HTML 4.01 Transitional Valid CSS! Best Viewed with Any Browser