Compiling a traditional Synergy routine

After creating your Synergy DBL source code files, your next step is to compile these files into object files. The object files are then used by the linker to create an executable program.

Note

When compiling code that contains classes, don’t compile classes that don’t have methods. (There is nothing to compile.)

Important

Performance is severely degraded if repositories, .INCLUDE files, or prototypes are on a network share. We also recommend that you exclude dbl.exe from virus scanning.

Invoking the traditional compiler (dbl)

On Windows and UNIX:

dbl [options] [list_options] [--] source_1 [...source_n]

Additional ways to run the compiler in a Windows environment are explained in Methods for invoking commands on Windows.

On OpenVMS, the compiler verb is selected at install time. Here we are using “DIBOL” as an example:

DIBOL [options] source_1 [options]

or

DIBOL [options] source_1 [+...source_n][options]

source_1

The first source file to be compiled. The default filename extension is .dbl.

source_n

(optional) Represents additional source files to be compiled in the order listed. The default filename extension is .dbl. You can specify a maximum of 4096 files.

options

(optional) One or more compiler options and their arguments, shown in the Compiler Options table.

On Windows and UNIX, you can either precede a group of options with a minus sign (-), or precede each option with a minus sign. (For example, -acdr, -ac -dr, and -a -c -d -r are all valid.) If an option requires an argument and that argument does not follow the option or option group immediately, Synergy DBL assumes that the option’s argument is the next undefined element on the line. For example, the following dbl commands are equivalent:

dbl -ab bind_name -l list_file src_file

and

dbl -abl bind_name list_file src_file

In both cases, the bind_name argument goes with the b option and the list_file argument goes with the l option. The Discussion explains what happens if an argument is omitted.

On OpenVMS, you must precede each option with a slash (/). If an option requires an argument and that argument is not specified, Synergy DBL assumes that the option’s argument is the same as the main filename.

list_options

(optional) One or more of the following options, which control program listings and may override compilation flags set by the .START, .LIST, or .NOLIST compiler directives. (See the Discussion.)

+list | +nolist

+cond | +nocond

+summary | +nosummary

+offsets | +nooffsets

--

(optional) Separates options and list_options from the source file list.

In Windows environments, if system option #34 is set, you must use a forward slash (/) instead of a minus sign (-) before each compiler option or group of options.

Compiler options

A complete list of the compiler options for Windows, UNIX, and OpenVMS follows.

Compiler Options

Name

Description

WIN/UNIX option

OpenVMS option

Align data on system boundaries

Align integer types and alpha types greater than 64 bytes to a native int boundary in unnamed records. In addition, all other records and global commons are aligned to a native int boundary.

-qalign

/ALIGN

Alternate IF

Use the alternate, non–ANS DIBOL form of the IF statement, which specifies that the THEN is optional and the ELSE belongs to the last IF statement. (The ANS DIBOL form of the IF statement specifies that each ELSE belongs to the most recent THEN in the same lexical level.) For more information, see IF-THEN-ELSE.

-a

or

-qaltif

(or -qnoaltif)

/ALTIF

Alternate store

Support VAX aDIBOL-compatible zoned stores by translating spaces to zeros during alpha-to-numeric and decimal-to-decimal stores. By default, Synergy DBL ignores spaces and performs no translations during store operations. (The alternate store is significantly slower than the default.)

-V

or

-qaltstore

(or -qnoaltstore)

/ALTSTORE

Array size

^SIZE (or %SIZE) of a real or pseudo array returns the size of the whole array. By default, Synergy DBL returns the size of one array element. See Array size for more information.

-s

or

-qdecscope

(or -qnodecscope)

/DECSCOPE

Bind

Bind the specified name to an executable routine as a secondary main routine. If bind_name is not specified, the compiler uses the first source name without an extension.

-b [bind_name]

/BIND[=SECONDARY]

Bind primary

Compile main as the primary (entry) routine for a bound program. The default main routine name is the name of the first source name without an extension.

-p main

/BIND=PRIMARY

Bounds checking

Enable bounds checking to enforce array dimensions and string sizes to prevent subscripting off the end of an array or string. -qcheck converts all pseudo arrays to real arrays, converts all arguments to real arrays, checks all subscript ranging and dimension access to make sure it does not exceed the descriptor of the variable passed, and gives a runtime error when memory used for %SSC_BIND, %SSC_DEFINE, %SSC_OPEN, %RCB_INSARG, %RCB_SETARG, or %RCB_SETARGS goes out of scope or is released. On OpenVMS, the default is /CHECK=NOBOUNDS.

-B

or

-qcheck

(or -qnocheck)

/CHECK=BOUNDS

Built-in global definitions

This option is considered deprecated; we do not recommend using it.

-g

/NOGBLDEFS

Common suffix

By default a dollar sign ($) is appended to the end of common variables. This switch causes a dollar sign not to be appended to common variable names. On OpenVMS, the default is /COMMON=SUFFIX.

-A

or

-qsuffix

(or -qnosuffix)

/COMMON=NOSUFFIX

Concatenate source files

Concatenate source files (treat them as one source) when compiling. Note that unresolved path problems due to imports may occur. The default is to treat each file as a separate source.

-qconcat

(or -qnoconcat)

/CONCAT

Conditionals

Exclude conditional compiler directives and source code in false conditional blocks from the program listing. On OpenVMS, the default is /SHOW=CONDITIONALS.

-C

/SHOW= NOCONDITIONALS

Debug

Manage debugging information. Level can be

1 to reduce debug emission output. Field references are only forced for those in the scope of a referenced field’s ancestry. Line numbers in the data division and its include files are not visible via the debugger LIST and VIEW commands. (default)

2 to emit line number information, create a symbolic access table for all variables in the file, and provide source file relationship information for use by the debugger.

If you don’t compile and link with this option, or if you set -qnodebug, the compiler will not emit debugging information. On OpenVMS, the default is /NODEBUG.

The -d option is equivalent to -qdebug=1.

-d

or

-qdebug[=level]

(or -qnodebug)

/DEBUG[=level]

Defines at compile time

Set compile-time defines, where id is the name of the identifier being defined and value is the replacement text (if any).

-qdefine: id1[=value1][,id2
[
=value2],...]

/DEFINE=id1[=value1]

/DEFINE=(id1[=value1],
id2[=value2],...)

Expand macros

Include the expanded form of lines containing macros in the listing file (after the regular listing line).

-qexpand

/EXPAND

Export

Turn on the extended listing options used for Workbench.

-qexport

N/A

External common

Treat COMMON statements in the main routine that don’t specify GLOBAL or EXTERNAL as external commons instead of global commons, which is the default.

-c

or

-qexternal

/COMMON=EXTERNAL

FIND lock

FIND statements default to locking found records. If this option is not specified, Synergy DBL does not lock the record unless the LOCK qualifier is specified. On OpenVMS, the default is /NOFIND_LOCK.

-F

/FIND_LOCK

Form feed

Form feed immediately after the data division in the program listing. (Also see the -P option, which performs the same task.) On OpenVMS, the default is /SHOW=NONEWPAGE.

-f

/SHOW=NEWPAGE

Global common

Treat COMMON statements that don’t specify GLOBAL or EXTERNAL modifiers as global commons instead of external commons.

-G

or

-qglobal

/COMMON=GLOBAL

(default)

Header

Exclude page headers and footers from the program listing. This is especially useful when directing program listings to the screen. On OpenVMS, the default is /SHOW=HEADERS.

-h

/SHOW=NOHEADERS

Import directories for prototyping

Specify the import directories that the IMPORT statement should search. On Windows and UNIX you can specify multiple directory locations (or logicals that contain a directory location), which will be searched in the order they appear on the command line. On OpenVMS, you can specify a single string containing a directory search path list (or logical list).

-qimpdir=import_dir [,...]

/IMPDIR=import_dir

or

/IMPDIR=(import_dir, ...)

Include file

Specify a file to include when compiling. This option overrides the SYNUSERDEF environment variable.

-quserdef=file

/USERDEF=file

List

Generate a program listing named list_file. If list_file is not specified, the default filename is the first source file with the extension .lis. On OpenVMS, the default is /NOLISTING.

-l [list_file]

/LISTING[=filename]

Local record

Change the default behavior of unqualified RECORD statements to LOCAL.

-qlocal

/LOCAL

Namespaces to import

Specify namespaces to import automatically. This option overrides the SYNDEFNS environment variable.

-qdefns=namespace[;namespace;…]

/DEFNS=namespace
[
;namespace;…]

.NET compiler warnings

Turn on .NET compiler warnings/errors for items that are not supported in Synergy .NET. These include deprecated data types, syntax, APIs, alignment warnings, and the following compiler options: -qstrict, -qalign, -qreentrant, -qnoargnopt, and -qcheck. Warnings are output to standard error. (This option is not intended for production code.)

-qnet

/NET

No expression optimization

Don't reduce/optimize expressions.

-R

/OPTIMIZE=value

No n argument optimization

Relax integer optimization of n type arguments that are used in CASE and USING statements. Implied values passed to n arguments are treated as their full implied value, and using a string control variable in a USING statement causes a string comparison.

-qnoargnopt

/NOARGNOPT

No object file

Check syntax but do not create an object file. On OpenVMS, the default is /OBJECT.

-n

or

-qnoobject

/NOOBJECT

Numeric argument

Convert all decimal type arguments to numeric type. On OpenVMS, the default is /NODECARGS.

-N

or

-qdecargs

(or -qnodecargs)

/DECARGS

Object

Name the object file filename. The default filename is the first source file with the extension .dbo. On OpenVMS, the default filename is the first source file with the default extension .OBJ. If you don’t want to specify an object filename, you must specify /NOOBJECT.

-o [filename]

or

-qobject
[=filename]

/OBJECT[=filename]

(default)

Offsets

Compiler-generated list of offsets into symbol table for each symbol referenced. (Compiling with -d or /DEBUG will include unreferenced symbols also.)

-i

/OFFSETS

Optimize

Turn optimizations on or off. Level can be 0 so optimizations will not occur or 1 so base optimizations will occur. (default)

-qnooptimize is equivalent to -qoptimize=0. /NOOPTIMIZE is equivalent to /OPTIMIZE=0.

-qoptimize[=level]

(or -qnooptimize)

/OPTIMIZE[=level]

(or /NOOPTIMIZE)

Page break

Page break immediately after the data division in the program listing. (Also see the -f option, which performs the same task.) On OpenVMS, the default is /SHOW=NONEWPAGE.

-P

/SHOW=NEWPAGE

Page length

Set the length of each listing page equal to length. By default, the program listing will contain 60 lines.

-L length

/PAGE_SIZE=length

Platform

Specify 32-bit or 64-bit object file creation. Type can be x86 for 32-bit or x64 for 64-bit.

-platform=type

N/A

Profiling

Enable profiling of specific routines in the files being compiled. You must also set system option #40, #41, or #52, depending on what you want to profile. (You don’t need to use this option if you want to profile all routines and have set system option #42.) See Synergy DBL Profiler for more information about profiling.

-u

or

-qprofile

(or -qnoprofile)

/PROFILE

Recursion

All routines in the files being compiled can be re-entered. (You can also specify the REENTRANT modifier on the FUNCTION and SUBROUTINE statements for those routines.) This option turns on -qstack.

-E

or

-qreentrant

(or -qnoreentrant)

/REENTRANT

Refresh

Refresh data from the disk between invocations of each routine. On OpenVMS, the default is /NOREFRESH. Note that the refresh option adds significant overhead to a routine because it has to reread the original file from the disk as it refreshes the variables.

-r

or

-qrefresh

(or -qnorefresh)

/REFRESH

Relax strong prototyping and error checking

Relax strong prototype validation. With no options, -qrelaxed allows sizes larger than the maximum on decimal and implied-decimal fields, alphanumerics in unary plus operations, and EXITE without a RETURN. Any options add to this default relaxation by controlling which additional compiler checks are relaxed. In some cases, things that would be errors become warnings, though the warnings may be disabled. Option can be

allowdup to allow a duplicate structure in a namespace and duplicate routines imported from prototypes.

deprecate to allow deprecated syntax to pass: implied-decimal, implied-numeric, or implied-packed data types on a channel and function calls that begin with $.

end to make END statement clear .DEFINEs at the end of the routine instead of at the end of the file.

extf to not check external function declarations against the function’s return type.

interop to compile classes generated by the gennet40 utility. Identifiers longer than 30 characters are truncated instead of generating a warning.

local to relax error reporting on local routine prototype checking.

optval to turn off the MBOTH error that occurs on Windows and UNIX if OPTIONAL is specified on a ^VAL parameter.

param to allow passing type a to an output n or type d to an input or unspecified direction a. (For decimal type only, not implied-decimal.)

paramad to allow passing type a to an input or unspecified direction d. (For decimal type only, not implied-decimal.)

paramst to allow passing a non-CLS structure (without objects) to a parameter whose type is another non-CLS structure of the same size.

path to help with ambiguous paths.

-qrelaxed[:option
[
:...]]

Each option must be preceded by a colon.

/RELAXED[=(option,...)]

Multiple options must be separated by commas. The parentheses are optional if only one option is specified.

Require prototype usage

Enforce that either a prototype or locally defined routine is available for subroutine or function calls. If only an external subroutine or function is available, the compiler will return an NFND error on the call.

-qreqproto

/REQPROTO

Runtime compatibility

Target an earlier runtime so code can be compiled to a previous version of the compiler. (See Targeting a specific runtime version in the Discussion below.) Value can be one of the following:

90501 (9.5.1)

90503 ( 9.5.3)

100101 (10.1.1)

10010101 (10.1.1a)

10030100 (10.3.1)

10030101 (10.3.1a)

10030102 (10.3.1b)

10030103 (10.3.1c)

10030300 (10.3.3)

10030301 (10.3.3a)

10030302 (10.3.3b)

10030303 (10.3.3c)

11010100 (11.1.1)

11010104 (11.1.1d)

-qrntcompat=value

/RNTCOMPAT=value

Show information

Generate extra information to the listing file. By default, the listing file contains source lines, conditional compiler directives, source lines in false conditional blocks, and page headers and footers. To exclude one or more of these items, see the Conditionals and Form feed options in this table.

-C-f-h-m

or

-C-P-h-m

/SHOW
or
/SHOW=ALL
(default)

Stack record

Make STACK the default behavior of unqualified RECORD statements.

-qstack

/STACK

Static record

Make STATIC the default behavior of unqualified RECORD statements.

-qstatic

/STATIC

Stream file

When a file is opened for output with no submode, create a stream file instead of a sequential file.

N/A

/STREAM

Strict

Enforce strict bounds checking on real array access.

-qstrict

/STRICT

Trim

Trim trailing null arguments from a subroutine or function call.

-T

/TRIM

Truncate

Truncate subroutine, function, and variable names after the sixth character and ignore any remaining characters.

-t

N/A

Undefined functions

Automatically define undefined functions as ^VAL functions.

-X

or

-qimplicit_functions

/IMPLICIT

Variable usage

Generate a file (named file) that reports unused variables. The default filename is the name of the primary source file with a .unu extension.

-qvar_review[=file]

/VAR_REVIEW[=file]

Variable usage level

Specify the level of variable usage reporting. Number is the sum of the following bit flags that determine what is listed in the output file:

0 for unused local variables in each routine (default)

1 for unused global and local variables

2 for unused labels and local variables

4 for unused include files and local variables

8 for unused local variables in primary source file only

You can add these bit flags together for additional combinations of reported information. For example, a value of 3 provides unused labels and unused global and local variables. See Variable Usage utility for more detailed information.

-qreview_level
=
number

/REVIEW_LEVEL
=
number

Variant

Define the value of the ^VARIANT data reference operation. The default variant value is 0.

-v value

or

-qvariant=value

/VARIANT=[value]

Vectors

Generate a vector list for the routines in the compiled source. For methods, the compressed mangled name is output along with the uncompressed method signature in the comment. The output can be used in the linker options file when creating an OpenVMS shared image.

N/A

/VECTORS=filename

Warnings

Control warnings. Option is one of the following:

0 to not generate any warning messages.

1 to display severe warnings.

2 to display level 1 warnings plus certain less severe warnings, such as warnings about hiding class members.

3 to display level 2 warnings plus certain less severe warnings, such as warnings about expressions that always evaluate to true or false. (default)

4 to display all level 3 warnings plus informational warnings. (Note that you may want to increase the value of DBLMAXERR.)

Compiler errors are listed on the Synergy Errors tab. If a nonfatal error can sometimes be a warning, the warning level is specified at the end of the error description.

-W[option]

/NOWARNINGS

or
/WARNINGS=option

Warnings disabled

Disable the specified warnings. Multiple error numbers must be separated by commas. (Tip: For a list of warnings and their numbers, search on "warning level".)

-WD=error_num[,...]

/DISWARN=(error_num
[,...]
)

The parentheses are optional if only one error number is specified.

Warnings to errors

Turn all compiler warnings into errors.

-qerrwarn

/ERRWARN

Warnings to errors by number

Turn the specified warnings into errors. Multiple error numbers must be separated by commas. (Tip: For a list of warnings and their numbers, search on "warning level".) If both -WD and -WE are specified, -WD takes priority. -WE operates independently of any level specifications set by -W. -WE=error_num[,...] /ERRORWARNINGS=error_num[,...]

Width

Set the width of the program listing equal to list_width, in columns. The default width is 132 columns.

-w list_width

/WIDTH_SIZE =list_width

Note

The -q options are case insensitive and may be abbreviated to the shortest unambiguous string. For example, -qalti may be used for an Alternate IF or -qalts for Alternate store. Since profiling is the only -q switch starting with a p, you can use just -qp. The other options are case sensitive on Windows and UNIX but case insensitive on OpenVMS.

Discussion

On Windows and UNIX, the Synergy compiler creates an object file that has the same name as the first source file with the extension .dbo, unless the -o option is used to specify a different name. All source files are included in a single object file in the order in which they are listed on the dbl command line.

Also on Windows and UNIX, filenames that are used as arguments to compiler options cannot begin with a minus sign (-).

On OpenVMS, if you specify more than one source file to be compiled, you must separate each filename with a plus sign (+), which causes the source files to be concatenated and compiled as one file. The result is a single object file that has the same name and location as the first source file listed, with the extension .OBJ, unless the /OBJECT compiler option is used to specify a different name. If you don’t specify directories for the object and listing files, those files will be placed in the current directory, even if the source file is not in the current directory.

Also on OpenVMS, you can append one or more compiler options either to the DIBOL command or to individual source files. If you append compiler options to the DIBOL command, all of the source files listed in the command line will be affected. However, if you append compiler options to one or more source filenames, only the specified files will be affected.

Omitted arguments on Windows and UNIX

If a compiler option requires an argument and no argument immediately follows the option, the compiler will use the next undefined element on the line as the argument. (Compiler options or groups of options and the “--” separator are considered to be “defined” elements, whereas source filenames or arguments to the compiler options are considered to be “undefined.”) When the compiler encounters another compiler option group, it stops looking for the argument(s) to the previous option(s). The default argument then becomes the name of the first source file, with the appropriate extension. Once an element has been used as an argument to a compiler option, it cannot be used as an argument to another compiler option.

For example, in the following command:

dbl -l srcfile

the list_file argument is omitted. The compiler will use srcfile as the list file and add a default extension of .lis. As a result, no primary source file will be found, and this command will generate a “No primary files specified” error (NULPR).

In the example below, the list_file argument is omitted. Since the next element on the line is another compiler option, which is a defined element, the compiler will use srcfile.lis as the list file and use srcfile.dbl as the primary source file.

dbl -l -c srcfile 

In the following example, because the “--” separator indicates that there are no more compiler options and anything that follows is a source file, srcfile.lis again will be the list file, and srcfile.dbl will be the primary source file.

dbl -l -- srcfile

In the command below, both -l and -o require arguments. Since -o immediately follows the -l specification, the compiler will use the first source filename as the list filename argument (srcfile1.lis). Since the -o option has an undefined element immediately following it, the compiler assumes this undefined element is the argument for -o and will name the object file object.dbo. Srcfile1.dbl will be the primary source file, and srcfile2.dbl the second source file.

dbl -l -o object -- srcfile1 srcfile2

List options

On Windows and UNIX, if you specify more than one list_option, separate each option with a blank space. Type out the entire list_option name. If no list_options are included on the dbl command line, all compilation flags set by the .START, .LIST, and .NOLIST compiler directives will be processed. For an explanation of each list option, see .START.

Binding

On Windows and UNIX, the -b and -p compiler options enable you to create bound programs. Binding is a method of grouping more than one main routine into a single executable program. (See Bound programs.) You can create a bound application by following the steps below:

1. Compile the main routine at which the application will be entered with the -p compiler option.
2. Compile the other main routines with the -b compiler option.
3. Link all of the main routines together with their subroutines and any libraries that they use.

The example below creates a bound program named main1.dbr, which consists of a main routine from main1.dbl, two other main routines (from main2.dbl and main3.dbl) that are treated as subroutines, and whatever utility subroutines are linked into util.elb.

dbl -p main1 main1
dbl -b main2 main2
dbl -b main3 main3
dblink main1 main2 main3 util.elb

If you convert nonbound programs to bound programs, you might need to use the -r compiler option. Otherwise, your record data won’t be refreshed upon re-entry.

Targeting a specific runtime version

On Windows and UNIX, the -qrntcompat option enables the compiler to target an earlier runtime version, back to 9.5.1. For example, you can build with Synergy/DE 10.3 but target a 9.5.3 runtime, which allows you to take advantage of the latest and greatest Synergy features for development while still supporting older runtime versions for customers that have not yet upgraded. Only object files created in 10.3.3 or higher can be verified. You can find a complete list of runtime compatibility values in the Runtime compatibility row of the Compiler Options table. If a version is missing from the list, it means no new features were added to the runtime between that version and an earlier release. Select the previous version closest to the one you're looking for; for example, if you want to target 10.3.3e, you would use the value for 10.3.3c.

Note

When you want to take advantage of a new feature introduced in a specific revision of a version of the Synergy runtime, ‑qrntcompat needs to be set to at least that revision. For example, since global I/O hooks were introduced in 11.1.1d, if you wanted to use them, you would need to set -qrntcompat to at least 11010104.

You can programmatically determine the runtime setting that was used when the program was built using the RUNTIME_TARGET define. RUNTIME_TARGET’s value is set at compile time to a program’s runtime compatibility setting (either passed with -qrntcompat or the default runtime target). This enables you to exclude runtime features if the runtime target is lower than when the features were introduced.

The following example compares RUNTIME_TARGET to values passed by -qrntcompat:

main 
proc
    open(2, o, "tt:")
; Test that it is 10.3.1b
.if RUNTIME_TARGET == 10030102
    writes(2,"yes it equals 10030102")
.else
    writes(2,"no it does not equal 10030102")
.endc
; 10.3.1b test
.if RUNTIME_TARGET >= 10030102
    writes(2,"yes it's >= 10030102")
.else
    writes(2,"no it's < 10030102")
.endc
.ifdef RUNTIME_TARGET
    writes(2,"runtime_target is "+%string(RUNTIME_TARGET))
.endc
end

A corresponding linker option (also called -qrntcompat) enables you to verify at link time that the version of an object file is not greater than the specified version. When compiling with -qrntcompat, you must also specify -qrntcompat with either the same or a later version of value on the link line. Additional information is added to the object file (.dbo) to mark which version was targeted at compile time, and if an earlier version of the linker is used or specified with an earlier -qrntcompat value, the discrepancy can be caught at link time instead of runtime. For example, if a file is targeted or compiled under 10.3.3c and an earlier value is specified on the link line (e.g., dblink -qrntcompat=10010101), the error below will occur:

$ dblink -qrntcompat=10010101 file
%DBLINK-F-BADCMP, Bad module compile: MAIN$FILE compiled for 10.3.3c past 10.1.1a
%DBLINK-F-ABORT, Link aborted

Bounds checking

Bounds checking can help you find subscripting errors in your code. To turn bounds checking on, specify -qcheck (Windows and UNIX) or /CHECK=BOUNDS (OpenVMS) on your compiler command line. When you run your application, the runtime will report errors if your program subscripts outside the bounds of a field. When bounds checking is specified, Synergy DBL converts all pseudo arrays (for example, 10d2) to real arrays (for example, [10]d2). If you subscript array arguments, be sure to build the calling routine with bounds checking.

Keep in mind that bounds checking may also report “legal” subscripting errors. For example, the following code samples will generate subscript errors if bounds checking is turned on, even though the code is valid:

record
    var         ,[10]d2
    .
    .
    .
    var(1,20)="abcdef"

The above code is actually referencing var[1](1,20), the first element of the array, which has a length of 2. Because you are trying to write 20 characters to the two-character field, the runtime will report an error.

Suggestion: Put the array inside a group and reference the group name, or name the record and reference the record.

record
    var         ,10d2
    .
    .
    .
    xcall subr(var)
subroutine subr
    arg         ,d2
    .
    .
    .
    arg(2) = 10

The reference above will report an error if the subroutine is compiled with bounds checking and the calling module is not.

record name
    ivar        ,i4
    i2var       ,i4
    .
    .
    .
    clear ivar(1,8)

Suggestion: Use clear ^i(name).

record
    var         ,d2
    var2        ,d2
    .
    .
    .
    var(1,4) = 1010

or

    var(2) = 10

Suggestion: Use a group or name the record.

If you don’t want to modify your code, you can also use system option #54 to relax the bounds checking rules (for Windows and UNIX) to only report an error if you subscript off the end of the defined data space for a routine. Because this incurs a lot of overhead on each subscript, we do not recommend using system option #54 for production code.

If you encounter “segmentation fault errors,” we expect you to run your application with bounds checking on and then inspect the output to see if any reported problems are really problems. You may even want to modify your code so it does not try to subscript past the end of your fields. Then, when you run the bounds checking, all reported errors will be valid.

We suggest you turn bounds checking off before going to production.

Built-in compiler definitions

The compiler defines various symbols you may want to use in your programs. These built-in system defines include operating system or environment symbols, such as D_GUI, OS_VMS, and OS_UNIX (as well as DBLNET, D_NETSTANDARD, and D_PORTABLE for Synergy .NET), so you can conditionally compile your code based on the operating system on which you’re running. There are numerous values for I/O qualifiers, such as Q_NO_LOCK and Q_FIRST, and a _DEBUG define that enables you to include or exclude code depending on whether a program is compiled in debug mode. The RUNTIME_TARGET define enables you to programmatically determine the runtime setting that was used when the program was built. The DBLVnnnn defines enable you to compile code that supports different runtime targets.

For example, to use Synergy/DE 10.3.1 features, you’d use

.ifdef DBLV103

For 10.3.3, you’d use

.ifdef DBLV1033

And so on.

All of these defines are listed in the dbl.def file, which is included in your Synergy/DE distribution for reference purposes, although it is no longer used by the compiler.

Array size

The -s or -qdecscope options (/DECSCOPE on OpenVMS) affect the result of the ^SIZE operation when used on an array. For example, let’s assume you have the following array declarations:

array     ,[10]d4
pseudo    ,10d4

The effect of these options is as follows:

^SIZE reference

No -s or no /decscope

-s or /decscope

^size(array)

4

40

^size(array[ ])

40

40

^size(array[1])

4

4

^size(pseudo)

4

40

^size(pseudo[ ])

40

40

^size(pseudo(1))

4

4

Debugging

(OpenVMS only) Due to limitations of the DECC READ statement, specifying the /DEBUG option on certain combinations of stream file types produces incorrect line number information. If you’re using /DEBUG and your line numbers for blank lines are incorrect, try converting the file to a sequential file with carriage control set to CR/LF.

Data storage options

For information about the precedence of storage options (-qlocal, -qstack, and -qstatic) with their related storage qualifiers (LOCAL, STACK, STATIC, and REENTRANT in the RECORD, SUBROUTINE, and FUNCTION statements), see the Discussion for RECORD-ENDRECORD.

Examples

In the Windows and UNIX example below, the main.dbl and util.dbl source files are compiled, and the resulting object code is stored in main.dbo. A program listing is created and stored in the file listfile.lis. The +list option causes the compiler to override any nolist compiler options in .START and .NOLIST compiler directives in the source files. Therefore, all lines in the source files will be listed.

dbl -ld listfile +list main util

The following three Windows and UNIX examples do exactly the same thing: compile msmenu.dbl and generate a program listing called msmenu.lis. Note that in the third example, the “--” indicates the end of the option string and list options, so the compiler knows to use msmenu as the default argument to the -l option, in addition to using it as the source file.

dbl -l msmenu msmenu
dbl -l msmenu --msmenu
dbl -l --msmenu

In the OpenVMS example below, the MAIN.DBL and UTIL.DBL source files are compiled and the resulting object code is stored in MAIN.OBJ. A program listing is created and stored in the file LISTFILE.LIS. A symbolic access table is created.

$ DIBOL /LISTING=LISTFILE/DEBUG MAIN+UTIL

Redirecting compiler commands from a file on Windows and UNIX

To redirect compiler commands from a file, use the following format:

dbl [-T] <file

-T

(optional) Specifies that the command line(s) should be traced, or displayed, as they are executed. If you don’t specify -T, the command lines will not be displayed.

file

The ASCII file that contains one or more command lines to be input to the compiler.

The Synergy compiler supports continuation lines, which can make the files containing your compiler commands easier to read. If you need to continue a line to a new physical line, place the appropriate continuation character at the end of the line to be continued. The standard continuation line character is the backslash (\). On Windows, if you set system option #34, use a minus sign (-) as the continuation character.

The aggregate command line, including all continuation lines in the redirected input file, can be a maximum of 128K and 4000 files for dbl or 125 files for dblink and dblibr.

Assume the file main contains the following lines:

-d main util\
sub1\
sub2

If system option #34 is set on Windows, you would use the minus sign (-) as the continuation character and the forward slash (/) as the switch character. The file would look like this:

/d main util-
sub1-
sub2

To input the required information into the Synergy compiler from main.com with tracing set, type

dbl -T <main.cmd

The dbl8 compiler

Note

The dbl8 compiler is deprecated on UNIX and OpenVMS and was removed from Synergy/DE on Windows in version 11.1.1.

The dbl8 compiler was released with Synergy/DE 9 to handle specific instances in which the new compiler could not be used. Despite the name, the compiler distributed as dbl8 is not the same as the version 8 compiler. In fact, code compiled with dbl8 can be run only on Synergy/DE 9 and higher. The dbl8 compiler does not support Synergy objects. It supports all features and functions in the language as of version 8, as well as all version 8 compiler options.

You will rarely need to use dbl8, but it might be necessary on OpenVMS if your development machine has limited memory. Because the Synergy/DE compiler is designed to take advantage of memory to increase performance, if your system has less than 64 MB, we recommend that you use the dbl8 compiler instead. See Memory requirements for more information.