Continuation Rules

The fields that may be continued are:
  • Any free-form statement
  • The keywords field on the control specification
  • The keywords field on the file description specification
  • The keywords field on the definition specification
  • The Extended factor-2 field on the calculation specification
  • The constant/editword field on the output specification
  • The Name field on the definition or the procedure specification
General rules for continuation are as follows:
  • The continuation line must be a valid line for the specification being continued (H, F, D, C, or O in position 6)
  • No special characters should be used when continuing specifications across multiple lines, except when a literal or name must be split. For example, the following pairs are equivalent. In the first pair, the plus sign (+) is an operator, even when it appears at the end of a line. In the second pair, the plus sign is a continuation character.
    C                   eval      x = a + b
    C                   eval      x = a +
    C                                 b
    
    C                   eval      x = 'abc'
    C                   eval      x = 'ab+
    C                                  c'   
  • Only blank lines, empty specification lines or comment lines are allowed between continued lines
  • The continuation can occur after a complete token. Tokens are
    • Names (for example, keywords, file names, field names)
    • Parentheses
    • The separator character (:)
    • Expression operators
    • Built-in functions
    • Special words
    • Literals
  • A continuation can also occur within a literal
    • For character, date, time, and timestamp literals
      • A hyphen (-) indicates continuation is in the first available position in the continued field
      • A plus (+) indicates continuation with the first non-blank character in or past the first position in the continued field
    • For graphic literals
      • Either the hyphen (-) or plus (+) can be used to indicate a continuation.
      • Each segment of the literal must be enclosed by shift-out and shift-in characters.
      • When the a graphic literal is assembled, only the first shift-out and the last shift-in character will be included.
      • Regardless of which continuation character is used for a graphic literal, the literal continues with the first character after the shift-out character on the continuation line. Spaces preceding the shift-out character are ignored.
    • For numeric literals
      • No continuation character is used
      • A numeric literal continues with a numeric character or decimal point on the continuation line in the continued field
      • Continuation for numeric literals is not allowed in free-form statements
    • For hexadecimal and UCS-2 literals
      • Either a hyphen (-) or a plus (+) can be used to indicate a continuation
      • The literal will be continued with the first non-blank character on the next line
  • A continuation can also occur within a name in free-format entries
    • In the name entry for Definition and Procedure specifications. For more information on continuing names in the name entry, see Definition and Procedure Specification Name Field.
    • In the keywords entry for File and Definition specifications.
    • In the extended factor 2 entry of Calculation specifications.
    You can split a qualified name at a period, as shown below:
     C                   EVAL      dataStructureWithALongName.
     C                               subfieldWithAnotherLongName = 5

    If a name is not split at a period, code an ellipsis (...) at the end of the partial name, with no intervening blanks.

    Example
    *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
    DName++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
    D                                     Keywords-cont++++++++++++++++++++++++
    * Define a 10 character field with a long name.
    * The second definition is a pointer initialized to the address
    * of the variable with the long name.
    D QuiteLongFieldNameThatCannotAlwaysFitInOneLine...
    D                 S             10A
    D Ptr             S               *   inz(%addr(QuiteLongFieldName...
    D                                               ThatCannotAlways...
    D                                               FitInOneLine))
    D ShorterName     S              5A
    
    *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
    CL0N01Factor1+++++++Opcode(E)+Extended-factor2+++++++++++++++++++++++++++++
    C                             Extended-factor2-++++++++++++++++++++++++++++
    * Use the long name in an expression
    * Note that you can split the name wherever it is convenient.
    C                   EVAL          QuiteLongFieldName...
    C                                 ThatCannotAlwaysFitInOneLine = 'abc'
    
    * You can split any name this way
    C                   EVAL          P...
    C                                 tr = %addr(Shorter...
    C                                 Name)