COMPILE statement
- Last Updated: February 11, 2026
- 30 minute read
- OpenEdge
- Version 13.0
- Documentation
Compiles a procedure file or a class definition file. A compilation can
last for a session, or you can save it permanently for use in later sessions (as an r-code
file, which has a .r extension).
When you compile a class definition file, ABL compiles the class definition
file identified in the COMPILE statement and all class files in its
inherited class hierarchy, by default. You can direct ABL to compile only those class
definition files in the class hierarchy that are not found in the cache, and cache any
classes or interfaces it compiles during the session, by setting the MULTI-COMPILE attribute to TRUE.
After you compile a procedure file, you use the RUN
statement to create an instance of the procedure, and you use a handle to access the
procedure and its context. After you compile a class definition file, you use the NEW function (classes) to create an instance of the
class, and you use an object reference to access the class-based object, as well as its data
members, properties, and methods.
For more information about compiling procedure files, see Develop ABL Applications. For more information about compiling class definition files, see Develop Object-oriented ABL Applications.
Syntax
|
- procedure-pathname | VALUE ( expression )
- Specifies the name and location of a procedure file you want to compile, where procedure-pathname is the literal procedure pathname and expression is a character expression that evaluates to the procedure pathname. This pathname can be a full (absolute) pathname or it can be a pathname (or procedure filename only) relative to PROPATH. The specified procedure filename must include the extension (.p or .w) whether you specify it alone or as part of a path. On UNIX, filenames are case sensitive, so you must enter them exactly as they are stored. In Windows, the pathname cannot contain characters outside of the non-Unicode code page. See Internationalize ABL Applications for more information about Unicode and code pages.
- class-pathname | VALUE ( expression )
- Specifies the name and location of a class definition file you want to compile. This can be a literal full (absolute) pathname or a literal pathname relative to PROPATH. If it is a relative pathname, the class or interface type name defined in the file must match the pattern of this relative pathname. If the type name is not defined with a package, the relative pathname must specify only the class filename. In all cases, the class filename must include the .cls extension. On UNIX, the class-pathname and corresponding class or interface type name are case sensitive, so you must enter them exactly as they are stored. In Windows, the he class-pathname and corresponding class or interface type name cannot contain characters outside of the non-Unicode code page. See Internationalize ABL Applications for more information about Unicode and code pages. For more information on packages and class or interface type names, see the Type-name syntax reference entry.
- OPTIONS options-list | OPTIONS-FILE { options-file | VALUE ( expression )}
- Enforces one or more rules during compilation. In the case of
OPTIONS, the rules are specified by a character expression that evaluates to a comma-separated list of options. In the case ofOPTIONS-FILE, the rules are specified in the same way, but supplied in a designated file.The possible options are described in the following table:
Option Description require-full-names[:Error |:Warning ]All table and field names must appear as they are in the schema. The compiler’s ability to implicitly resolve abbreviated names in tables is disabled. Optionally set severity level to
WarningorError.require-field-qualifiers[:Error |:Warning ]All buffer references (including database tables, temp-tables, and buffers) must be fully qualified. The compiler's ability to implicitly resolve the buffer to which a field reference refers is disabled. Optionally set severity level to
WarningorError.require-full-keywords[:Error |:Warning ]All language keywords must be fully spelled out. Optionally set severity level to
WarningorError.require-return-values[:Error |:Warning ]In user-defined functions, non-VOID methods, and property getters, all logical code paths must have RETURNvalue statements. For more information, see Require-return-values compiler option.Optionally set severity level to
WarningorError.Note that the severity level specifies what happens when there is a failure:Errorgenerates a message for each failure, and prevents the generation of r-code.Warninggenerates a message for each failure, but allows the generation of r-code, provided that the only failures during compilation are related to the option. (Other types of failure can prevent r-code generation.)- If no severity level is specified, the default is
Warning.
For example, the following
COMPILEstatement enforces full table and field names, and fully qualified references with different severity levels.
The code below shows access of a field with a fully qualified reference, followed by unqualified and abbreviated examples of the same statement. Only the first statement compiles without error if the code is compiled using the statement above.COMPILE myproc.p OPTIONS "require-field-qualifiers:Error,require-full-names"./* Accessing the field "tcfield" in the table "tbhelper" */ tbhelper.tcfield = "doUpdate". /* The following does not compile with "require-field-qualifiers:Error" in effect. */ tcfield = "doUpdate". /* The following compiles with "require-full-names" with default severity level in effect but warning messages are generated. */ tbh.tcf = "doUpdate".If options-list or the contents of the options-file resolve to the empty string ("") or white space only, then no options are applied. If options-list or the contents of the options-file resolve to the Unknown value (
?), then the compiler ignores theOPTIONSorOPTIONS-FILEphrase. If an option listed is not valid, the compile statement fails with an error. When compiling a class hierarchy, the options set in theCOMPILEstatement are applied to all files compiled for the hierarchy.You can also set these options using the
OPTIONSattribute of theCOMPILERsystem handle, which can be initialized with the Compiler Options (-compileroptionsfile) startup parameter. (See Startup Command and Parameter Reference for more information.) Options set using theOPTIONSorOPTIONS-FILEin theCOMPILEstatement override any options set in theOPTIONSattribute of theCOMPILERsystem handle (unless options-list or the contents of the options-file resolve to the Unknown value (?), as described above).Note:OPTION-FILEsupports the use of the hashtag (#) to include comments in the options file. See the Compiler Options (-compileroptionsfile) startup parameter in Startup Command and Parameter Reference for an example. - SAVE [ = logical-expression ][ INTO { directory | VALUE (expression) }]
- Produces a file that contains the r-code for the procedure or class
you are compiling.
If you specify a logical-expression, its value determines whether the
SAVEorSTREAM-IOoptions are activated. If the logical-expression is evaluated to the Unknown value(?), a run-time error occurs.When you compile a class definition file with the
SAVEoption, ABL produces an r-code file for the class definition file and all class files in its inherited class hierarchy. For example, if you compile a class definition file that has two classes in its inherited class hierarchy, ABL compiles three files and produces three r-code files.These r-code files are saved across ABL sessions. If you do not use the
SAVEphrase, theCOMPILEstatement produces r-code for the source procedure or class, but the r-code is not saved across ABL sessions. This r-code is a session-compile version of the procedure or class.The
COMPILE SAVEstatement produces r-code files with the name procedure-pathname.ror class-pathname.r, where procedure-pathname is the pathname of a procedure source file without the filename extension, and class-pathname is the pathname of a class source file without the filename extension. ABL ignores the filename extension of a procedure or class definition file and always creates r-code files that use the same filename with a.rextension. For example, if you supply a filename oftest,test.p, ortest.cls,COMPILE SAVEproduces an r-code file with the nametest.r. If you specify a filename of test.bp,COMPILE SAVEstill produces an r-code file with the name test.r.CAUTION: Where both procedure and class definition files compile to a.rfile, be sure to use distinct filenames. If you have a procedure file and a class definition file with the same name, and you compile them both withCOMPILE SAVE, the first.rfile is overwritten by the second.rfile.By default, the r-code file is stored in the same directory as the source file. The r-code files for inherited (super) class definition files are also stored in the same directory as their respective source files.
If you use the
SAVE INTOphrase, r-code files produced by a compilation can be saved in a different directory. See the Examples section and the Notes section of this reference entry for more information.A newly created r-code file replaces any existing r-code file of the same name.
- LISTING {listfile| VALUE ( expression ) }
- Produces a compilation listing that includes:
- The name of the file containing the procedure or class you compile
- The date and time at the start of the compilation
- The number of each line in the procedure or class file
- The block number where each statement belongs
- The complete text of all include files (except encrypted include files) and the names of any subprocedures and user-defined functions
The listfile or
VALUE( expression ) identifies the name of the file in which you want to store the Compiler listing. If expression evaluates to the Unknown value (?), then ABL ignores theLISTINGoption. In Windows, the filename cannot contain characters outside of the non-Unicode code page. - APPEND [ = logical-expression]
- Appends the current listing to the contents of the listing file. If
you do not use the
APPENDoption, ABL creates a new listing file, replacing any file of the same name.If you specify a logical-expression, its value determines whether the
APPENDoption is activated. If the logical-expression is evaluated to the Unknown value (?), a run-time error occurs. - PAGE-SIZE integer-expression
- Identifies the number of lines to a page in the listing file. The default page size is 55 and integer-expression must be between 10 and 127, inclusive.
- PAGE-WIDTH integer-expression
- Identifies the number of page columns in the listing file. The default page width is 80, and integer-expression must be between 80 and 255, inclusive. Add at least 12 spaces to the page width when you type the file. This allows you to list information that precedes each line of code, ensuring that the file appears in the listing output exactly as you typed it.
- XCODE expression
- Decrypts the source code in procedure-pathname or class-pathname,
and any encrypted include files, using the decryption key expression. The decryption key is also used with any class or interface in
the hierarchy or any object-oriented ABL reference in a procedure or class that is not
in the class hierarchy.Note: The
XCODEoption is not supported when FIPS mode is enabled. Compilation of encrypted source code will fail with an error. This behavior impacts the functionality of Data Administration dump or load utilities. To work around this limitation, you can:- Use ABL code for Data Administration operations while FIPS mode is enabled.
- Perform binary dump or load using the
PROUTILutility when FIPS mode is enabled. - Run Data Administration utilities in environments where FIPS mode is disabled.
When the
COMPILEstatement detects that a source file is encrypted, it performs the following checks:- If the
XCODEoption is provided, thenCOMPILEuses the key specified by expression. If the key does not match the source file key, then the compilation fails with an error message. Use this option only when the encryption key is not the built-in (default) key or the encryption key for the session. - If
XCODEis not present, theCOMPILEstatement looks for a session-level encryption key in theXCODE-SESSION-KEYattribute of theSECURITY-POLICYhandle. IfCOMPILEfinds a session key and it does not match the source file key, then the compilation fails with an error message. - If
XCODEis not present and there is no session key, theCOMPILEstatement uses the default key. If the default key does not match the source file key, then the compilation fails with an error message. If a session key is in effect and you want aCOMPILEstatement to use the default key, then you must unset theXCODE-SESSION-KEYattribute by setting it to the Unknown value (?) before executing theCOMPILEstatement. - The
XCODEutility does not perform code page conversions and does not use the-cpinternalparameter when encrypting files. Therefore, the source code and key use the default code page of the operating system where you run theXCODEutility. If a different code page is in effect whereXCODE-SESSION-KEYis set, then code page conversions may prevent the attribute key from matching theXCODEutility key and the compile fails. To prevent this case, use only US-ASCII characters, which are found in all code pages below code point 128.
Include files that are not encrypted are included and compiled in the standard manner.
Having the decryption key does not allow you to examine a decrypted version of the source code.
Note: You cannot useXCODEwith theXREF,XREF-XML,STRING-XREF, orLISTINGoptions together. Also, if theDEBUG-LISToption is used with an encrypted source file, the resulting debug file only contains a notice that the source file is encrypted. - XREF {xreffile| VALUE ( expression ) } [ APPEND [ = logical-expression ] ]
- Returns reference information on ABL elements, cross-references
between procedures and ABL objects, and cross-references between class or interface
definition files and ABL objects. See Table 1 for more information on the type of reference information
returned.
Information can be written to the file xreffile or VALUE ( expression ). If expression returns the Unknown value (
?), then ABL ignores the XREF option.In addition, you can use the
APPENDoption to add information to an existing file. When you useAPPEND, the first line for a procedure contains information for theCOMPILEtype. This allows you to easily find where the information for each compilation begins. If you specify a logical-expression, its value determines whether theAPPENDoption is activated. If logical-expression is evaluated to the Unknown value (?), a run-time error occurs.XREFgenerates one unformatted, white space-separated line in xreffile for each referenced element. Each line has the following format:source-name file-name line-number xref-type xref-informationThe source-name is the name of the procedure or class file you compile with the
COMPILE XREFstatement. The file-name is the name of the file containing the referenced element. For example, file-name could be an include file. Otherwise, file-name is the same as source-name. The line-number is the line number of the statement in file-name that contains the referenced element. The xref-type is the type of reference in the code and xref-information contains details about the reference.The possible values for xref-type and xref-information appear in the following table.
Table 1. XREF types and XREF information XREF type XREF information ACCESS
{[ DATA-MEMBER ][database. ]tablefield [ WORKFILE | TEMPTABLE ]}| { SHARED variable }| { PUBLIC-DATA-MEMBER class-name:data-member-name }| { PACKAGE-PROTECTED-DATA-MEMBER class-name:data-member-name }| { PACKAGE-PRIVATE-DATA-MEMBER class-name:data-member-name }| { INHERITED-DATA-MEMBER class-name:data-member-name }| { PUBLIC-PROPERTY class-name:property-name}| { PACKAGE-PROTECTED-PROPERTY class-name:property-name }| { PACKAGE-PRIVATE-PROPERTY class-name:property-name }| { INHERITED-PROPERTY class-name:property-name} | {sequence-name SEQUENCE }ANNOTATION
stringBLOCK-LEVEL
ON ERROR UNDO, THROW1 [ (-undothrow)2 ]CAST
[ FROM source-class-name ] TO target-class-nameCLASS
class-name,[ INHERITS inherited-class-name [ (inherited-class-name ...) ] ], [ IMPLEMENTS interface-name [ interface-name] ... ], [ USE-WIDGET-POOL ], [ FINAL ], [ ABSTRACT ], [ SERIALIZABLE ]COMPILE
procedure|class-fileCONSTRUCTOR
{{PUBLIC|PACKAGE-PROTECTED|PROTECTED|PACKAGE-PRIVATE} |{ , STATIC }},,,constructor-name, void, [parameter1[ , parameter2 ]...]CPINTERNAL
code-page-name-that-ABL-uses-in-memory CPSTREAM
code-page-name-that-ABL-uses-for-stream-I/O CREATE
{[ DATA-MEMBER | INHERITED-DATA-MEMBER ] class-name:table-name}| [database. ]table [ WORKFILE | TEMPTABLE ]}DATA-MEMBER
{PUBLIC|PACKAGE-PROTECTED|PROTECTED|PACKAGE-PRIVATE}, [ STATIC ], [ TEMPTABLE | BUFFER | QUERY | DATASET | DATASOURCE ], data-memberDATASET
dataset-name, { PROTECTED }, [ REFERENCE-ONLY ], [ NAMESPACE-URI namespace], [ NAMESPACE-PREFIX prefix ], buffer-name1[[ buffer-name2]...], [DATALINKS]DELETE
{[ DATA-MEMBER | INHERITED-DATA-MEMBER ] class-name:table}| [ database. ]table[ WORKFILE | TEMPTABLE ]DELETE-INSTANCE
class-name DESTRUCTOR
PUBLIC,,,,destructor-name,void,DLL-ENTRY
procedure-name,, [parameter1 [ , parameter2 ]...]EXTERN
function-name,return-type, [parameter1 [ , parameter2 ]...]EVENT
{PUBLIC|PACKAGE-PROTECTED|PROTECTED|PACKAGE-PRIVATE}, [ STATIC ], [ OVERRIDE ],,[ ABSTRACT ], event-name, [delegate-type-name ], return-type, [parameter1 [ , parameter2 ]...]FOR EACH: JOIN BY SQLDB
Not applicable (Data Servers only)FUNCTION
function-name,return-type, [parameter1 [ , parameter2 ]...]GLOBAL-VARIABLE
global-variable INCLUDE
include-file-name INTERFACE
interface-type-name, [ INHERITS interface-type-name [ (interface-type-name...)]],,,INVOKE
class-name:method-name [ , invocation-parameter1 [ , invocation-parameter2 ]...]METHOD
{PUBLIC|PACKAGE-PROTECTED|PROTECTED|PACKAGE-PRIVATE}, [ STATIC ], [ OVERRIDE ], [ FINAL ], [ ABSTRACT ], method-name, return-type, [parameter1 [ , parameter2 ]...]NEW
class-name [ , invocation-parameter1 [ , invocation-parameter2]...]NEW-SHR-DATASET
dataset-name, { PROTECTED }, [ REFERENCE-ONLY ], [ NAMESPACE-URI namespace], [ NAMESPACE-PREFIX prefix ], buffer-name1[[ buffer-name2 ]...], [ DATALINKS ]NEW-SHR-FRAME
new-shared-frame NEW-SHR-TEMPTABLE
temptable-name NEW-SHR-VARIABLE
new-shared-variable NEW-SHR-WORKFILE
new-shared-workfile [ LIKE [database. ]table ]PROCEDURE3
procedure-name,, [parameter1 [ , parameter2 ]...]PRIVATE-FUNCTION
function-name, return-type, [parameter1[ , parameter2 ]...]PRIVATE-PROCEDURE
3procedure-name,, [parameter1 [ , parameter2]...]PROPERTY
{PUBLIC|PACKAGE-PROTECTED|PROTECTED|PACKAGE-PRIVATE} [ STATIC ], [ OVERRIDE ], [ FINAL ] ,[ ABSTRACT ], property-namePUBLISH4
[class-name: ]event-name| (exp)REFERENCE
{[ database. ]table [ field ] [ WORKFILE ]}|{ SHARED variable | {[ DATA-MEMBER | INHERITED-DATA-MEMBER ] class-name:table[field ]}ROUTINE-LEVEL
ON ERROR UNDO, THROW1 [ (-undothrow)2 ]RUN3
procedure-name |value(exp) [ PERSISTENT | REMOTE | SINGLE-RUN | SINGLETON | SUPER | STORED-PROC ]SEARCH5
{[ database. ]table| {[ DATA-MEMBER | INHERITED-DATA-MEMBER ] class-name:table }}{ WORKFILE | {{index| RECID }[ TEMPTABLE ] [ WHOLE-INDEX | TABLE-SCAN ]}}SHR-DATASET
dataset-name, { PROTECTED }, [ REFERENCE-ONLY ], [ NAMESPACE-URI namespace], [ NAMESPACE-PREFIX prefix ], buffer-name1[[ buffer-name2 ]...], [ DATALINKS ]SHR-FRAME
shared-frame SHR-TEMPTABLE
temptable-name SHR-WORKFILE
shared-workfile[ LIKE [ database. ]table]SORT-ACCESS
{[ database. ] tablefield [ WORKFILE | TEMPTABLE ]}SORT-BY-EXP
{ FOR EACH | OPEN QUERY }table BY expressionSTRING
char-string max-length justification translatable [ FORMAT ]SUBSCRIBE6
[class-name: ]event-name | (exp) [ , [class-name: ]handler-name [ , parameter1 [ , parameter2]...]]UNSUBSCRIBE6
[class-name: ]event-name | (exp) | ALL [ , [class-name: ]handler-name [ , parameter1 [ , parameter2]...]]UPDATE
{[ DATA-MEMBER ][ database. ] table field [ WORKFILE | TEMPTABLE ]}| { SHARED variable }| { PUBLIC-DATA-MEMBER class-name:data-member-name }| { PACKAGE-PROTECTED-DATA-MEMBER class-name:data-member-name }| { PACKAGE-PRIVATE-DATA-MEMBER class-name:data-member-name }| { INHERITED-DATA-MEMBER class-name:data-member-name }| { PUBLIC-PROPERTY class-name:property-name}| { PACKAGE-PROTECTED-PROPERTY class-name:property-name }| { PACKAGE-PRIVATE-PROPERTY class-name:property-name }| { INHERITED-PROPERTY class-name:property-name}| {sequence-name SEQUENCE }This is the syntax for data-member-name:
variable-name|{[ dataset-name]table[ field ]}This is the syntax for invocation-parameter:
{ INPUT | INPUT-OUTPUT | OUTPUT } { [data-type[ EXTENT [constant]]| TABLE temp-table-name| TABLE-HANDLE | DATASET dataset-name| DATASET-HANDLE | TABLE-REFERENCE | DATASET-REFERENCE| RUNTYPE }The invocation parameters are listed for every constructor or method invocation that has arguments. If a method or constructor is overloaded, invocation parameters can be used to determine which version of the method or constructor is being invoked. If the compiler has not resolved the method call (that is, it has deferred resolution to run time), one or more of the invocation parameters may be identified as
TABLE REFERENCE,DATASET REFERENCE, orRUNTYPE. This label indicates that the argument being passed matches the type of the corresponding parameter in more than one of the candidate overloads.In the case of
TABLE REFERENCEorDATASET REFERENCE, the parameter may be a static temp table or dataset or a handle to a temp table or dataset.RUNTYPEmeans that the compiler cannot determine the type because the argument is, for example,BUFFER-FIELD(1):BUFFER-HANDLE.EXTENTwithout a constant integer value following it may simply mean that the parameter is defined as indeterminate, or it may mean that the call has not been resolved and the candidate overloads have arrays of different extents at that position in the parameter list.The following notes describe more usage information for Table 1:
PUBLIC-DATA-MEMBER,PACKAGE-PROTECTED-DATA-MEMBER, andPACKAGE-PRIVATE-DATA-MEMBERindicate that a line of code in a client of a class references a class public data member through an object reference. For example:localvar = MyInstance:PubMember. Properties are treated similarly.- In contrast to
PUBLIC-DATA-MEMBER,INHERITED-DATA-MEMBERindicates that a line of code references a data member inherited by the class in which the reference appears.DATA-MEMBERin anUPDATEorACCESSentry indicates that a line of code references a temp-table or related object that has been defined in the class in which the reference appears. Properties are treated similarly. - There are quotes around the name of a class or interface if its package name includes a space.
- In the
CLASSentry,INHERITSinherited-class-name indicates the immediate super class of the class, if any exists. If the super class inherits from one or more classes, the names of these classes appear following the name of the immediate super class of the compiled class. Each inherited class name is separated from the preceding one by a space. XREFoutput includes"STRING"reference type entries. In addition to the strings that are already logged (variable names, function and procedure names, and so on), theXREFoutput now includes"STRING"reference type entries for class names, inherited class names, implemented interface names, method names, property names, and data member names.- If a class has a super class but does not explicitly execute the
SUPERstatement in its constructor, the ABL compiler adds an implicitSUPERinvocation to the r-code. When this happens, there is anINVOKEentry generated for the implicitSUPERinvocation. This entry indicates that the name of the method being invoked is super-class-type-name:class-name (the constructor name). Instead of a line number, the entry uses the labelIMPLICIT. - As is the case with procedures and functions, the entry for a
method, constructor, or destructor is made during compilation of the element's
ENDstatement. Therefore, aMETHODentry appears after the entries for items encountered within the method, and the line number given is the line number of itsENDstatement. - Note that field for
REFERENCEis optional. It does not appear if the corresponding line of code is eitherVALIDATEtemp-table orRELEASEtemp-table. - If a class has as a data member an ABL handle and code uses that
handle to call a built-in ABL method or to set or get a built-in attribute, the
XREFoutput includes just anACCESSentry and the entry identifies only the name of the handle data member, not the method or attribute involved. (This is similar to howXREFhandlesSHAREDvariables that are handles.) - The
XREFentry forCASTincludes the source type if it is possible to determine the source type at compile time. If not, it includes only the target type.
Note: You cannot use theXREFandXCODEoptions together. That is, you cannot create a cross-reference listing from code that is encrypted. - XREF-XML { directory |filename | VALUE ( expression ) }
- Writes reference information to a formatted XML file. The standard
XREFoption writes the information to an unformatted text file. TheXREF-XMLoption provides structured output that is formatted with white space for easier parsing by humans. More importantly, this option exposes the reference information in a format that developers can exploit with custom-built tools or visualize in a ProDataset or a .NET dataset.Table 1 and the accompanying documentation in the
XREFoption section describes the XREF type and XREF information returned by either theXREFor theXREF-XMLoptions. When you useXREF-XML, the XREF type is assigned to theReference-typeattribute. However, XREF information can be assigned to a number of XML elements including theObject-identifierattribute.For compiling a single procedure or class, you can provide a filename for the XML output file. However, this output file is overwritten each time the compiler needs to compile a linked class or procedure.
For compiling several procedures and classes in a single compile statement, supply a directory for the
XREF-XMLoption. TheXREF-XMLoption uses this directory and a standard naming convention to capture the cross-reference information from multiple procedures and classes in separate files. Contrast this with theAPPENDmode used by theXREFoption.When a directory is supplied, the compiler takes the root name of the procedure or class being compiled and creates a cross-reference file with this name and a .xref.xml file extension (sourcefilename.xref.xml). It stores it in the directory path specified, creating any necessary subdirectories that do not exist. If the main directory specified does not exist, then an error is raised.
If the filename supplied to the compiler begins with a relative path, then the directory name supplied to the
XREF-XMLoption includes that relative path. For example, suppose your Unix PROPATH is /projectA/source and you run thisCOMPILEstatement:COMPILE test/procedureA.p XREF-XML /projectA/xrefThe
COMPILEstatement looks for the source file /projectA/source/test/procedureA.p and place theXREF-XMLoutput in /projectA/xref/test/procedureA.xref.xml (if the source file successfully compiles).If the source file uses a full path, then the
XREF-XMLoption stores the output in the directory provided, ignoring the path of the source file.You may want to check for possible filename collisions before using this option. For example, if you have myCode.p and myCode.cls, both use the myCode.xref.xml output file, destroying some of your cross-reference information.
When you use the
VALUEoption to provide a filename or directory path, ifVALUEreturns the empty string or the Unknown value (?), then the compiler ignores theXREF-XMLoption.If class definition source files in a class hierarchy are in different directories, matching subdirectories are created for them under the provided XREF-XML directory.
The XML Schema used with XREF-XML output files is stored in the following location: $DLC/properties/schemas/xrefdxxxx.xsd. The XXXX portion of the file name indicates the version number of the file.
You can see an example on the difference between
XREFandXREF-XMLoutput in the Examples section at the end of theCOMPILEstatement reference.Note: You cannot use theXREF-XMLoption with theXREFoption or with theXCODEoption at the same time. - STRING-XREF {sxreffile | VALUE ( expression ) } [ APPEND [= logical-expression ] ]
- Writes cross-reference string information between procedures and ABL
objects, or between class definition files and ABL objects, to the file sxreffile or
VALUE( expression ). If expression evaluates to the Unknown value (?), ABL ignores theSTRING-XREFoption.String Xref Version x.ysource-filecode-pageThe x.y is a major.minor version number, where a major version change implies a formatting change that is not backward compatible with older versions of TranManII. The source-file is the name of the file from which the strings are extracted. The code-page is the code page with which the file was written.
The line for each string appears in the following format:
line-number object-name string max-length string-justification statement-type detail-infoThe line-number is the same as line-number in the standard XREF file. The object-name is the name of the object with which the string is associated. The max-length and string-justification come from the string attribute (either explicit or implicit) and reflect the attributes applied to the string as it is entered into the text segment.
The statement-type describes the type of statement in which the string appears. Only one statement type appears in a given string's output line. The values in the following table are possible:
Statement type values ASSIGN DEF-SUB-MENU INSERT PUT-SCREEN CASE DISPLAY MESSAGE REPEAT CREATE DO OPEN-QUERY RUN DEF-BROWSE ENABLE OTHER SET DEF-BUTTON EXPORT PAUSE STATUS DEF-FRAME FOR PROMPT-FOR UPDATE DEF-IMAGE FORM PUT VIEW-AS DEF-MENU IF – – Note: Any statement type that is not included in the preceding list appears asOTHER.The detail-info is one or more detail tags that specify more specifically where the string appears in the statement. The values in the following table are possible:
Detail tags ASSIGN FORMAT MESSAGE TITLE COL-LABEL IMAGE-FILE NON-ALPHA VALUE COMBO-BOX-ITEM INPUT PROMSGS WHEN CUR-LANG INPUT-PARAM PROPATH WHERE DEFAULT LABEL SEL-LIST-ITEM WHILE EXPR LIST-ITEM TERMCAP – Note: TheNON-ALPHAtag indicates that a string consists entirely of blanks or digits. TheFORMATtag is followed by one of the following tags:CHAR, NUMERIC(includes decimal and integer),DATE, orBOOL. These tags indicate the type of format. When a string can appear in only one place in a statement, no detail tag appears.The following table shows the valid combinations of statement types and detail tags.
Table 2. Valid statement type and detail tag combination Statement type Detail tags ASSIGN CUR-LANG, PROMSGS, PROPATH, TERMCAP CASE WHEN CREATE N/A DEF-BROWSE FORMAT, COL-LABEL DE-FBUTTON IMAGE-FILE, LABEL DEF-FRAME FORMAT, COL-LABEL, LABEL DEF-IMAGE IMAGE-FILE DEF-MENU TITLE, LABEL DEF-SUB-MENU LABEL DISPLAY FORMAT, LABEL, COL-LABEL, WHEN, TITLE DO WHILE, WHERE, TITLE ENABLE LABEL, COL-LABEL, WHEN, TITLE EXPORT FORMAT FOR WHILE, WHERE, TITLE FORM FORMAT IF N/A INSERT TITLE MESSAGE TITLE, FORMAT PAUSE MESSAGE PROMPT-FOR WHEN, TITLE, FORMAT, LABEL, COL-LABEL PUT N/A PUT-SCREEN N/A REPEAT WHILE, TITLE, WHERE RUN INPUT-PARAM SET WHEN, ASSIGN, FORMAT, LABEL, COL-LABEL, TITLE STATUS DEFAULT, INPUT UPDATE WHEN, ASSIGN, FORMAT, LABEL, COL-LABEL, TITLE VIEW-AS SEL-LIST-ITEM, COMBO-BOX-ITEM - STREAM-IO [ = logical-expression ]
- Specifies that all output from the compiled procedure or class is
formatted for output to a file or printer. This means that all font specifications are
ignored and all frames are treated as if they had the
USE-TEXToption given. This produces a platform-independent output appropriate for printing. - LANGUAGES ( { language-list | VALUE ( expression ) } )
- Identifies which language segments to include in the compiled
r-code.
Language-list is a comma-separated list of language definitions used to generate each text segment. Each language definition consists of a colon-separated list of languages, in order of preference, used to find the translation of each string stored in the text segment.
Expression (inVALUE(expression))is a character expression equivalent to the language-list. If expression evaluates to the Unknown value (?), then ABL ignores theLANGUAGESoption.Translated character strings for each specified language are read from the translation database and are stored in segments within the r-code. For example:
COMPILE myfile.p LANGUAGES (French-Canadian:French:English,Portuguese:Spanish, New-York:American:English).If you use an expression to specify language-list, you must use the
VALUEoption. For example:COMPILE myfile.p LANGUAGES (VALUE(char-var)). /* char-var = "French-Canadian:French:English,Portuguese:Spanish, New-York:American:English" */In this example, the compiler searches the translation database for French-Canadian translations. If a French-Canadian translation is not found, the compiler searches for a French translation. If a French translation is not found, the compiler searches for an English translation. If an English translation is not found, the compiler uses the strings from the source code.
This example generates four text segments: French-Canadian, Portuguese, New-York, and the unnamed (default) text segment. The first language name in each language-list argument designates the name of the text segment and specifies the first language that the compiler looks up in the translation database. As a result, it is possible to create a text segment whose name has no relationship to the languages it is composed of. For example, the following argument creates a text segment named
BABEL:LANGUAGES(BABEL:French:Spanish:Italian:German)Provided there is no language named
BABELin the translation database, the strings in this text segment would be either French, Spanish, Italian, or German, depending on which strings have translations in which languages. - TEXT-SEG-GROW = growth-factor
- Specifies the factor by which ABL increases the length of strings.
When you develop an application that is going to be translated, it is important to allow
for the growth of the text in your widgets. If you use the
TEXT-SEG-GROWoption, ABL increases the size of the text strings when it compiles your application.ABL uses the following formula to determine the length of strings:
New-length = Actual-length * ( 1 + ( growth-factor/100 * ( table-value/100 ) ) )Where:
- New-length is the new string length.
- Actual-length is the actual string length.
- growth-factor is the value specified with the TEXT-SEG-GROW option.
- table-value is the
appropriate percentage from the following table:
String length Expansion percentage 1-10 characters 200% 11-20 characters 100% 21-30 characters 80% 31-50 characters 60% 51-70 characters 40% More than 70 characters 30%
For example, if you have a text string that is 25 characters and you specify a growth-factor of 50, ABL applies the formula as follows and defines the New-length as 35:
New-length = 25 * ( 1 + (80/100 * (50/100)) )Note:TEXT-SEG-GROWis supported only when you also use theLANGUAGESoption. - DEBUG-LIST {debugfile| VALUE ( expression ) }
- Writes the debug listing to the file debugfile or
VALUE(expression). If expression evaluates to the Unknown value (?), then ABL ignores theDEBUG-LISToption. The debugfile consists of a line-numbered listing of the procedure with the text of all preprocessor include files, names, and parameters inserted. In Windows, the filename cannot contain characters outside of the non-Unicode code page. - PREPROCESS {preprocessfile| VALUE ( expression ) }
- Preprocesses the procedure or class definition file and writes the
preprocessed source code to the file preprocessfile
or
VALUE(expression). If expression evaluates to the Unknown value (?), ABL ignores thePREPROCESSoption. The preprocessfile is a text file that contains a final version of your source code after all include files have been inserted and all text substitutions have been performed. In Windows, the filename cannot contain characters outside of the non-Unicode code page. - V6FRAME [ = logical-expression ][USE-REVVIDEO | USE-UNDERLINE]
- The
V6FRAMEoption is designed specifically to compile and run Progress Version 6 applications with Progress Version 7 or later in Windows. This option uses theV6FontNumbersetting in the [Startup] section of the current environment (which might be the Registry or an initialization file) to calculate the height and width of a character unit and then set the layout grid used to compile frames for display in Progress Version 7 or later.At run time, the
FONTattribute for a frame compiled with theV6FRAMEoption is set to the font number specified with theV6FontNumbersetting. The default setting for theV6FontNumbersetting is 3.By default,
V6FRAMEdisplays a border around a fill-in field. This means that your code requires more space on the screen than in Progress Version 6. You can override this behavior with one of the following options:USE-REVVIDEOdisplays no border around a fill-in field. When a fill-in is enabled for input, the color of the fill-in changes to the color specified with theINPUTsetting in the [Colors] section in the current environment (which might be the registry or an initialization file). The IBEAM cursor signals that a fill-in field has input focus.USE-UNDERLINEdisplays no border around a fill-in widget. When a fill-in is enabled for input, the underline attribute of the font (V6FontNumber) for the fill-in is turned on. The color of a fill-in enabled for input does not change. The IBEAM cursor signals that a fill-in field has input focus.
The
V6FRAMEoption also limits the vertical size of a frame title to one character unit based upon the layout grid. The text of the frame title is in the font specified with theV6FontNumbersetting in the [Startup] section of the current environment (which might be the registry or an initialization file).The
V6FRAMEoption governs the appearance of screen output only. Use theSTREAM-IOoption to compile procedures that output to files and printers. If you specify theV6FRAMEandSTREAM-IOoptions in the sameCOMPILEstatement, theSTREAM-IOoption overrides theV6FRAMEoption.If you specify a logical-expression, its value determines whether the V6 compile option is activated. If the logical-expression is evaluated to the Unknown value (
?), a run-time error occurs.For more information on the environment for an ABL session, see Manage ABL Applications.
- MIN-SIZE [ = logical-expression ]
- Minimizes the size of the generated r-code file by eliminating the
Debugger Segment (which is used by the OpenEdge Debugger) and the signature descriptor
data (which is used by the Open Client Proxy Generator).
If you specify a logical-expression, its value determines whether the
MIN-SIZEoption is activated (TRUE) or not (FALSE). If the logical-expression evaluates to the Unknown value (?), a run-time error occurs. The default value is FALSE. - DEFAULT-UNTRANSLATABLE [ = logical-expression ]
- If the logical-expression evaluates to
YES/TRUE, then literal character strings with no string attributes are considered untranslatable. This is the same behavior as if the string:Usyntax is used (see " "Character-string literal for more information on string attributes).If the option is not specified, or
DEFAULT-UNTRANSLATABLE=FALSE, then literal character strings with no attributes are considered translatable.If the logical-expression evaluates to the Unknown value (
?), a run-time error occurs.The following code example describes the behavior if theDEFAULT-UNTRANSLATABLEoption is not specified or if set toNO/FALSE./* Behavior without DEFAULT-UNTRANSLATABLE */ VAR CHARACTER str. /* If :U not specified, we assume it's translatable. */ str = "Hello!". /* :U means untranslatable. */ str = "Hi there!":U. /* In this case, the compiler will not be able to put the strings together if either string is translatable. */ str = "Hello " + "World!".The following code example describes the behavior ifDEFAULT-UNTRANSLATABLEis set toYES/TRUE./* Behavior with DEFAULT-UNTRANSLATABLE=TRUE */ VAR CHARACTER str. /* Because of DEFAULT-UNTRANSLATABLE, it's marked as untranslatable. */ str = "Hello!". /* :U means untranslatable. */ str = "Hi there!":U. /* In this case, the compiler will be able to put the strings together because both are untranslatable. */ str = "Hello " + "World!".Note: The Default Untranslatable (-defuntrans) startup parameter can be used to enable the untranslatable behavior for compiles during the session. - NO-ERROR
- The NO-ERROR option is used to prevent the statement from raising
ERRORand displaying error messages.You can also check the
ERRORandWARNINGattributes of theCOMPILERsystem handle to determine whether an error or warning occurred.
Examples
Example 1: COMPILE with SAVE option
In this procedure, ABL compiles the ord-ent procedure, produces an r-code file, ord-ent.r, that can be used across ABL sessions, and saves the r-code file in the current directory:
r-cmple.p
|
Example 2: COMPILE with SAVE INTO option
You can save the r-code file in a different directory by using the
SAVE INTO phrase. For example, to save an r-code file in /usr/sources on a UNIX system, enter this command:
|
Example 3: COMPILE with SAVE INTO option for class files
|
SAVE INTO option.
|
The .r file is saved into /rcode/Classes/OE.
|
SAVE INTO option with this command:
|
ABL saves the .r file into /rcode. No subdirectories are created because myClass2.cls is in the default package.
Example 4: COMPILE with SAVE, LISTING, XREF, XREF-XML, and DEBUG-LIST options
The following example shows the effect of include files on compilation listings:
r-incl.p
|
Suppose you use the following COMPILE statement to
compile the r-incl.p procedure:
r-comlis.p
|
This COMPILE statement produces four files: r-incl.r, r-incl.lis,
r-incl.xrf, and r-incl.dbg.
The following listing contains the contents of the r-incl.lis, r-incl.xrf, and r-incl.dbg files:
r-incl.lis
|
This sample output is not an exact copy of the r-incl.lis file.
There are three columns next to the procedure in the listing file:
- {} — The level of the include file
- Line — The line number in the file
- Blk — The number of the block
The information follows each of the procedure blocks or function blocks:
- Line — The line number where the block starts
- Blk. Type — The type of block (Procedure, DO, FOR EACH, REPEAT)
- Tran — Whether the block is a transaction block
- Blk. Label — The label of the block
- Buffers — The name of the record buffer scoped to the block
- Frames — The name of the frame scoped to the block
This is the cross-reference file r-incl.xrf:
r-incl.xrf
|
Each line in the xref file
specifies the procedure, line number, access type, and access information. The first line in
the xref file contains the COMPILE
access type directive and the name of the procedure exactly as it appears in the
COMPILE statement. See Table 1
for a list of the values that follow a particular access type (for example, table and index after
SEARCH).
If you modified r-comlis.p to use
the XREF-XML option instead of XREF, your cross reference
file would be named r-comlis.xref.xml. The structured
formatting of XML would use many more lines to display the same information on one line of
standard XREF output. Here is a small snippet of that file:
|
This is the debug listing r-incl.dbg:
r-incl.dbg
|
For a class that implements an interface hierarchy or an interface that inherits an interface hierarchy, the whole of the hierarchy appears in the XREF and XREF-XML as a complete list. The following example illustrates the comparison of XREF output both with and without interface inheritance.
XREF output without interface inheritance
|
XREF output with interface inheritance
|
Because interfaces support multiple inheritance, the order of the interface hierarchy cannot be determined.
The following example is for the XREF-XML output both with and without interface inheritance.
XREF-XML output without interface inheritance
|
XREF-XML output with interface inheritance
|
Notes
- When compiling class definition files, the following options apply to
the class definition file identified in the
COMPILEstatement and all class files in its inherited class hierarchy:XCODE,STREAM-IO,LANGUAGES,V6FRAME, andMIN-SIZE. - When compiling class definition files, the following options apply
only to the class definition file identified in the
COMPILEstatement, and not to the class files in its inherited class hierarchy:PREPROCESS,LISTING,DEBUG-LIST,XREF, andSTRING-XREF. - If you want all record retrieval statements in a procedure to default
to
NO-LOCK, you must compile the procedure in an ABL session started with the No Lock (-NL) startup parameter. For more information on record locking, see Develop ABL Applications. For more information on the No Lock (-NL) startup parameter, see Startup Command and Parameter Reference. - Two additional startup parameters are available that can affect the
behavior of the
COMPILEstatement: Compile Warning List (-cwl) and Keyword Forget List (-k). The Compile Warning List option lets you specify a set of ABL statements that trigger compile-time warnings if they are found in the source code. The Keyword Forget List option lets you disable specified keywords, allowing you to compile code in which those keywords occur as ABL user-defined element names, such as table, field, variable, and procedure names. For more information about these startup parameters, see Startup Command and Parameter Reference. - The value of the PROPATH environment variable defines the list of directories (path) to use when searching for a procedure.
- The ABL compiler does not search libraries for include files referenced in a procedure.
- On UNIX, you define the PROPATH variable in a startup script or in
your .profile file. In Windows, you can define your
PROPATH in the Registry or in an initialization file. You can also define the PROPATH
interactively at the operating system level.
In addition to any directories you define for PROPATH, ABL searches the directory containing the ABL system software. If you do not define a value for PROPATH, ABL searches your working directory by default.
- To locate the source file that you name in the
COMPILE SAVEstatement, ABL searches the first directory in PROPATH. If the source file is there, ABL compiles the source file and creates an r-code file. On UNIX, this new r-code file replaces any existing r-code file. If errors occur during compilation, ABL does not produce an r-code file and leaves existing r-code files unchanged.If ABL cannot find the source file, it continues on to the next directory in PROPATH.
- Use the
SAVE INTOphrase to store a compiled r-code file in a different directory from its corresponding source file.If you specify a relative pathname for the source file, that pathname is appended to the
SAVE INTOpath. For example (using UNIX pathnames):PROPATH="/pro1/source". COMPILE test/proc1.p SAVE INTO /pro1/obj.In the example, ABL saves the source file /pro1/source/test/proc1.p as /pro1/obj/test/proc1.r.
If the source file is a full pathname, ABL stores the r-code file in the
SAVE INTOdirectory; it drops its original directory path. For example:COMPILE /pro1/obj/test/proc1.p SAVE INTO /usr/rcode.In the example, ABL saves the source file as /usr/rcode/proc1.r.
When you use the
SAVE INTOphrase to store compiled r-code files for one or more class definition files specified with a package, ABL creates a directory structure under the specifiedSAVE INTOdirectory that is consistent with the directory structure of the original source files relative to PROPATH (if the directory structure doesn't already exist). That is, ABL creates a subdirectory under the specifiedSAVE INTOdirectory to match the original source directory for each class definition file in the hierarchy.For example, if the source for two class definition files in a class hierarchy reside in two different directories, such as
dir1anddir2, ABL creates two matching subdirectories nameddir1anddir2under the specifiedSAVE INTOdirectory and stores the r-code files in their respective subdirectories.If the
SAVE INTOpathname is null, ABL saves r-code files in the same directory as their source files. - To locate a file with the
COMPILEstatement (without theSAVEphrase), ABL searches the first directory in PROPATH for a usable r-code file. A usable r-code file must meet these criteria:- It must have the correct format; it must have been produced by the
COMPILE SAVEstatement. - It must have been produced by the current version of the ABL compiler.
- It must have the same cyclic redundancy check (CRC) value as any database tables it references. When creating an r-code file, ABL includes, as part of the r-code file, the CRC of the most recent change to the database schema that affects this procedure (for example, adding or deleting a field or index definition in a table that the procedure references).
- On UNIX, it must have read access to the r-code file.
If there is a usable r-code file, there is no reason to perform the compilation. You receive an error and the compilation stops unless you have specified the
XREF,LISTING,PREPROCESS, orDEBUG-LISToption. If you specified one of these options, ABL continues with the compilation and produces the files specified and a session compile. If ABL does create a session compile version, the version is not used when you use theRUNstatement. TheRUNstatement always uses an existing r-code file before using a session compile version of a procedure.If there is no usable r-code file, ABL searches the same directory in PROPATH for a source file. If the source file is there, ABL compiles it into the session compile file. If it is not there, ABL continues on to the next directory in PROPATH, searching for an r-code file, then for a source file.
- It must have the correct format; it must have been produced by the
- After you compile a procedure, the
RUNstatement does not recompile it. If youRUNa procedure multiple times within a session, changing the procedure between runs, you must manually recompile the procedure each time. Otherwise, the procedure's last r-code, which persists for a session, is found and the procedure is not automatically recompiled. - The size of the r-code might vary, depending on the window system on which it is compiled.
- Modifications to existing field definitions do not affect database table CRC or time-stamp values. Therefore, updating a table's existing field definitions does not invalidate r-code versions of procedures that reference the table. However, adding or deleting tables, fields, or indexes does affect database table CRC and time stamps. This invalidates r-code versions of procedures that reference the changed tables.
- When you use a reserved keyword to specify a language with the
LANGUAGESoption, you must use quotation marks (" ") around the language-list. - The
SORT-BY-EXPreference in the XREF is used to indicate aFOR EACHorOPEN QUERYstatement which contains aBYclause which uses an expression. - A
WHOLE-INDEXsearch reported for a table occurs when an entire index is used to search the table. (That is, the bracket used by the query to search the table spans the entire index.) This can occur either when no selection criteria are specified to limit the range of index keys searched (that is, to bracket a subset of the index) or when there is no appropriate index available to optimize the selection criteria. For example, the following queries onCustomertable of theSports2020database both result inWHOLE-INDEXsearches. The first query uses theNameindex to search the entire table, returning every record in Name order. The second query uses the primary index to search the entire table because there is no index provided for the Balance field to limit the search.FOR EACH Customer NO-LOCK USE-INDEX Name: DISPLAY Customer. END. FOR EACH Customer NO-LOCK WHERE Customer.Balance < 10000 AND Customer.Balance > 5000: DISPLAY Customer. END.On the other hand, the following queries do not result in
WHOLE-INDEXsearches because the selection criteria directly limit the range ofNameandCustNumindex keys (respectively) to be searched:FOR EACH Customer NO-LOCK WHERE Customer.Name < "Penan Sporttiklubi" AND Customer.Name > "Chip's Poker": DISPLAY Customer. END. FOR EACH Customer NO-LOCK WHERE Customer.CustNum < 40: DISPLAY Customer. END. - For SpeedScript, the following options are invalid:
V6FRAME,USE-REVVIDEO, andUSE-UNDERLINE. - When ABL compiles a procedure or class definition file, it generates a unique signature value based on the code content and the schema, and stores it in the r-code file. You can read the SIGNATURE-VALUE attribute on the RCODE-INFO handle to determine the signature value for a procedure or class. This signature value is used by WebClient to determine if an r-code file has changed since the previous version of the application.
- The
COMPILEstatement is not synchronized with other ABL sessions. As such, compiling individual files in a common code base when applications are using that same code base for either compilation or execution, can cause unpredictable behavior and is not advised. The best practice is to holistically compile a project in one ABL session prior to updating a running application. The Progress Application Server (PAS) for OpenEdge supports the ability to easily update an application in production.For more information, see Update PROPATH in a production instance with zero downtime.
See also
COMPILER system handle, NEW function (classes), NO-ERROR option, RUN statement, Compile Warning List (-cwl), Keyword Forget List (-k), and No Lock (-NL) startup parameters (in
Startup Command and Parameter Reference)