GDF (Graphic Data File) keyword in printer files

You use this record-level keyword to print a graphic data file.

The format of the keyword is:
GDF(library-name | &library-name-field
graph-file   | &graph-file-field
graph-member | &graph-member-field
position-down | &position-down-field
position-across | &position-across-field
graph-depth | &graph-depth-field
graph-width | &graph-width-field
graph-rotation | &graph-rotation-field);

The graph-file and graph-member parameters identify the chart to be printed. Both are required parameters.

Use the optional library-name parameter to further qualify the graphic data file and member. If you do not specify the library-name parameter, *LIBL is used to search for the graphic data file at print time.

You can specify the library-name, graph-file, graph-member, position-down, position-across, graph-depth, graph-width, and graph-rotation parameters as constants, program-to-system fields, or a combination of both, as shown in the following examples:

  • [library-name/]graph-file graph-member...
  • [library-name/]&field1 graph-member...
  • [&field2/]graph-file &field3...
  • [&field4/]&field5 &field6...

When you specify library-name, graph-file, or graph-member parameters as program-to-system fields, the fields must exist in the same record format as the GDF keyword. They must be defined as length 10, data type A (character), and usage P (program-to-system).

When you specify the position-down, position-across, graphic-depth, or graphic-width parameters as program-to-system fields, the fields must be defined as length 5 with 3 decimal positions, data type S, and usage P. When you specify the graphic-rotation parameter as a program-to-system field, the field must be defined as having a length of 3 with zero decimal positions.

The position-down parameter is required and defines the vertical starting point of the chart relative to the margins specified on the FRONTMGN or BACKMGN parameter on the CRTPRTF command. Valid values are 0 to 57.790 cm (0 to 22.750 in.).

The position-across parameter is required and defines the horizontal starting point of the chart relative to the margins specified on the FRONTMGN or BACKMGN parameter on the CRTPRTF command. Valid values are 0 to 57.790 cm (0 to 22.750 in.).

The graph-depth parameter is required and defines the depth of the chart. The chart is scaled to fit within the area specified by the graph-depth parameter. Valid values are 0.001 to 57.790 cm (0.001 to 22.750 in.).

The graph-width parameter is required and defines the width of the chart. The chart is scaled to fit within the area specified by the graph-width parameter. Valid values are 0.001 to 57.790 cm (0.001 to 22.750 in.).

Note: The UOM parameter on the CRTPRTF command determines the units of measure for the position-down, position-across, graph-depth, and graph-width parameter values. If the value specified for a parameter is outside the valid range, it is flagged when the spooled file is created.

The graph-rotation parameter is required and defines the orientation of the chart with respect to the text on the page. Valid values are 0, 90, 180, and 270.

An error message is issued at print time if the chart is not positioned on the page.

Note: The graphic data file must conform to the IBM® Graphic Object Content Architecture (GOCA) DR2 Subset, Version 0 (DR/2V0).

You can create graphics data format files with the Business Graphics Utility (BGU) licensed program or the Graphical Data Display Manager (GDDM), which is a function of the IBM i system. As soon as the objects exist, you can print them with the DDS graphics data format file (GDF) keyword to determine the location (library), identity (file and member name), position (down and across with a possibility of three decimal positions, for example, 1.001), size (width and depth), and rotation of the object.

You can use the Display Graphics Data File (DSPGDF) command to view the objects on a display station. Viewing the object before using the DDS GDF keyword to print it can help with selecting the position values required on the GDF keyword.

Specify DEVTYPE(*AFPDS) on the CRTPRTF command when GDF is specified in the file. If DEVTYPE is changed to anything other than *AFPDS, the keyword is ignored and a warning message is issued at print time.

When GDF is specified on a record format, all fields within the record format must be positioned using the POSITION keyword.

An error message is issued if a constant field is specified in a record format where the GDF keyword is also specified.

You can specify this keyword multiple times on a record.

You cannot specify GDF with the following keywords:
  • SPACEA
  • SPACEB
  • SKIPA
  • SKIPB

Option indicators are valid for this keyword.

Example 1

The following example shows how to specify the GDF keyword.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
     A*
     A          R REC1                      GDF(GRAPHLIB/GFILE MYGRAPH 1.557 +
     A                                      2.831 7.0 4.5 90)
     A*
     A          R REC2                      GDF(&GLIB/&GFILE &GRAF &POSD +
     A                                      &POSA &GDEP &GWID &GROT);
     A            GLIB          10A  P
     A            GFILE         10A  P
     A            GRAF          10A  P
     A            POSD           5S 3P
     A            POSA           5S 3P
     A            GDEP           5S 3P
     A            GWID           5S 3P
     A            GROT           3S 0P
     A*
     A          R REC3                      GDF(GFILE MYGRAF 2.0 7.0 4.5 11.25 +
     A                                      180)
     A*
     A                                      GDF(GFILE YOURGRAF 0.1 0.5 3.67 +
     A                                      6.5 90)
     A*
     A          R REC4
     A  01                                  GDF(YOURFILE THATGRAF 2.5 7.3 3.0 +
     A                                      5.25 0)
     A*
Note: The UOM parameter on the CRTPRTF command determines the units of measure for the parameter values.

REC1 prints member MYGRAPH from file GFILE in library GRAPHLIB. The chart prints 1.557 units down and 2.831 units across from the margins specified on the FRONTMGN or BACKMGN parameter on the CRTPRTF command. The chart is 7.0 units deep, 4.5 units wide, and is rotated 90 degrees.

REC2 allows the application program to specify the library by setting the field GLIB, specify the file by setting the field GFILE, and specify the graph names by setting GRAF. The application program also specifies the position-down value (POSD), the position-across value (POSA), the graph-depth value (GDEP), the graph-width value (GWID), and the graph-rotation value (GROT).

REC3 prints two charts. MYGRAF prints 2.0 units down and 7.0 units across from the margins specified on the FRONTMGN or BACKMGN parameter on the CRTPRTF command. The chart is 4.5 units deep, 11.25 units wide, and is rotated 180 degrees. YOURGRAF prints 0.1 units down and 0.5 units across from the margins specified on the CRTPRTF command. The chart is 3.67 units deep, 6.5 units wide, and is rotated 90 degrees. Both charts are located using *LIBL and file GFILE.

REC4 prints THATGRAF only if indicator 01 is on.

Example 2

In the following example, the library name is GRAPHLIB; the file name is GRFILE; and the member name is BARCHART.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
      *
                R REC1                      GDF(GRAPHLIB/GRFILE BARCHART  +
                                            2.0 2.0 3.0 2.0 90)
 
 
 
      *
 

The following diagram shows:

  • The location of the margins (2 units down and 2 units across) as specified on the printer file being used.
  • The starting position (2.0 units down and 2.0 units across from the location of the margins) of the member BARCHART.
  • The depth (3.0 units) and the width (2.0 units) of the member called BARCHART.
  • The rotation (90 degrees) of the member BARCHART.
Graphic showing the result of example 2, as described in the text.