Working With PostScript and PDF Reports

In this section:

Reference:

FOCUS generates a PDF or PS document from scratch. In order to do so, it must physically embed all the objects it displays or prints, including images and fonts, in the document itself.

When you execute a report request and specify PDF or PS as your format, FOCUS retrieves the data and begins to format the report. Fonts and images specified in the StyleSheet must be available to create the output file. FOCUS reads the font information from font files and embeds that information in the document.

To ensure that FOCUS can locate the required information, you must define and map it in the following files:


Top of page

x
Reference: Required Files and DDNAMES

When you produce a PostScript or PDF report, you need the following files:

Name

Purpose

z/OS

CMS

StyleSheet files. You can create them with a text editor (see Styling Reports).

Define the styles in reports.

Any member of the PDS allocated to ddname FOCSTYLE.

File type FOCSTYLE, any file name

Adobe Font Metrics (AFM) files (supplied with FOCUS).

Define the measurements of characters for PostScript and PDF output.

Member names start with PS. Allocated to ddname ERRORS.

File type AFM, any file name

Font location file (supplied with FOCUS).

Maps font names to the Font Metrics files.

Member PSCRIPT (for PostScript) or PDF (for PDF) in the PDS allocated to ddname ERRORS.

File name PSCRIPT (for PostScript) or PDF (for PDF), File type FOCFTMAP

Output files. You create these with a HOLD, SAVE, or SET command.

Contain the formatted output.

DDNAME is HOLD or the AS name assigned in the HOLD command.

File type PS or PDF, any file name

Note that if you add fonts, you also need PFA or PFB files for those fonts.



x
Creating Compound PDF or PostScript Reports

How to:

Compound reports combine multiple reports into a single PDF or PS file. This enables you to concatenate reports with styled formats (such as PDF, HTML, PS, or EXL2K). You can also embed image files in a compound report.

The first PDF or PS report defines the format for the concatenated report, enabling you to intersperse intermediate reports in other formats into one encompassing report. Using compound reports, you can gather data from different data sources and combine reports into one governing report that runs each request and concatenates the output into a single PDF or PS file.



x
Syntax: How to Display Compound Reports

For a compound report that may contain different report types, use the syntax

SET COMPOUND= {OPEN|CLOSE} [NOBREAK]

or

ON TABLE SET COMPOUND {OPEN|CLOSE} 

Note that when you are using this syntax, you must also include the following code to identify the display format of each of the reports to be concatenated:

ON TABLE {HOLD|SAVE} [AS name] FORMAT formatname

If all of the reports in the compound set are of the same type, either PDF or PS, you can use the following, more compact, syntax

ON TABLE {HOLD|SAVE} [AS name] FORMAT {PDF|PS} {OPEN|CLOSE} [NOBREAK]

where:

name

Is the name of the generated file. The name is taken from the first request in the compound report. If no name is specified in the first report, the name HOLD is used.

OPEN

Is specified with the first report, and begins the concatenation process. A report that contains the OPEN attribute must be PDF or PS format.

CLOSE

Is specified with the last report, and ends the concatenation process.

NOBREAK

Is an optional phrase that suppresses page breaks. By default, each report is displayed on a separate page.

You can use NOBREAK selectively in a request to control which reports are displayed on the same page.

Note:



Example: Creating a Compound PDF Report

The following illustrates how to combine three separate PDF reports into one by creating a compound report. Notice that:

These reports are all set to PDF format. When creating compound reports, however, only the first must be in either PDF or PS format; the rest can be in any styled format.

Report 1:

SET PAGE-NUM=OFF
TABLE FILE CENTORD
HEADING
"Sales Report"
" "
SUM LINEPRICE
BY PRODCAT
ON TABLE SET STYLE *
TYPE=HEADING, SIZE=18, $
ENDSTYLE
ON TABLE HOLD FORMAT PDF OPEN NOBREAK
END

Report 2:

TABLE FILE CENTORD
HEADING
"Inventory Report"
" "
SUM QUANTITY
BY PRODCAT
ON TABLE SET STYLE *
TYPE=HEADING, SIZE=18, $
ENDSTYLE
ON TABLE HOLD FORMAT PDF NOBREAK
END

Report 3:

TABLE FILE CENTORD
HEADING
"Cost of Goods Sold Report"
" "
SUM LINE_COGS
BY PRODCAT
ON TABLE SET STYLE *
TYPE=HEADING, SIZE=18, $
ENDSTYLE
ON TABLE HOLD FORMAT PDF CLOSE
END

The output appears as a PDF report. Because the syntax for reports 1 and 2 contain the NOBREAK command, all three reports appear on a single page. (Without NOBREAK, each report would appear on a separate page.)


Top of page

x
Adding PostScript Type 1 Fonts for PS and PDF Formats

How to:

Reference:

You can add and configure PostScript Type 1 fonts to significantly expand your options for displaying and printing PS and PDF reports, beyond those provided by the basic set of fonts distributed with Adobe Acrobat Reader. Thousands of PostScript fonts are available to make your reports more stylish and useful, including some that support symbols and bar codes.

Through a simple process, you can customize your environment to take advantage of these fonts.

You can also use a variety of utilities to convert Windows True Type fonts (such as Arial and Tahoma) into Type 1 fonts. Verify that you are licensed for this type of font use. Then, once converted, you can define and map these fonts for use by FOCUS.

One such utility is TTF2PT1.

For information about the Windows version, go to:

http://gnuwin32.sourceforge.net/packages/ttf2pt1.htm


x
Reference: Support for the Symbol Font

To use the Symbol font, specify font=symbol in your FOCUS StyleSheet:



x
Procedure: How to Configure Type 1 Postscript Fonts

Once you have located the font files you wish to add, you can set up FOCUS to use one or more Type 1 fonts.

  1. Copy the AFM file into the ERRORS data set on z/OS (or into a PDS with the same DCB attributes that's concatenated to it). On z/VM, copy the AFM file to a file with FILETYPE ERRORS.

    Note that some of the comment lines may be truncated to 80 characters; this will not affect processing.

    You can copy this file using FTP from Windows (in standard ASCII mode). The member name in the PDS or file name on VM should match the METRICSFILE name in the font map file.

  2. You can use either PFB (binary) fonts or PFA (ASCII) fonts:
    • If you're using PFB (binary) fonts, create a partitioned data set on z/OS, put the PFB file in it (for example, using FTP in BINARY mode), and allocate this to DDNAME PFB. On VM, store it in a file with FILETYPE PFB.

      The PDS should be created with the following DCB attributes:

      RECFM: FB    LRECL: 1024    BLKSIZE: 27648

      The member name on z/OS or the file name on z/VM should match the FONTFILE name in the font map file. For example, PREFIX.PFBFILES.DATA(OCRA).

    • If you're using PFA (ASCII) font files on z/OS, create a PDS, put the PFA file in it (for example, using FTP in ASCII mode), and allocate this to DDNAME PFA. On VM, store it in a file with FILETYPE PFA. The PDS should be created with the following DCB attributes:
      RECFM: VB    LRECL: 516    BLKSIZE: 27998

      The member name in the PDS or the file name on VM should match the FONTFILE name in the font map file. For example, PREFIX.PFAFILES.DATA(OCRA).

    Note that you can use PFB and PFA files simultaneously. The three character file type in the font map file (PFB or PFA) tells FOCUS which PDS to search for the specified member name.

  3. Open the FOCUS font map file (on z/OS, members PDF or PSCRIPT in the PDS allocated to DDNAME ERRORS; on VM, file PSCRIPT ERRORS or PDF ERRORS) in a text editor.

    Note: If the Windows font file names contain underscore characters, you must rename them, since underscore characters are not valid in z/OS member names or VM file names. For example, if the Windows designation is font=garamond_light, z/OS references would be as follows:

    FONTFILENAME=garalt pdb *,
    METRICFILENAME= garalt afm*, $
  4. Add a separate declaration for each font and style. A line in the FOCUS font map file may not exceed 80 characters. You can break the line after any comma.

    The syntax is

    font=fontname, style=style, metricsfile=METRICSFILENAME AFM *, 
    fontfile=FONTFILENAME PFB *, $

    where:

    fontname

    Is the name of a Type 1 font. This name is used to reference the font in the FOCUS StyleSheet.

    style

    Is a font style. Normal is the default. This entry is used to reference the font style in the FOCUS StyleSheet.

    If you wish to specify font style variations (for example, bold, italic, bold-italic for a particular font), you must purchase the font files for those styles and create a separate entry for each one in the FOCUS font map file.

    METRICSFILENAME

    Maps the font to the name of the font metrics file. The name of the metrics file must be followed by a space, followed by AFM, followed by an asterisk (*).

    This entry must be in upper case and may not exceed 8 characters.

    FONTFILENAME

    Maps the font to the name of the font file. The name of the font file must be followed by a space, followed by PFB (or PFA), followed by asterisk (*).

    The entry must be in upper case and may not exceed 8 characters.

    Tip: If you are familiar with FOCUS StyleSheets, notice that the syntax of these files is similar. Lines can be continued after a comma and statements are terminated by a comma and dollar sign (,$).



Example: FOCUS Font Map File Entries for PDF

Initially, this file contains mappings for the default fonts delivered with Adobe Acrobat Reader. These core Type 1 fonts are mapped to the appropriate font files. Each "style" of the font requires a separate font file, as shown for the core fonts. Notice that each one has four different sets of files for normal, bold, italic, and bold plus italic. You will need to follow the same model when you add a new Type 1 font to the file. If you want to add the normal and the bold versions of a new Type 1 font, you must make both sets of files available to FOCUS and map then in the font map file.

Tip: The file also contains a series of aliases (not shown) that map common Windows True Type fonts to existing Type 1 fonts (for example, Arial to Helvetica) along with a series of fonts used for various languages that FOCUS supports. You can set up your own aliases to ensure proper mapping and interpretation of Windows True Type Fonts.

Font metrics are already defined for the default fonts ,so there is not need to specify the PFB file name in the map file. However, you will need to specify that file, along with the AFM file, for each new font.

$ PDF.FMP: StyleSheets Font Map file for PDF Driver $
$ Version 1: All fonts mapped into Courier, Helvetica or Times.
$ "Native" Acrobat fonts:
 
font=Courier,   style=normal, metricsfile=PSCOUR AFM *, $
font=Courier,   style=bold,   metricsfile=PSCOURB AFM *, $
font=Courier,   style=italic, metricsfile=PSCOURI AFM *, $
font=Courier,   style=bold+italic, metricsfile=PSCOURBI AFM *, $
 
font=Helvetica, style=normal,  metricsfile=PDHELV AFM *, $
font=Helvetica, style=bold,    metricsfile=PDHELVB AFM *, $
font=Helvetica, style=italic,  metricsfile=PDHELVI AFM *, $
font=Helvetica, style=bold+italic, metricsfile=PDHELVBI AFM *, $
 
font=Times,     style=normal,  metricsfile=PDTIME AFM *, $
font=Times,     style=bold,    metricsfile=PDTIMEB AFM *, $
font=Times,     style=italic,  metricsfile=PDTIMEI AFM *, $
font=Times,     style=bold+italic, metricsfile=PDTIMEBI AFM *, $

-* Following is an entry for a new Type 1 Font: OCRA

A quick way to add an entry is to copy and modify an existing one.

font=OCRA, style=normal, metricsfile=OCRA AFM *, fontfile=OCRA PFB *, $
font=OCRA, style=bold, metricsfile=OCRAB AFM *, fontfile=OCRAB PFB *, $

FOCUS StyleSheet Declaration

The following is an in-line FOCUS StyleSheet declaration that formats the entire report to use the new Type1 font, OCRA. Other than the font, the report uses default styles:

ON TABLE SET STYLE *
TYPE=REPORT, FONT=OCRA, $
ENDSTYLE


Example: FOCUS Font Map File Entries for PS

The FOCUS font map file for PS includes a wide range of fonts that are typically supported by Level 2 Printers. To take advantage of a listed font, it must be installed on your printer.

These core Type 1 fonts are mapped to the appropriate font files. Each "style" of the font requires a separate font file, as shown for the core fonts. Notice that each one has four different sets of files for normal, bold, italic, and bold plus italic. You will need to follow the same model when you add a new Type 1 font to the file. If you want to add the normal and the bold versions of a new Type 1 font, you must make both sets of files available to FOCUS and map then in the font map file.

font=Arial,     style=normal,       metricsfile=PSHELV AFM *, $
font=Arial,     style=bold,         metricsfile=PSHELVB AFM *, $
font=Arial,     style=italic,       metricsfile=PSHELVI AFM *, $
font=Arial,     style=bold+italic,   metricsfile=PSHELVBI AFM *, $
 
font=Avant Garde Gothic, style=normal,    metricsfile=PSAVAN AFM *, $
font=Avant Garde Gothic, style=bold,      metricsfile=PSAVANB AFM *, $
font=Avant Garde Gothic, style=italic,    metricsfile=PSAVANI AFM *, $
font=Avant Garde Gothic, style=bold+italic,
   metricsfile=PSAVANBI AFM *,  $
 
font=Bookman,   style=normal,       metricsfile=PSBOOK AFM *,   $
font=Bookman,   style=bold,         metricsfile=PSBOOKB AFM *, $
font=Bookman,   style=italic,       metricsfile=PSBOOKI AFM *, $
font=Bookman,     style=bold+italic,    metricsfile=PSBOOKBI AFM *,    $
 
font=Courier,   style=normal,        metricsfile=PSCOUR AFM *, $
font=Courier,   style=bold,          metricsfile=PSCOURB AFM *, $
font=Courier,   style=italic,        metricsfile=PSCOURI AFM *, $
font=Courier,     style=bold+italic,     metricsfile=PSCOURBI AFM *, $
 
font=Courier New, style=normal,      metricsfile=PSCOUR AFM *, $
font=Courier New, style=bold,        metricsfile=PSCOURB AFM *, $
font=Courier New, style=italic,      metricsfile=PSCOURI AFM *, $
font=Courier New, style=bold+italic, metricsfile=PSCOURBI AFM *, $
font=Helvetica, style=normal,        metricsfile=PSHELV AFM *, $
font=Helvetica, style=bold,          metricsfile=PSHELVB AFM *, $
font=Helvetica, style=italic,        metricsfile=PSHELVI AFM *, $
font=Helvetica, style=bold+italic,  metricsfile=PSHELVBI AFM *, $
 
font=Helvetica Narrow, style=normal,      metricsfile=PSNHLE AFM *, $
font=Helvetica Narrow, style=bold,        metricsfile=PSNHLEB AFM *, $
font=Helvetica Narrow, style=italic,      metricsfile=PSNHLEI AFM *, $
font=Helvetica Narrow, style=bold+italic,   metricsfile=PSNHLEBI AFM *, $
 
font=Lubalin Graph,  style=normal,        metricsfile=PSLUB AFM *, $
font=Lubalin Graph,  style=bold,          metricsfile=PSLUBB AFM *, $
font=Lubalin Graph,  style=italic,        metricsfile=PSLUBI AFM *, $
font=Lubalin Graph,   style=bold+italic,    metricsfile=PSLUBBI AFM *, $
 
font=New Century Schoolbook, style=normal,  metricsfile=PSSCHL AFM *, $
font=New Century Schoolbook, style=bold,    metricsfile=PSSCHLB AFM *, $
font=New Century Schoolbook, style=italic,  metricsfile=PSSCHLI AFM *, $
font=New Century Schoolbook, style=bold+italic,
   metricsfile=PSSCHLBI AFM *, $
 
font=Palatino,  style=normal,       metricsfile=PSPALA AFM *, $
font=Palatino,  style=bold,         metricsfile=PSPALAB AFM *, $
font=Palatino,  style=italic,       metricsfile=PSPALAI AFM *, $
font=Palatino,  style=bold+italic,   metricsfile=PSPALABI AFM *, $
 
font=Souvenir,  style=normal,        metricsfile=PSSOUV AFM *, $
font=Souvenir,  style=bold,          metricsfile=PSSOUVB AFM *, $
font=Souvenir,  style=italic,        metricsfile=PSSOUVI AFM *, $
font=Souvenir,   style=bold+italic,      metricsfile=PSSOUVBI AFM *, $
 
font=Times,    style=normal,        metricsfile=PSTIME AFM *, $
font=Times,    style=bold,          metricsfile=PSTIMEB AFM *, $
font=Times,    style=italic,        metricsfile=PSTIMEI AFM *, $
font=Times,    style=bold+italic,  metricsfile=PSTIMEBI AFM *, $
 
font=Times New Roman, style=normal,     metricsfile=PSTIME AFM *, $
font=Times New Roman, style=bold,       metricsfile=PSTIMEB AFM *, $
font=Times New Roman, style=italic,     metricsfile=PSTIMEI AFM *, $
font=Times New Roman, style=bold+italic,  metricsfile=PSTIMEBI AFM *, $
 
font=Zapf Chancery,  style=italic,   metricsfile=PSZAPFCI AFM *, $

-* Following is an entry for a new Type 1 Font: OCRA

A quick way to add an entry is to copy and modify an existing one.

font=OCRA, style=normal, metricsfile=OCRA AFM *, fontfile=OCRA PFB *, $
font=OCRA, style=bold, metricsfile=OCRAB AFM *, fontfile=OCRAB PFB *, $

FOCUS StyleSheet Declaration

The following is an in-line FOCUS StyleSheet declaration that formats the entire report to use the new Type1 font, OCRA. Other than the font, the report uses default styles:

ON TABLE SET STYLE *
TYPE=REPORT, FONT=OCRA, $
ENDSTYLE

Top of page

x
Creating PDF Files for Use With UNIX Systems

How to:

Reference:

PDF files created with HOLD FORMAT PDF present a challenge if you work in an MVS or VM environment and use UNIX-based systems as the server for Adobe or as an intermediate transfer point.

The end of each PDF file has a table containing the byte offset, including line termination characters, of each PDF object in the file. The offsets indicate that each line is terminated by two characters, a carriage return and a line feed, which is the standard Windows text file format. However, records in a UNIX text file are terminated by one character, a line feed only. When using default settings, the offsets in a PDF file will be incorrect, causing an error when Acrobat attempts to open the file. If the file is then transferred in BINARY mode to Windows, it cannot be opened in Acrobat for Windows, as the carriage-return character was not inserted.

One solution has been to transfer the file to the UNIX system in text mode and then transfer in text mode to the Windows system, as the carriage return is added by the transfer facility when transferring to Windows.

If that is not possible or desirable, you can use the SET PDFLINETERM=SPACE command to facilitate binary transfer to Windows from an ASCII-based UNIX system. This command causes an extra space character to be appended to each record of the PDF output file. This extra space acts as a placeholder for the expected carriage return character and makes the object offsets in the file correct when it is transferred from MVS or VM to a UNIX system. This enables a UNIX server to open a PDF file in that environment.

Note: A text mode transfer is always required when transferring a text file from a mainframe to any other environment (Windows, ASCII Unix, or EBCDIC Unix).



x
Syntax: How to Specify Line Termination Characters When Creating a PDF File

In a profile, a FOCEXEC, or from the command line, issue the following command:

SET PDFLINETERM={STANDARD|SPACE}

In a TABLE request, issue the following command:

ON TABLE SET PDFLINETERM {STANDARD|SPACE}

where:

STANDARD

Creates a PDF file without any extra characters. This file will be a valid PDF file if transferred in text mode to a Windows machine, but not to a UNIX machine. If subsequently transferred from a UNIX machine to a Windows machine in text mode, it will be a valid PDF file on the Windows machine.

SPACE

Creates a PDF file with an extra space character appended to each record. This file will be a valid PDF file if transferred in text mode to a UNIX machine, but not to a Windows machine. If subsequently transferred from an ASCII UNIX machine to a Windows machine in binary mode, it will be a valid PDF file on the Windows machine.



x
Reference: Required PDFLINETERM Settings Based on Environment

The following chart will assist you in determining the correct setting to use, based on your environment:

Transferring from MVS or VM to:

SET PDFLINETERM=

EBCDIC UNIX (text transfer)

SPACE

ASCII UNIX (text transfer)

SPACE

ASCII UNIX (text); then to Windows (binary)

SPACE

UNIX (text); then to Windows (text)

STANDARD

Directly to Windows (text)

STANDARD



x
Displaying An and AnV Fields With Line Breaks

How to:

Using StyleSheet attributes, you can display An (character) and AnV (varchar) fields that contain line breaks on multiple lines in a PDF or PostScript report. Line breaks can be based on line feeds, carriage returns, or a combination of both. If you do not add these StyleSheet attributes, all line feed and carriage return formatting within these fields will be ignored.



x
Syntax: How to Display An and AnV Fields Containing Line Breaks on Multiple Lines
TYPE=REPORT,LINEBREAK='type',$

where:

REPORT

Is the required component for the LINEBREAK attribute.

'type'

Specifies that line breaks will be inserted in a report based on the following:

LF inserts a line break after each line-feed character found in all An and AnV fields.

CR inserts a line break after each carriage-return character found in all An and AnV fields.

LFCR inserts a line break after each combination of a line-feed character followed by a carriage-return character found in all An and AnV fields.

CRLF inserts a line break after each combination of a carriage-return character followed by a line-feed character found in all An and AnV fields.

Note: The report output must be formatted as PDF or PostScript.



Example: Displaying an Alphanumeric Field With Line Breaks in a PDF Report

The following request defines an alphanumeric named ANLB field with a semi-colon in the middle. The CTRAN function then replaces the semi-colon with a carriage return character and stores this string in a field named ANLBC. On the report output, this field displays on two lines:

DEFINE FILE EMPLOYEE                                
ANLB/A40 ='THIS IS AN An FIELD;WITH A LINE BREAK.'; 
ANLBC/A40 = CTRAN(40, ANLB, 094, 013  , ANLBC);     
END                                                 
TABLE FILE EMPLOYEE                                 
PRINT LAST_NAME ANLBC                                        
WHERE LAST_NAME EQ 'BLACKWOOD' 
ON TABLE HOLD FORMAT PDF                 
ON TABLE SET STYLE *                                
TYPE=REPORT,LINEBREAK='CR',$                        
ENDSTYLE                                            
END                                                 

The output is:

LAST_NAME
ANLBC
BLACKWOOD
THIS IS AN An FIELD
WITH A LINE BREAK.


Example: Using an Alphanumeric Field With a LIne Break in a Subfoot

The following request defines an alphanumeric named ANLB field with a semi-colon in the middle. The CTRAN function then replaces the semi-colon with a carriage return character and stores this string in a field named ANLBC. In the subfoot, this field displays on two lines:

DEFINE FILE EMPLOYEE                                
ANLB/A40 ='THIS IS AN An FIELD;WITH A LINE BREAK.'; 
ANLBC/A40 = CTRAN(40, ANLB, 094, 013  , ANLBC);     
END                                                 
TABLE FILE EMPLOYEE                                 
PRINT FIRST_NAME                                    
BY LAST_NAME                                        
WHERE LAST_NAME EQ 'BLACKWOOD'                      
ON LAST_NAME SUBFOOT                                
  " "                                               
  " <ANLBC "                                        
ON TABLE HOLD FORMAT PDF                 
ON TABLE SET STYLE *                                
TYPE=REPORT,LINEBREAK='CR',$                        
ENDSTYLE                                            
END                                                 

The output is:

LAST_NAME
FIRST_NAME
BLACKWOOD
ROSEMARIE
  THIS IS AN An FIELD
  WITH A LINE BREAK.
 


Information Builders