COBOL Manual for TNS and TNS/R Programs
Program Compilation
HP COBOL Manual for TNS and TNS/R Programs—522555-006
11-69
DIAGNOSE-74 and NODIAGNOSE-74
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
"05 "
in ITEM-B for HP COBOL.
If you cannot avoid moving left-justified numbers with trailing spaces between
these data types, use an UNSTRING statement with a DELIMITED BY SPACES
phrase rather than a MOVE statement.