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

Alternative for Initialize


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Balamurugan Sivalingam

New User


Joined: 24 May 2010
Posts: 4
Location: Chennai

PostPosted: Wed May 26, 2010 2:08 pm
Reply with quote

Hi,

Is there any other way than specifying INITIALIZE keyword for initialization?

Normal at the time of initialization (using INITIALIZE) the resource/space usage will be very high which may affect the performance of the code.

Please suggest me.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 26, 2010 2:49 pm
Reply with quote

Can you please explain the reason why you think that this is a JCL related topic ?

Please say where you think this topic should have been posted and one of the moderators will move it.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed May 26, 2010 2:50 pm
Reply with quote

Quote:
Normal at the time of initialization (using INITIALIZE) the resource/space usage will be very high which may affect the performance of the code.

Who says this? manuals????? icon_eek.gif
Back to top
View user's profile Send private message
Balamurugan Sivalingam

New User


Joined: 24 May 2010
Posts: 4
Location: Chennai

PostPosted: Wed May 26, 2010 4:07 pm
Reply with quote

Am really sorry about posting it under JCLS....

I haven't checked it before posting it....

Regret for the confusion.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed May 26, 2010 4:14 pm
Reply with quote

The initialize statement can consume a lot of CPU, if not used carefully. For CICS, (though it's not my cup of tea, but till the chapters I read), on the other hand, I'd say it is wise to ensure that variables are actually not set or modified before you reference the contents, unless you want to use information that could have been set by an earlier invocation.

For batch-processes, if you are using the INITIALIZE statement for each input, output record - I'd say STOP. This might tunn up as a real CPU burner. The more complex the copybook you are initializing, the worse it is. Sugest you look into using INITIALIZE only once per record format, move the initialized record to a WS-some-HOLD-variable area the same size as the copybook, then whenever you need to do an initialization of the record copy the 01 level of WS-some-HOLD-variable to the 01 level of the copybook.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed May 26, 2010 4:21 pm
Reply with quote

expat wrote:
Can you please explain the reason why you think that this is a JCL related topic ?

Please say where you think this topic should have been posted and one of the moderators will move it.
Your honor, with all regards, i'd like to move this topic to "Mainframe COBOL" part of the Forum..icon_smile.gif.

PS. I just had a talk with my brother-in-Law, He is a Lawyer, you know.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 26, 2010 4:54 pm
Reply with quote

Anuj Dhawan wrote:
Your honor, with all regards, i'd like to move this topic to "Mainframe COBOL" part of the Forum..icon_smile.gif.

PS. I just had a talk with my brother-in-Law, He is a Lawyer, you know.

Mr. Dhawan, after consultation with my daughter, also a lawyer, your motion to move this topic is accepted.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed May 26, 2010 4:59 pm
Reply with quote

LOL - Thank you Sir..icon_smile.gif, topic resides in COBOL part of the Forum now.
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: Wed May 26, 2010 5:48 pm
Reply with quote

If at all possible, (for example), define all like-defined WS variables under a given group, then you can clear these variables with a single MOVE statement.

Code:

01  WS-BINARY-GROUP BINARY.
    03  WS-BINARY-01 PIC S9(09).
    03  WS-BINARY-02 PIC S9(18).
    03  WS-BINARY-03 PIC S9(04).
    03  WS-BINARY-04 PIC  9(09).
01  WS-NUMERIC-GROUP.
    03  WS-NUMERIC-01 PIC 9(09).
    03  WS-NUMERIC-02 PIC 9(17).
    03  WS-NUMERIC-03 PIC 9(11).
01  WS-ALPHA-GROUP.
    03  WS-ALPHA-01 PIC X(128).
    03  WS-ALPHA-02 PIC X(128).
    03  WS-ALPHA-03 PIC X(128).
*
MOVE LOW-VALUES TO WS-BINARY-GROUP.
MOVE ZEROS      TO WS-NUMERIC-GROUP.
MOVE SPACES     TO WS-ALPHA-GROUP.

However, INITIALIZE maybe your only method for signed packed-decimal, unsigned (neutral) packed-decimal and signed display-numeric.

YMMV....

Bill
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed May 26, 2010 9:11 pm
Reply with quote

Hello,

If your area to be initialized contains a variety of data types, you might consider having an "initialization set" of the fields defined in the code. Other than the group field name, the others could be FILLER and never be referenced in the code. These would contain the initial value for each field. A single move would "initialize" multiple fields rather than the field-by-field MOVEs done by the INITIALIZE.
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 Alternative to CALL tso command TSO/ISPF 6
No new posts Need to Initialize an empty flat file... DFSORT/ICETOOL 9
No new posts How to initialize address location in... COBOL Programming 2
No new posts INITIALIZE Table - Alphanumeric &... COBOL Programming 11
No new posts AMODE 64 C system() alternative All Other Mainframe Topics 2
Search our Forums:

Back to Top