Example: Print font samples

The following information contains instructions and source code that allow you to print a font global identifier (FGID), font character set, or coded font and see what it looks like. The source code provided is data description specifications (DDS), which can be used with the following high-level languages:

Notes:
  1. Read the Code disclaimer information for important legal information.
  2. These sample programs work only with printers configured as AFP(*YES).
  3. See AFP compatibility fonts and font substitution for the names of FGIDs, font character sets, and coded fonts.

Use the following instructions to print a font global identifier (FGID), font character set, or coded font and see what it looks like. If you need assistance with any of the CL commands, use the F4 (Prompt) key and then press the Help key on any of the parameters.

  1. Create a library to contain the objects needed to print the font samples. In this example, the library is named FONTSAMPLE.
    CRTLIB FONTSAMPLE
  2. Add FONTSAMPLE to your library list.
    ADDLIBLE FONTSAMPLE
  3. Create a source physical file in FONTSAMPLE to contain your source code. In this example the source file is named SOURCE.
    CRTSRCPF FONTSAMPLE/SOURCE
  4. Add a member named FONT to that physical file. This member is used for entering the source code for the printer file.
    ADDPFM FILE(FONTSAMPLE/SOURCE) MBR(FONT)
  5. Edit the member FONT with the source entry utility (SEU).
    STRSEU SRCFILE(FONTSAMPLE/SOURCE) SRCMBR(FONT) TYPE(PRTF)

    Type the DDS source code (shown in DDS source code) for the printer file. Edit the DDS source and insert the correct font identifier or name. When you are done, press F3 to exit.

  6. Create the printer file from the DDS source you just typed in.
    CRTPRTF FILE(FONTSAMPLE/FONT) SRCFILE(FONTSAMPLE/SOURCE) SRCMBR(FONT)
    DEVTYPE(*AFPDS)
  7. Choose the high-level language you will be using to produce printed output. The compiler for the high-level language you choose must be installed on your system. Samples are given for C, RPG, and COBOL. Add a member to the physical file SOURCE. Use one of the following names depending on which language you choose:
    ADDPFM FILE(FONTSAMPLE/SOURCE) MBR(CCODE, COBOLCODE, or RPGCODE)
  8. Edit the member (CCODE, COBOLCODE, or RPGCODE) with source entry utility (SEU). Type the command that corresponds to the high-level language you are using.
    C:
    STRSEU SRCFILE(FONTSAMPLE/SOURCE) SRCMBR(CCODE) TYPE(C)
    RPG:
    STRSEU SRCFILE(FONTSAMPLE/SOURCE) SRCMBR(RPGCODE) TYPE(RPG)
    COBOL:
    STRSEU SRCFILE(FONTSAMPLE/SOURCE) SRCMBR(COBOLCODE) TYPE(CBL)
  9. Type the program source for one of the languages:

    When you are done, press F3 to exit.

  10. Create the program, using the command below that corresponds to the language you chose:
    C:
    CRTCPGM PGM(FONTSAMPLE/CPGM) SRCFILE(FONTSAMPLE/SOURCE) SRCMBR(CCODE)
    RPG:
    CRTRPGPGM PGM(FONTSAMPLE/RPGPGM) SRCFILE(FONTSAMPLE/SOURCE SRCMBR(RPGCODE)
    COBOL:
    CRTCBLPGM PGM(FONTSAMPLE/CBLPGM) SRCFILE(FONTSAMPLE/SOURCE) SRCMBR(COBOLCODE)
  11. Call the program that corresponds to the language you chose:
    C:
    Call CPGM
    RPG:
    Call RPGPGM
    COBOL:
    Call CBLPGM

The output from the program is sent to a spooled file named FONT. You cannot view the spooled file until it prints.