SYSPRINT output from the precompiler

SYSPRINT output from the Db2 precompiler shows the results of the precompile operation. This output can also include a list of the options that were used, a source code listing, and a host variable cross-reference listing.

When you use the program preparation panels to prepare and run your program, Db2 allocates SYSPRINT according to TERM option that you specify (on line 12 of the PROGRAM PREPARATION: COMPILE, PRELINK, LINK, AND RUN panel). As an alternative, when you use the DSNH command procedure (CLIST), you can specify PRINT(TERM) to obtain SYSPRINT output at your terminal, or you can specify PRINT(qualifier) to place the SYSPRINT output into a data set named authorizationID.qualifier.PCLIST. Assuming that you do not specify PRINT as LEAVE, NONE, or TERM, Db2 issues a message when the precompiler finishes, telling you where to find your precompiler listings. This helps you locate your diagnostics quickly and easily.

The SYSPRINT output can provide information about your precompiled source module if you specify the options SOURCE and XREF when you start the Db2 precompiler.

The format of SYSPRINT output is as follows:
  • A list of the Db2 precompiler options that are in effect during the precompilation (if you did not specify NOOPTIONS).
  • A list of your source statements (only if you specified the SOURCE option). An example is shown in Figure 1.
  • A list of the symbolic names used in SQL statements (this listing appears only if you specify the XREF option). An example is show in Figure 2.
  • A summary of the errors that are detected by the Db2 precompiler and a list of the error messages that are generated by the precompiler. An example is shown in
The following code shows an example list of Db2 precompiler options as it is displayed in the SYSPRINT output.
DB2 SQL PRECOMPILER VERSION 11 REL. 1.0

OPTIONS SPECIFIED: HOST(PLI),SOURCE,XREF,STDSQL(NO),TWOPASS
DSNHDECP LOADED FROM - (USER99.RELM.TESTLIB(DSNHDECP))
OPTIONS USED - SPECIFIED OR DEFAULTED
APOST
APOSTSQL
ATTACH(TSO)
CCSID(37)
CONNECT(2)
DEC(15)
FLAG(I)
FLOAT(S390)
HOST(PLI)
LINECOUNT(60)
MARGINS(2,72)
NEWFUN(V11)
OPTIONS
PERIOD
SOURCE
SQL(DB2)
STDSQL(NO)
TWOPASS
XREF 
Notes:
  1. This section lists the options that are specified at precompilation time. This list does not appear if one of the precompiler option is NOOPTIONS.
  2. This section lists the options that are in effect, including defaults, forced values, and options that you specified. The Db2 precompiler overrides or ignores any options that you specify that are inappropriate for the host language.
The following figure shows an example list of source statements as it is displayed in the SYSPRINT output.
Figure 1. Db2 precompiler SYSPRINT output: Source statements section
DB2 SQL PRECOMPILER       TMN5P40:PROCEDURE OPTIONS (MAIN):           PAGE 2
 
     1        TMN5P40:PROCEDURE OPTIONS(MAIN) ;                       00000100
     2        /*******************************************************00000200
     3        *      program description and prologue                       00000300
   ⋮
  1324        /*************************************************/     00132400
  1325        /*  GET INFORMATION ABOUT THE PROJECT FROM THE   */     00132500
  1326        /*  PROJECT TABLE.                               */     00132600
  1327        /*************************************************/     00132700
  1328               EXEC SQL SELECT ACTNO, PREQPROJ, PREQACT         00132800
  1329                    INTO PROJ_DATA                              00132900
  1330                    FROM TPREREQ                                00133000
  1331                         WHERE PROJNO = :PROJ_NO;               00133100
  1332                                                                00133200
  1333        /*************************************************/     00133300
  1334        /*  PROJECT IS FINISHED. DELETE IT.              */     00133400
  1335        /*************************************************/     00133500
  1336                                                                00133600
  1337                EXEC SQL DELETE FROM PROJ                       00133700
  1338                     WHERE PROJNO = :PROJ_NO;                   00133800
  ⋮
  1523        END;                                                    00152300
Notes:
  • The left column of sequence numbers, which the Db2 precompiler generates, is for use with the symbol cross-reference listing, the precompiler error messages, and the BIND error messages.
  • The right column shows sequence numbers that come from the sequence numbers that are supplied with your source statements.
The following figure shows an example list of symbolic names as it is displayed in the SYSPRINT output.
Figure 2. Db2 precompiler SYSPRINT output: Symbol cross-reference section
DB2 SQL PRECOMPILER      SYMBOL CROSS-REFERENCE LISTING             PAGE 29
 
DATA NAMES                     DEFN     REFERENCE
 
"ACTNO"                        ****     FIELD
                                        1328
"PREQACT"                      ****     FIELD
                                        1328
"PREQPROJ"                     ****     FIELD
                                        1328
"PROJNO"                       ****     FIELD
                                        1331 1338
 
 ...
 
PROJ_DATA                      495      CHARACTER(35)
                                        1329
PROJ_NO                        496      CHARACTER(3)
                                        1331 1338
"TPREREQ"                      ****     TABLE
                                        1330 1337
Notes:
DATA NAMES
Identifies the symbolic names that are used in source statements. Names enclosed in double quotation marks (") or apostrophes (') are names of SQL entities such as tables, columns, and authorization IDs. Other names are host variables.
DEFN
Is the number of the line that the precompiler generates to define the name. **** means that the object was not defined, or the precompiler did not recognize the declarations.
REFERENCE
Contains two kinds of information: the symbolic name, which the source program defines, and which lines refer to the symbolic name. If the symbolic name refers to a valid host variable, the list also identifies the data type or the word STRUCTURE.
The following code shows an example summary report of errors as it is displayed in the SYSPRINT output.
DB2 SQL PRECOMPILER           STATISTICS
 
  SOURCE STATISTICS
    SOURCE LINES READ: 15231
    NUMBER OF SYMBOLS: 1282
    SYMBOL TABLE BYTES EXCLUDING ATTRIBUTES: 64323
 
  THERE WERE 1 MESSAGES FOR THIS PROGRAM.4
  THERE WERE 0 MESSAGES SUPPRESSED.5
  65536 BYTES OF STORAGE WERE USED BY THE PRECOMPILER.6
  RETURN CODE IS 8.7
  DSNH104I E LINE 590 COL 64 ILLEGAL SYMBOL: 'X'; VALID SYMBOLS ARE:,FROM8
Notes:
  1. Summary statement that indicates the number of source lines.
  2. Summary statement that indicates the number of symbolic names in the symbol table (SQL names and host names).
  3. Storage requirement statement that indicates the number of bytes for the symbol table.
  4. Summary statement that indicates the number of messages that are printed.
  5. Summary statement that indicates the number of errors that are detected but not printed. You might get this statement if you specify the option FLAG.
  6. Storage requirement statement that indicates the number of bytes of working storage that are actually used by the Db2 precompiler to process your source statements.
  7. Return code 0 = success, 4 = warning, 8 = error, 12 = severe error, and 16 = unrecoverable error.
  8. Error messages (this example detects only one error).