MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Replacing Initialization of Arrays

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Mon May 11, 2009 2:34 pm    Post subject: Replacing Initialization of Arrays Reply with quote

Hi,

I have this complex array in a cobol program:

Code:

01  WS-COMP-TBL.                                               
    03  WS-COMP-TBL-DETAIL OCCURS 800 TIMES.                   
          05.....
          05.....
          05.....
          05.....
          05.....
          05 WS-COMP-TBL-FIELDS OCCURS 300 TIMES.                 
                  15...
                  15...
                  15...
                  15...
                  15...
                  15...
                  15...
                  15...



In the program , the WS-COMP-TBL-FIELDS is being initialized for all the employees in the every dept.

Note : Using ODO is not an option here since the getting the count of employees is not viable

Is there a way to INITIALIZE the array?

Thanks,
Martin
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon May 11, 2009 2:42 pm    Post subject: Reply with quote

Martin,

simple search ?

http://www.mvsforums.com/helpboards/viewtopic.php?t=4327&highlight=array

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Mon May 11, 2009 2:54 pm    Post subject: Reply with quote

kolusu wrote:
Martin,

simple search ?

http://www.mvsforums.com/helpboards/viewtopic.php?t=4327&highlight=array

Kolusu


But the MOVE statement has to be execuetd for all the employees and doesnt really help in reducing the CPU time right..
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Mon May 11, 2009 3:04 pm    Post subject: Reply with quote

Martin,
how about looking up the INITIALIZE function in the COBOL Manual.

or you could generate 800 X 300 data entry items with value clauses, then redefine them with the table definition, then everything would be initialized at load time.

IF you are soooo concerned with CPU time, then use a counter and only initialize those items you use, as you populate them.

If you are going to be doing SEARCHes (serial, obviously) you will save time by having a counter.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Mon May 11, 2009 3:06 pm    Post subject: Reply with quote

Quote:
Note : Using ODO is not an option here since the getting the count of employees is not viable


that is not the reason you use an ODO.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon May 11, 2009 3:35 pm    Post subject: Reply with quote

Martin wrote:
But the MOVE statement has to be execuetd for all the employees and doesnt really help in reducing the CPU time right..


says who? Question Trust me that move statement would out perfom INITIALIZE statement

I have seen a Perform Varying scoring over INITIALIZE function
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Mon May 11, 2009 4:07 pm    Post subject: Reply with quote

Another way to initialize a COBOL table (array) is to assign values to the elementary fields. No PROCEDURE DIVISION statements are then necessary. This won't work if the table needs to be initialized more than once during the program of course. Check the Programming Guide for this method.
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG30/1.4.4.3.3?SHELF=&DT=20050628164603
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group