replacement of INITIALIZE verb



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

replacement of INITIALIZE verb

Postby arya_starc » Thu Mar 12, 2020 4:45 pm

Hi Team,

I am planning to replace INITIALIZE syntax in my cobol programs with normal MOVE statements. I am doing this for getting the better efficiency and utilization of cpu for my batch programs.

Is anyone doing this earlier and get better results in terms of optimization?
Please share your thoughts.

Thanks in advance.
arya_starc
 
Posts: 132
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

Re: replacement of INITIALIZE verb

 

Re: replacement of INITIALIZE verb

Postby NicC » Thu Mar 12, 2020 5:16 pm

What has this to do with system programming (where the topic was originally posted)? Moved.

What have your initial tests shown?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2989
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 135 times

Re: replacement of INITIALIZE verb

Postby Robert Sample » Thu Mar 12, 2020 6:52 pm

What kind of variables do you have INITIALIZE on? If you are using INITIALIZE for elementary variables, you will see no improvement in CPU time or efficiency -- for elementary items, MOVE and INITIALIZE work exactly the same. For group variables, you may -- or may not -- see any improvement in CPU time and efficiency since such improvements would depend upon a number of factors. The only way to know for sure that there is an improvement to actually make the change and review the results.

I have seen major improvements in going from INITIALIZE to MOVE -- but the specific situation was the INITIALIZE was for a million-byte table (99 occurrences of 9,999 bytes) where the MOVE was only used to clear the 15 occurrences actually being used. And the INITIALIZE / MOVE statements were being executed about 2 million times per program execution. YMMV.
Robert Sample
Global moderator
 
Posts: 3646
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 268 times

Re: replacement of INITIALIZE verb

Postby Terry Heinze » Thu Mar 12, 2020 7:42 pm

The only time I'm reluctant to use INITIALIZE is when a group item consists of many elementary items AND the group item needs reinitializing many times during the program. In that case, I initialize a group item once at the beginning of the program and save it. When the other group item needs reinitializing, I move the saved group to the group needing reinitializing (one big group move).
.... Terry
Terry Heinze
 
Posts: 232
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 11 times
Been thanked: 11 times

Re: replacement of INITIALIZE verb

Postby chaat » Sat Mar 14, 2020 11:25 am

if you are initializing arrays, I would strongly recommend that you modify the code such as to not require initialization of the entire array.

instead, keep track of how many elements of the array are being used and only initialize occurrences as they are used. This requires the use of hand coded searches or an OCCURS DEPENDING ON clause when declaring the array.

Note, that a hand coded binary search with a single key field is much more efficient than the SEARCH ALL verb. This is especially true with COBOL 6.

Chuck Haatvedt
chaat
 
Posts: 18
Joined: Sun Aug 16, 2009 11:07 pm
Location: St. Cloud, Minnesota
Has thanked: 0 time
Been thanked: 1 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post