View previous topic :: View next topic
|
Author |
Message |
srebba Warnings : 1 New User
Joined: 26 Apr 2007 Posts: 37 Location: USA
|
|
|
|
Hi,
is there any diference in perforamance while move statement below.
MOVE ZEROS TO VAR1
MOVE ZEROS TO VAR2
MOVE ZEROS TO VAR3
MOVE ZEROS TO VAR4
MOVE ZEROS TO VAR5
MOVE ZEROS TO VAR6
MOVE ZEROS TO VAR7
MOVE ZEROS TO VAR8
OR
MOVE ZEROS TO VAR1
VAR2
VAR3
VAR4
VAR5
VAR6
VAR7
VAR8
Thank you,
Sree |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Why do you think that there will be any performance issue? |
|
Back to top |
|
|
srebba Warnings : 1 New User
Joined: 26 Apr 2007 Posts: 37 Location: USA
|
|
|
|
We will have to think.. then we can increase the program performance... |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
If you're having performance issues, MOVE statements are the least likely to be the culprits.
You may want to begin reviewing file access, buffering, etc.
For example, too many Random KSDS "Writes" can be a problem, especially if they're causing "CA" splits.
You have to live with "CI" splits....
Bill |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Why do you think you need to improve program performance? |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
Without actual testing it, I am sure the difference between the 2 alternatives are unmesurable.
Anyway, these statements should not be the first target for optimisation, if you need to improve processing. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
In my humble opinion, to become an expert programmer in a compiled language like COBOL, you should have at least an intro course in assembler language programming.
When you know what can be done at that level, then you know how a multiple MOVE vs. separate MOVE's might be implemented in machine/assembler language.
In addition, you can look at the PMAP compiler output and actually see what is happening to your code.
A great example I experienced was a S0C7 abend on a COBOL statement doing arithmetic on PIC S9(5)V99. Note, this is not COMP-3, yet I got a S0C7, which is a packed-decimal abend. The generated code showed that since my PIC was signed, the generated code (for some reason I do not remember) converted to packed-decimal, did the arith, including an OI (or-immediate), then converted back to DISPLAY.
I also had the pleasure, when a summer programmer at IBM while in college, of finding a code generation error in the old FORTRAN H compiler. That's another story. |
|
Back to top |
|
|
Traveler
New User
Joined: 12 Aug 2010 Posts: 8 Location: Highlands, NJ
|
|
|
|
Not sure the OP was asking about performance improvement. Is there a difference in performance between the move statement as structured in the example presented. 35 years ago I attended the Prudential Insurance Programmers Course. It was required part of the training and you learned Pru-Cobol. Complete with coding restrictions and code layout requirements.
One thing that was required of all program initializations sections was the use of working storage fields with values of zero that matched size and type of the field being initialized. The reason given was performance, less instructions were being executed. So wsfield-ps999v9999-comp3 was moved to fields that matched that size and were zoned decimal. Binary was moved to comp and so on. When they did the formal walk through of code changes if they found a MOVE ZEROS to it was rejected.
These programs were part of a massively large modularized system known as the Advanced Ordinary System (AOS) and ran 7 days a week from 6:00 PM to 3:AM it was the main policy support system. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
As opposed to a HLL, such as PL/I, COBOL utilizes Figurative Constants, which are allocated and defined to the compiler and stored in the TGT.
So, when you move ZERO to a field, the compiler uses the proper Figurative Constant, depending on the data-type and therefore, reduces the literal-pool.
Thirty-Five years ago, OS/VS COBOL (non-reentrant I might add) was the version/release being used. Cycle reduction was a major consideration, as there was quite a farm of 360's still around. Not too sure when COBOL was updated with the 370 Instruction set, such as MVCL, SRP, ICM, etc, so perhaps this was the reason for Prudential's approach. Also, Mainframes back then were draconian in speed as compared to today's processors.
In pre-VS/COBOL II, the WS fields that included a VALUE clause, were really DC's (under the covers) instead of DS's (VS/COBOL II and greater).
Phil said it best; In order to understand the nuances of a given HLL, basic knowledge of Assembler should be a requirement, if not a mandate.
Bill |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
the two cobol statements will generate the same assembler. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Bill O'Boyle wrote: |
Phil said it best; In order to understand the nuances of a given HLL, basic knowledge of Assembler should be a requirement, if not a mandate.
Bill |
I agree with you on a basic knowledge of Assembler but now days it is even a basic knowledge of COBOL that is in short supply. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Quote: |
but now days it is even a basic knowledge of COBOL that is in short supply. |
And JCL, and Utilities, and Data Formats, and Access Methods, and . . .
Quite scary. . . |
|
Back to top |
|
|
pawaria
New User
Joined: 06 Apr 2006 Posts: 7 Location: Noida
|
|
|
|
Both statements will run the same. Only your written style is different but both statements will be seen as identical by compiler.
Suggestion:
You can better use VALUE ZERO in the working storage
or
Use INITIALIZE
instead of all these MOVE statements. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
pawaria,
why do you think INITIALIZE will be better than the MOVE? |
|
Back to top |
|
|
Alex Bruzzone
New User
Joined: 18 Aug 2010 Posts: 4 Location: Ottawa
|
|
|
|
A possibility, but only if VAR1 to VAR8 were defined as COMP and under an 01-level dataname, would be to write
Code: |
01 ALL-VARS.
02 VAR1 PIC S9(8) COMP.
.
02 VAR8 PIC S9(8) COMP.
.
.
MOVE LOW-VALUES TO ALL-VARS |
Otherwise, define an identical 01-level already initialized to zeros, and the just code:
Code: |
MOVE ZEROED-VARS TO ALL-VARS |
Any of these two Moves I'm suggesting will perform better than the two different formats for the eight separate Moves suggested by the original poster. |
|
Back to top |
|
|
|