PL/I Application Model API Specification

This package contains interfaces that represent the nodes of a syntax tree for a PL/I program. Each node of the syntax tree represents part of a PL/I program.

This package was generated from an Eclipse Modeling Framework model, but you do not need to use the EMF capabilities unless they are useful to you. Here is a brief description of some of the terms in the documentation that you might not be familiar with:

In the model, when a list is returned, if there are no items in the list, an empty list is returned, rather than returning null.

Most nodes in the syntax tree subclass the {@link com.ibm.etools.pli.application.model.pli.PLINode PLINode} class. This class contains location information about where the code that is represented by the node is found in the source code, including file, line, and column information.

The {@link com.ibm.etools.pli.application.model.pli.ProgramSourceFile ProgramSourceFile} node represents the contents of the entire source file. A {@link com.ibm.etools.pli.application.model.pli.ProgramSourceFile ProgramSourceFile} object contains four features that represent all of the statements and structures in the source file. The {@link com.ibm.etools.pli.application.model.pli.ProgramSourceFile#getProcessDirectives() getProcessDirectives()} method returns a list of {@link com.ibm.etools.pli.application.model.pli.ProcessDirective ProcessDirective} objects, which represent process directives. The {@link com.ibm.etools.pli.application.model.pli.ProgramSourceFile#getStatements() getStatements()} method returns a list of {@link com.ibm.etools.pli.application.model.pli.PLINode PLINode} objects. This list represents every statement in the source file that is not a process directive. The list does not account for structural elements in the program. Macro language statements and PL/I statements can be interspersed in the list, and appear in the order in which they occur in the source file. The {@link com.ibm.etools.pli.application.model.pli.ProgramSourceFile#getMacroStructure() getMacroStructure()} method returns a {@link com.ibm.etools.pli.application.model.pli.MacroProgramStructureNode MacroProgramStructureNode} object, which contains references to all of the statements in the list returned by {@link com.ibm.etools.pli.application.model.pli.ProgramSourceFile#getStatements() getStatements()}, and models any structural Macro language objects such as Macro procedures, DO-groups, and SELECT-groups as Macro structure node objects. The {@link com.ibm.etools.pli.application.model.pli.ProgramSourceFile#getPliStructure() getPliStructure()} method returns a {@link com.ibm.etools.pli.application.model.pli.ProgramStructureNode ProgramStructureNode} object, which represents any structural PL/I language objects such as packages, procedures, BEGIN-blocks, DO-groups, and SELECT-groups. Note that PL/I language objects that are excluded in the source due to Macro expansion will not appear in the {@link com.ibm.etools.pli.application.model.pli.ProgramStructureNode ProgramStructureNode}, but do appear in the "flat" list of statements returned by {@link com.ibm.etools.pli.application.model.pli.ProgramSourceFile#getStatements() getStatements()}. To investigate individual statements in the source file, you can visit the list of statements retrieved from {@link com.ibm.etools.pli.application.model.pli.ProgramSourceFile#getStatements() getStatements()} or drill down to individual statements using the structure nodes.

For an example of how the statements and structures are modeled, consider the following code snippet:

 IF X = 0 THEN
   DO;
     DISPLAY('X is zero');
   END;
 ELSE
   DO;
     DISPLAY('X is non-zero');
   END;
In the list of statements returned by {@link com.ibm.etools.pli.application.model.pli.ProgramSourceFile#getStatements() getStatements()} this snippet is modeled by 8 statements ( {@link com.ibm.etools.pli.application.model.pli.IfStatement IfStatement}, {@link com.ibm.etools.pli.application.model.pli.DoStatement DoStatement}, {@link com.ibm.etools.pli.application.model.pli.DisplayStatement DisplayStatement}, {@link com.ibm.etools.pli.application.model.pli.EndStatement EndStatement}, {@link com.ibm.etools.pli.application.model.pli.ElseStatement ElseStatement}, {@link com.ibm.etools.pli.application.model.pli.DoStatement DoStatement}, {@link com.ibm.etools.pli.application.model.pli.DisplayStatement DisplayStatement}, {@link com.ibm.etools.pli.application.model.pli.EndStatement EndStatement}, respectively). However, in the {@link com.ibm.etools.pli.application.model.pli.ProgramStructureNode ProgramStructureNode} returned by {@link com.ibm.etools.pli.application.model.pli.ProgramSourceFile#getPliStructure() getPliStructure()}, the snippet is modeled by an {@link com.ibm.etools.pli.application.model.pli.IfElseCompoundStatement IfElseCompoundStatement}. If you drill down into the statement, {@link com.ibm.etools.pli.application.model.pli.IfElseCompoundStatement#getIfStatement() getIfStatement()} returns a {@link com.ibm.etools.pli.application.model.pli.NodeReference NodeReference} that points to the {@link com.ibm.etools.pli.application.model.pli.IfStatement IfStatement}, {@link com.ibm.etools.pli.application.model.pli.IfElseCompoundStatement#getThenUnit() getThenUnit()} returns a {@link com.ibm.etools.pli.application.model.pli.DoGroup DoGroup} that represents the first DO-group, {@link com.ibm.etools.pli.application.model.pli.IfElseCompoundStatement#getElseStatement() getElseStatement()} returns a {@link com.ibm.etools.pli.application.model.pli.NodeReference NodeReference} that points to the {@link com.ibm.etools.pli.application.model.pli.ElseStatement ElseStatement}, and {@link com.ibm.etools.pli.application.model.pli.IfElseCompoundStatement#getElseUnit() getElseUnit()} returns a {@link com.ibm.etools.pli.application.model.pli.DoGroup DoGroup} that represents the second DO-group.

If you are interested in examining how types, variables, or constants are declared, locate the DEFINE or DECLARE statement where the item is declared and drill down to the attributes. Note that the attributes returned reflect what is coded in the statement. The returned attributes do not reflect default attributes. The {@link com.ibm.etools.pli.application.model.pli.Attribute Attribute} class is the parent class for all of the attributes that can be used to describe a declared item.

When labels, constants, functions, subroutines, or variables are mentioned in a PL/I statement, a {@link com.ibm.etools.pli.application.model.pli.Reference Reference} object is used to represent the reference. The {@link com.ibm.etools.pli.application.model.pli.Reference Reference} class is abstract, and has several subclasses that represent different kinds of references such as simple references, qualified references, and function references. Any {@link com.ibm.etools.pli.application.model.pli.Reference Reference} object has a {@link com.ibm.etools.pli.application.model.pli.Reference#getDeclaration() getDeclaration()} that returns the node where the referenced object was declared. Note that for PL/I language statements that are excluded from the expanded source code due to Macro language statements, the {@link com.ibm.etools.pli.application.model.pli.Reference#getDeclaration() getDeclaration()} method will return null. For undeclared objects such as implicit variables and undeclared builtins, the {@link com.ibm.etools.pli.application.model.pli.Reference#getDeclaration() getDeclaration()} method returns either an {@link com.ibm.etools.pli.application.model.pli.ImplicitDeclaration ImplicitDeclaration} or {@link com.ibm.etools.pli.application.model.pli.ImplicitBuiltinDeclaration ImplicitBuiltinDeclaration} object. Note that these objects do not subclass {@link com.ibm.etools.pli.application.model.pli.PLINode PLINode} since they do not actually appear in the source code, and therefore have no location features.

PL/I expressions are represented by the subclasses of the abstract class {@link com.ibm.etools.pli.application.model.pli.Expression Expression}. The expression subclasses include nodes representing references, unary expressions, and binary expressions (those expressions with an infix operator and left and right expressions).

INCLUDE, XINCLUDE, and EXEC SQL INCLUDE statements are replaced by the contents of the included source file if the file can be located using the SYSLIB property in an associated property group. The model for the include file contents replaces the model for the include statement in the ordered list of statements for the given program. The only supported format for content replacement is an INCLUDE, XINCLUDE, or EXEC SQL INCLUDE statement that includes a single file name. INCLUDE and XINCLUDE statements that reference a file by DD name or that reference multiple files are not supported for content replacement. INSCAN and XINSCAN statements also do not support content replacement. Unsupported formats of INCLUDE, XINCLUDE, and EXEC SQL INCLUDE, and those statements that are in the supported format but where the included file cannot be found, are modeled as {@link com.ibm.etools.pli.application.model.pli.MacroIncludeStatement MacroIncludeStatement}, {@link com.ibm.etools.pli.application.model.pli.MacroXIncludeStatement MacroXIncludeStatement}, and {@link com.ibm.etools.pli.application.model.pli.ExecSqlStatement ExecSqlStatement}, respectively. All INSCAN and XINSCAN statements are modeled as {@link com.ibm.etools.pli.application.model.pli.MacroInscanStatement MacroInscanStatement} and {@link com.ibm.etools.pli.application.model.pli.MacroXInscanStatement MacroXInscanStatement}, respectively. INCLUDE, XINCLUDE, and EXEC SQL INCLUDE statements that have their contents replaced are represented as the types listed above, and can be accessed through the method {@link com.ibm.etools.pli.application.model.pli.ProgramSourceFile#getResolvedIncludeStatements() ProgramSourceFile.getResolvedIncludeStatements()}.

Limitations

The following list contains the known limitations of the PL/I Application Model. These areas are subject to change in a future release.