Sample traditional compiler listing

LIST                Mon Feb  9 13:00:42 2010  DBL V9 Compiler p001
                                              /usr2/list.dbl    
    1          ;
    2          ; list.dbl
    3          ;
    4          ; Example of listing
    5          ;
    6          
    7          subroutine secnds
    8          begtim, d
    9          endtim, d
    10         
    11         .include "mydata.dbl"
  2.1          ; First line of "mydata.dbl"
  2.2          ;
  2.3          .include "mydata2.dbl"
  3.1          ; First line of "mydata2.dbl"
  3.2          ;
  3.3          .define MAXSEC  ,8000000
  3.4          .define MINSEC  ,0
  3.5          ; Last line of "mydata2.dbl"
  2.4          record
  2.5                  fld1,   d4
  2.6                  fld2,   d4
  2.7          ; Last line of "mydata.dbl"
    12         record
    13                 curtim  ,d6
    14                 hr      ,d2 @curtim
    15                 mi      ,d2 @curtim+2
    16                 se      ,d2 @curtim+4
    17                 cursec  ,d5
    18         
    19         proc
    20                 xcall time (curtim)
    21                 cursec=(hr*3600)+(mi*60)+se
    22                 if (cursec .lt. begtim)
    23                   begin
    24                         cursec = cursec + 86400
    25         .ifdef TEST
    26    C                    if (cursec .gt. MAXSEC)
    27    C                    begin
    28    C                            cursec = MAXSEC
    29    C                    end
    30         .endc
    31                   end
    32                 endtim=cursec-begtim
    33                 return
    34         endsubroutine
Errors:         0, in file /usr2/list.dbl
dbl -w 80 -l list list
SYNCMPOPT: -qcheck
DBLOPT: 11

An explanation of the compiler listing

Header

The listing begins with a page break. The header’s first line contains the following information:

Mon Feb 9 13:00:42 2010

DBL V9 Compiler

p001

The second line of the header contains the following information:

/usr2/list.dbl

After the two header lines, the compiler generates a blank line.

Line numbering

A line number is generated for each line in the source file that contains the PROC statement. For example, in the sample compiler listing, the first line of the source begins on line number 1, the second begins on line number 2, and so forth.

Include files

Source files that are .INCLUDEd are generated to the listing file. Each include file has its own set of line numbers. In our sample compiler listing, notice how the line numbers begin with 2.1 after the mydata.dbl file is included at line 11 and 3.1 after the mydata2.dbl file is included at line 2.3.

An include level counter is incremented each time the compiler accesses an include file and decremented each time the compiler returns from an include file. If this counter is greater than 0, it is displayed to the left of the line numbers in the listing file, as illustrated in the sample compiler listing.

Lexical level

A lexical level counter is incremented each time the compiler encounters a PROC (or .PROC) or BEGIN statement. The counter is decremented each time the compiler encounters an END (or .END) statement. This counter is displayed to the right of the line numbers in the listing file for each PROC, BEGIN, or END statement, as illustrated in lines 19, 23, 31, and 34 of the sample compiler listing above. The lexical level counter is not displayed next to line 27 and 29 because they are enclosed within a false conditional block. See False conditionals below for more details.

False conditionals

The letter “C” is displayed to the right of the line numbers of lines within false conditional blocks, as illustrated in lines 26 – 29 of the sample compiler listing. (These lines are not compiled.) If you turned off the printing of false conditionals (using the NOCOND option on the .START compiler directive, the conditionals compiler option, or the +NOCOND compiler list option), lines 25 – 30 would not be generated to the listing file.

Footer

A count of the warnings and errors that the compiler encountered is generated at the end of each listing, along with the command line that was specified to generate the listing.

If the compiler encounters any warnings or errors during compilation, those error messages are also generated to the listing file, following the line that caused the warning or error.

SYNCMPOPT

If the SYNCMPOPT environment variable is set in the environment, its contents are generated to the listing file. This information helps you determine which options were active when compilation occurred.

DBLOPT

If the DBLOPT environment variable is set in the environment, its contents are generated to the listing file. This information helps you determine which options were active when compilation occurred.