The COBOL Application Model (CAM) API: Known problems

Be aware of a few known problems that apply to the COBOL Application Model (CAM) API.

  • When an EXEC statement in the procedure division occurs immediately after a completed sentence, the sentence and the EXEC statement are represented as a single sentence that contains two statements. In fact, they are two sentences each of which contains a single statement.
  • An ASTNode can be defined or declared outside of the ProcedureDivision and then used in a Statement in the ProcedureDivision. In such a case, the getParent() method returns the parent node of the declaration for all instances. For example, for a MnemonicName declared in the SpecialNames paragraph, but used in an AcceptStmt, the getParent() method returns a SpecialNamesParagraph object rather than the expected AcceptStmt object.
  • When the procedure division contains a section or paragraph that ends with a COPY statement, the method ProcedureDivisionContent.getContent() returns incorrect location offsets for that section or paragraph. As a result, the highlighting of code review rule violations within that section or paragraph can be unpredictable.
  • INSPECT TALLYING statements with multiple TALLYING clauses are not modeled correctly in every case:
    • The modeling of an INSPECT TALLYING statement with multiple comparands in the TALLYING clause causes the method InspectTallyingClause.getComparands() to return an incorrect result. The method is supposed to return a list of multiple objects, the first of which is an InspectTallyingLeading object and the second an InspectTallyingAll object. Instead, the method returns a list with a single InspectTallyingLeading object.
    • The modeling of an INSPECT TALLYING statement with multiple tallying clauses causes the method InspectTallyingStmt.getClauses() to return an incorrect result. The method is supposed to return a list that contains multiple InspectTallyingClause objects. Instead, the method returns a list that contains a single InspectTallyingClause object.
  • Reference modifications on function references of type alphanumeric or national are not represented in the model when the function has no parameters. For example, DISPLAY FUNCTION CURRENT-DATE (1:4) is not represented.
  • If a file description entry is declared outside of a nested program but is used within the nested program, then a user-written rule that checks the file description entry or that checks a statement that refers to the file description entry can generate unpredictable results.
  • Code review cannot analyze a COBOL source code file that contains one of the following types of statements:
    • An ENTRY statement that contains USING phrases with multiple BY clauses.
    • An altered GO TO statement with no target label.
    • The following arguments of the XML GENERATE statement: XML-DECLARATION, ATTRIBUTES, NAMESPACE, and NAMESPACE-PREFIX
    • DBCS strings.
  • The methods MergeStmt.getUsing() and MergeStmt.getGivingOrOutputProcedure() use the Java™ IOFiles class, which does not include location information. If a user-written rule calls one of these methods, the highlighting of code review rule violations can be unpredictable around statements that are affected by the rule.