Previous Topic Next topic Print topic


Creating a PL/I Include File

In PL/I, an include (.inc) file declares constants, functions and structures. The include file can be referenced (using the %include statement or by EXEC SQL include ) by many programs. When the Declaration Generator creates a declaration for a PL/I program, it writes the declaration to a include file. If you choose, it also generates a corresponding array of null-indicator variables for each column in the table.

To create a PL/I include file, start the Declaration Generator utility, then follow the steps below:

  1. In the Language group box, click the PL/I button.
  2. In the Table group box, select the Location, AuthID and Table that identifies the table for which you want to create a header file.
  3. If you want to change the name of the file to which the include file is written, type a new name in the Output File field. (The Declaration Generator automatically places a default name based on the table name in this field.)

    If you don't specify a path, the include file is written to the first directory specified in the COBCPY environment variable. If this variable isn't found, the include file is written to the current application path (the application path is specified in the PATHS tab in Options).

    If you specify a file that already exists, you are given the choice of appending to it or overwriting it at run time.

  4. If you want to change the name of the structure, type a new name in the Structure field.
  5. If you want to add a prefix to each element name, type it in the Field Prefix box. You can end the prefix with a special character such as an underscore (_) to set it off from the rest of the name. For example, if a prefix of emp_ were specified, element names would be written as follows:
    DECLARE
    		1 DCLEMPLOYEE, 
    		5 EMP_E_NO BIN FIXED(15), 
    		5 EMP_LNAME CHAR(10), 
    		5 EMP_FNAME CHAR(10), 
    		.

    Remember to take into account PL/I variable-naming guidelines when assigning a prefix. Do not assign one containing characters that are disallowed by the compiler or one that might make the variable name too long.

  6. If you want to assign numbers instead of field names as element names, check the Numbered option. (This option can be selected only when a field prefix is used. See the previous step.) If the Numbered option were checked in the example above, the declaration would be written as follows:
    DECLARE 
    		1 DCLEMPLOYEE, 
    		5 EMP_001 BIN FIXED(15), 
    		5 EMP_002 CHAR(10), 
    		5 EMP_003 CHAR(10),
  7. Click the Options button.
  8. In the PL/I Declaration Options dialog box, specify this option if you want the Declaration Generator to generate an array of indicator variables.
  9. If you want to save your specifications, click the Save As button, specify a file name and click OK. The specifications will be saved to a .DGE file, which can be used as input to the Declaration Generator batch mode. See Running in Batch Mode for more information about .DGE files and batch mode.
  10. Click the Generate button to generate the PL/I include file.
Previous Topic Next topic Print topic