COBOL Manual for TNS and TNS/R Programs

Program Compilation
HP COBOL Manual for TNS and TNS/R Programs522555-006
11-68
DIAGNOSE-74 and NODIAGNOSE-74
Search Algorithm
The SEARCH ALL statement in COBOL 74 performed a linear search. In
HP COBOL, it performs a binary search.
You must verify that the table being searched is properly organized (strictly
ascending or descending order) so that a binary search is feasible.
Size of Receiving Operand
The logic of COBOL 74 and HP COBOL differ in some cases when a value is
being assigned to a data structure that contains an item described with an
OCCURS DEPENDING phrase.
One instance is that of an UNSTRING statement assigning a value through an
INTO phrase that does not include a DELIMITER phrase, where the DEPENDING
item is within the receiving data structure. COBOL 74 uses the computed size of
the receiving item, but HP COBOL uses the maximum size.
Another, more general case is when a MOVE, UNSTRING, or some other value-
delivering statement stores a value into a data structure that contains an item
described with an OCCURS DEPENDING clause, where the DEPENDING item is
not part of the receiving (group) item. COBOL 74 used the maximum size of the
receiving item in performing the storage operation in all cases but the one
mentioned in the previous paragraph. HP COBOL uses the computed size in all
cases where the DEPENDING item is not part of the receiving item.
You must check that the value-assigning statement will do what you want it to do.
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