Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

MOVE or INITIALIZE, which uses less CPU

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
avik

New User


Joined: 13 May 2008
Posts: 16
Location: kolkata

PostPosted: Sun Aug 10, 2008 10:30 am    Post subject: MOVE or INITIALIZE, which uses less CPU
Reply with quote

Hi,
I want to know for a large array in COBOL, which is the more costly statement t.."MOVE" or "INITIALIZE" ?
or both the COBOL verbs consume same amount of CPU?
Back to top
View user's profile Send private message

Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1239
Location: Richfield, MN, USA

PostPosted: Sun Aug 10, 2008 10:38 am    Post subject:
Reply with quote

INITIALIZE becomes MOVE statements during compilation. The best method to use to initialize a table depends on how often it needs initializing, the size of it, the number of elementary fields in it, the picture clauses, etc. Also, did you know you can initialize a table by assigning values to the elementary items at compile time? All occurrences are initialized that way, not just one. Please show us the table definition and answer the above questions and someone will help.
Back to top
View user's profile Send private message
avik

New User


Joined: 13 May 2008
Posts: 16
Location: kolkata

PostPosted: Sun Aug 10, 2008 11:22 am    Post subject:
Reply with quote

Code:
01  LU-TERM-OUT.                                           
      05  OUT-LENGTH             PIC      S9(6)   COMP SYNC.
      05  FILLER                 PIC      X(10).             
      05  OUT-USERID             PIC      X(8).             
      05  OUT-OWNERSHIP-CD       PIC      X.                 
      05  LU-RESPONSE-BLOCK      PIC  X(999976).             
 *                                                           
 *THIS 2ND GROPING OF "HEADER TYPE" DATE IS 52 BYTES         
 *                                                           
      05  LU-RESPONSE REDEFINES LU-RESPONSE-BLOCK.           
                                                             
          06  CTL-LINE-CNT           PIC 9(6).               
          06  CTL-FUNCTION           PIC XX.                 
          06  CTL-FORMAT             PIC X.                 
          06  CTL-DSOI               PIC X(41).             
          06  CTL-FCI                PIC XX.                 
          06  CTL-AREA               PIC X(999924).         
          06  CTL-AREAA REDEFINES CTL-AREA.

               10  CTL-TT             PIC X(15).                   
               10  CTL-NWB            PIC X(11).                   
               10  CTL-LI             PIC X.                       
               10  CTL-EI             PIC X.                       
               10  CTL-FRED.                                       
                      15  FILLER         PIC X(3).                     
                      15  OUT-LINE.                                   
                            20  OUT-LINE-CHAR  PIC X                     
                            OCCURS 999893 TIMES       
                            INDEXED BY OUT-LINE-INDEX.
.
.
.
.
INITIALIZE  CTL-AREA


in this case,MOVE or INITIALIZE,which is preferable
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1239
Location: Richfield, MN, USA

PostPosted: Sun Aug 10, 2008 8:57 pm    Post subject:
Reply with quote

If CTL-AREA is to be initialized just once,
Code:
MOVE SPACE TO CTL-AREA
should do it since all of your elementary fields are defined as alphanumeric. You probably wouldn't notice much CPU difference if you used
Code:
INITIALIZE CTL-AREA
instead. The only difference you would see in the result is that INITIALIZE will leave the FILLER untouched. If, on the other hand, CTL-AREA needs initializing more than once, the MOVE statement would definitely be the way to go. Also,
Code:
20 OUT-LINE-CHAR PIC X [b]VALUE SPACE[/b]
OCCURS 999893 TIMES
INDEXED BY OUT-LINE-INDEX.
would initialize OUT-LINE the same as
Code:
INITIALIZE OUT-LINE
would. Since I don't have access to a mainframe, the best thing for you would be to write a test program, compare, and share your findings.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm
No new posts Need information on COBOL MOVE CORRES... subratarec COBOL Programming 10 Tue Jun 28, 2016 10:38 pm
No new posts how to move view the remote file in o... mailtoashok CICS 2 Fri Feb 12, 2016 1:07 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us