COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
• Identification of Statement Operand
In COBOL 74, STRING and UNSTRING statements deferred some subscript evaluations until
just before the subscripted item was used. HP COBOL evaluates all subscripts once at the
beginning of the statement’s execution.
You must check that the STRING and UNSTRING statements do what you want them to do.
• Assignment Order of PERFORM Operands
In COBOL 74, when a PERFORM VARYING statement controlled multiple loops by using the
AFTER phrase, the inner loop base was set before the outer loop index was incremented (or
decremented). In HP COBOL, these steps are reversed. When the inner loop logic uses the
value of the outer loop’s index, the behavior is different. For example, the statement:
PERFORM p1 VARYING x FROM 1 BY 1 UNTIL x = 5
AFTER y FROM x BY 1 UNTIL y = 5.
Under COBOL 74 rules, the preceding statement performs these steps in this order:
1. Sets x to 1, sets y to 1
2. Runs y from 1 through 4
3. Sets y to the value of x (still 1), sets x to 2
4. Runs y from 1 through 4
5. Sets y to the value of x (now 2), sets x to 3
6. Runs y from 2 through 4
7. Sets y to the value of x (now 3), sets x to 4
8. Runs y from 3 through 4
9. Terminates
In HP COBOL, the same statement performs these steps in this order:
1. Sets x to 1, sets y to 1
2. Runs y from 1 through 4
3. Sets x to 2, sets y to the value of x (now 2)
4. Runs y from 2 through 4
5. Sets x to 3, sets y to the value of x (now 3)
6. Runs y from 3 through 4
7. Sets x to 4, sets y to the value of x (now 4)
8. Runs y with the value 4
9. Terminates
You must revise the logic of any PERFORM VARYING containing an AFTER phrase that is
controlled by the index of the outer loop. The simplest maneuver is probably to separate the
PERFORM into two separate PERFORM statements, because you cannot use an arithmetic
expression in the FROM phrase.
• Alphanumeric Sender
When left-justified numbers with trailing spaces are moved from an alphanumeric data item
to a numeric data item described as USAGE DISPLAY or to a numeric edited data item, the
result differs between COBOL 74 and HP COBOL. For example, given these descriptions:
01 ITEM-A PIC X(5) VALUE "05 ".
01 ITEM-B PIC 9(5).
The statement
MOVE ITEM-A TO ITEM-B
results in
"00005"
in ITEM-B for COBOL 74 and
Compiler Directives 547










