Skip to content

Missing diagnostic on CALLs using special register #1926

@fm-117

Description

@fm-117

Describe the bug
Our parser currently allows use of LENGTH OF in CALLs without specifying passing style BY CONTENT. This is wrong in Cobol and should be signaled with a diagnostic (error level).

To Reproduce
(Type)Cobol code that cause the bug : (if any)

       IDENTIFICATION DIVISION.
       PROGRAM-ID. Pgm1.
       DATA DIVISION.
       LOCAL-STORAGE SECTION.
       01 txt   pic X(100).
       01 l     pic S9(5) comp-5.
       01 RC    pic 99.
       PROCEDURE DIVISION.
      *KO cannot use LENGTH OF by reference
           Call "SOMEPGM" USING txt
                   by reference length of txt
                                RC.
      
      *KO cannot use LENGTH OF by reference
           Call "SOMEPGM" USING txt
                                length of txt
                                RC.
      
      *Ok
           Call "SOMEPGM" USING txt
                   by content   length of txt
                   by reference RC.
      
       END PROGRAM Pgm1.

Expected behavior
Diagnostics on wrong lines with meaningful error message.

To discuss

  • expected behavior for TypeCobol procedure calls
    • same as Cobol ?
    • allow the developer to omit the BY CONTENT but auto-generates it ?
  • What about ADDRESS OF ?

Metadata

Metadata

Assignees

Labels

CobolErrorMessageIssue related to error messagesTypeCobolrfcSpecifications are not complete. Comment are welcomed.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions