IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How this logic increases the performance?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sudhakar_mainframe
Warnings : 1

New User


Joined: 29 Jun 2006
Posts: 25

PostPosted: Tue Aug 19, 2008 7:51 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Aug 19, 2008 8:01 pm
Reply with quote

What is the picture clause of array "A" or its elementary items (if any)?

Bill
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Aug 19, 2008 10:18 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Aug 19, 2008 10:33 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts exploiting Z16 performance PL/I & Assembler 2
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Finding faulty logic Subscript out of... COBOL Programming 5
This topic is locked: you cannot edit posts or make replies. Need assistance in job scheduling logic. Mainframe Interview Questions 2
No new posts Rexx Logic error while adding seperat... CLIST & REXX 3
Search our Forums:

Back to Top