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
 

 

Which will execute fast: COMP or COMP-3

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

New User


Joined: 07 Dec 2006
Posts: 9
Location: chennai

PostPosted: Wed Feb 28, 2007 4:40 pm    Post subject: Which will execute fast: COMP or COMP-3
Reply with quote

10)Which one will execute the fastest ?

Working-Storage Section.
77Field1 Pic S9(5) comp.
77Field2 Pic S9(9) comp-3.
77Field3 Pic S9(9) comp.
77 Field4 Pic S9(5) comp-3.

a) Move Field1 to Field2 b) Move Field1 to Field3
c)Move Field2 to Field3 d) Move Field2 to Field4
Back to top
View user's profile Send private message

hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Wed Feb 28, 2007 5:34 pm    Post subject: Re: which will execute fast?
Reply with quote

Hi ,

The answer should be
D)
according to the memmory efficiency...

U replies are welcome if u have any different ideas.

Thanks,
-kapil.
Back to top
View user's profile Send private message
prabeesh
Currently Banned

New User


Joined: 07 Dec 2006
Posts: 9
Location: chennai

PostPosted: Wed Feb 28, 2007 6:09 pm    Post subject:
Reply with quote

sorry i don't have any idea about the answer . can u explain more about ur answer
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Wed Feb 28, 2007 8:18 pm    Post subject:
Reply with quote

Here is the assembly code listing of the 4 move statements
Code:

000025  MOVE                                                             
   0002EE  5840 912C               L     4,300(0,9)              BLW=0   
   0002F2  5830 4000               L     3,0(0,4)                FIELD1   
   0002F6  4E30 D0F0               CVD   3,240(0,13)             TS2=0   
   0002FA  D204 4008 D0F3          MVC   8(5,4),243(13)          FIELD2   
000026  MOVE                                                             
   000300  F874 D0F0 4008          ZAP   240(8,13),8(5,4)        TS2=0   
   000306  4F30 D0F0               CVB   3,240(0,13)             TS2=0   
   00030A  5030 4010               ST    3,16(0,4)               FIELD3   
000027  MOVE     
   00030E  D203 4010 4000          MVC   16(4,4),0(4)            FIELD3                                                         
000028  MOVE                                                                   
   000314  F822 4018 400A          ZAP   24(3,4),10(3,4)         FIELD4       
   00031A  9120 D084               TM    132(13),X'20'           DSAFIXD+132   
   00031E  47E0 B0D0               BC    14,208(0,11)            GN=2(00032C) 
   000322  58F0 20F4               L     15,244(0,2)             V(IGZCMSG )   
   000326  4110 A0AD               LA    1,173(0,10)             PGMLIT AT +165


I guess it is pretty clear now as MOVE FIELD1 TO FIELD3. has generated only 1 machine instruction so it will execute fastest out of 4.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Feb 28, 2007 9:46 pm    Post subject:
Reply with quote

Hello,

The assembly code posted is incorrect. You cannot move a comp field to a comp-3 field in one move. Something must convert from one format to the other. You can move a comp field to another comp field of the "same" size in one move - in the posted question both comp fields take 4 bytes.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Feb 28, 2007 10:53 pm    Post subject:
Reply with quote

The singler MVC is comp to comp.
The last one is slightly misleading, because it is only the ZAP. The additional code is not part of the move.
The other two clearly show CVB abd CVD.
Now which is faster, a ZAP of 3 bytes or an MVC of 4 bytes?
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Mar 01, 2007 1:27 am    Post subject:
Reply with quote

Hello,

If memory serves, the MVC is faster.

A straight move is faster than an arithmetic operation.
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu Mar 01, 2007 12:43 pm    Post subject: Re: Which will execute fast: COMP or COMP-3
Reply with quote

Hi Dick,

May be you are correct .
I still have a doubt on your line.
'A straight move is faster than an arithmetic operation'.

Actually I would have easily agreed if both the moves had same size fields.
Here Comp-3 field move is of 3 bytes.
whereas comp of 4 bytes.

Thanks,
-kapil.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Mar 01, 2007 9:55 pm    Post subject:
Reply with quote

Hello,

Please do a bit research on instruction speed. You will clear your doubt.

Moves (on every hardware platform i've supported) use less cpu resources than arithmetic operations. Add and subrtact are faster than multiply and divide, but all of them are slower than a direct move.
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
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts execute APP if they are not ADDRESS T... italo_pm CLIST & REXX 3 Fri Aug 12, 2016 2:15 am
No new posts Execute multiple DB2 Load commands in... faizm DB2 4 Wed Aug 03, 2016 12:53 pm


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