View previous topic :: View next topic
|
Author |
Message |
sudhakar_mainframe Warnings : 1 New User
Joined: 29 Jun 2006 Posts: 25
|
|
|
|
HI,
I have the following logic to initialize the Large arrays in Cobol.
Declaration in WS.
---------------------
05 WS-TEMP.
07 A OCCURS 100 TIMES
Procedure division statements.
-----------------------------------
INITIALIZE A (1)
MOVE WS-TEMP TO WS-TEMP (LENGTH OF A (1) + 1 : )
How this logic increases the performance?...
Thanks,
Sudhakar. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
What is the picture clause of array "A" or its elementary items (if any)?
Bill |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
An old Assembler trick....(IIRC)
MVI X'40',WS-TEMP
MVC WS-TEMP+1(L'WS-TEMP-1),WS-TEMP
Overlapping move to propagate the first byte to the rest of the field. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Guy,
I stopped using initialization-method this once COBOL2 was released. Although, it did work well in OS/VS COBOL.
But in this example, if the array is to be cleared to SPACES, then MOVE SPACES to the 05 level will generate (most likely) an MVCL and hence, 5 instructions to perform this initialization or a series of MVC's (as you've shown).
Also, since COBOL2, a VALUE clause can be used for each elementary item of an array and then the entire array can be cleared in the program Prologue code.
Bill |
|
Back to top |
|
|
|