MOVE
VALUE clause and initializing groups
Statement: MOVE and VALUE IS
Data types: All types
Options: OPT(1 | 2)
Conditions: Initializing data items with literals
V4 behavior: Series of separate and sequential move instructions
V6 behavior: Coalesces literals and generates fewer move instructions
Source
Example:
01 WS-GROUP.
05 WS-COMP3 COMP-3 PIC S9(13)V9(2).
05 WS-COMP COMP PIC S9(9)V9(2).
05 WS-COMP5 COMP-5 PIC S9(5)V9(2).
05 WS-COMP1 COMP-1.
05 WS-ALPHANUM PIC X(11).
05 WS-DISPLAY PIC 9(13) DISPLAY.
05 WS-COMP2 COMP-2.
Move +0 to WS-COMP5
WS-COMP3
WS-COMP
WS-DISPLAY
WS-COMP1
WS-COMP2
WS-ALPHANUM.
Performance: V6 is 20% faster than V4
Moving into numeric-edited data items
Statement: MOVE
Data types: Receiver is numeric-edited
Options: OPT(1 | 2)
Conditions: None
V4 behavior: Uses the ED or EDMK instruction in all cases
V6 behavior: The ED and EDMK instructions, which handle numeric edits, are extremely slow. V6 converts uses of these specialized instructions into a series of other instructions. This is a new optimization technique in V6.
Source
Example:
01 PRINCIPAL PIC 9(8)V9999 VALUE 1234.1234.
01 AMT-PRINCIPAL PIC $,$$$,$$9.99.
Move PRINCIPAL to AMT-PRINCIPAL.
Performance: V6 is 41% faster