View previous topic :: View next topic
|
Author |
Message |
HARLEEN SINGH MANN Warnings : 2 New User
Joined: 03 Aug 2007 Posts: 17 Location: Pune
|
|
|
|
among the following which is most efficient:
1) initialize ww-data
2) move spaces to ww-data
consider ww-data to be alphanumeric in both cases.
Plz mention the reason why u think which one is efficient and efficient in wat sense?
Warning: Title Edited |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If ww-data is a pic x elementary item, they both do the same thing. One will run the same as the other. |
|
Back to top |
|
|
Harm10
New User
Joined: 13 Oct 2007 Posts: 10 Location: Holland
|
|
|
|
I think you'll have to elaborate some more about the exact definition of ww-data. Like Dick Scherrer says if it is only an elementary item (i.e. there are no lower levels beneath it) then there will be no difference.
If there are lower levels then the move will be much faster because initialize initializes every element anew! |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
If ww-data has lower levels and any of them are ever changed to numeric then initialize will handle it correctly but move spaces may just cause a 0C7 or some similar error that will cause 10 or 15 posting on this board before it is debugged. |
|
Back to top |
|
|
Harm10
New User
Joined: 13 Oct 2007 Posts: 10 Location: Holland
|
|
|
|
Craq Giegerich wrote: |
If ww-data has lower levels and any of them are ever changed to numeric then initialize will handle it correctly but move spaces may just cause a 0C7 or some similar error that will cause 10 or 15 posting on this board before it is debugged. |
Quit right! To me this is obvious..............
Initialize looks nice but has some downfalls like not initializing fillers..... |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Quote: |
Initialize looks nice but has some downfalls like not initializing fillers..... |
Harm10,
I think otherwise, Fact that initialize verb does not intialize fillers can be used for our advantage. |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi !
Fore the FILLER fields you could use:
INITIALIZE ... WITH FILLER.
Please also have a look at the TO VALUE option.
Regards, UmeySan |
|
Back to top |
|
|
Harm10
New User
Joined: 13 Oct 2007 Posts: 10 Location: Holland
|
|
|
|
UmeySan wrote: |
Fore the FILLER fields you could use:
INITIALIZE ... WITH FILLER. |
I don't know that option. I tried it and our compiler doesn't accept it.
In what Cobol release this option gets introduced?
Would be very nice to have............. |
|
Back to top |
|
|
puzzled_elton
New User
Joined: 09 May 2005 Posts: 7
|
|
|
|
Hi,
extra care needs to taken while using move statement to avoid any data exception problems.usually move is used for indivisual variable for resetting its values.
Initialise is used used at group level to initialise the indivisual datya types with spaces or zeros depending on data attributes. |
|
Back to top |
|
|
TG Murphy
Active User
Joined: 23 Mar 2007 Posts: 148 Location: Ottawa Canada
|
|
|
|
Guys,
If you compile using the LIST option it will show the Assembler statements. INITIALIZE WS-VAR generates 3 statements. MOVE SPACES TO WS-VAR generates 2 statements.
So technically --- MOVE performs better than INITIALIZE. But big deal...
I would totally ignore this fact in my decision making as to whether I should use VALUE or MOVE or INITIALIZE in order to initialize a variable. The difference in performance is totally insignificant. What is important is this.
1. VALUE behaves differently than MOVE or INITIALIZE. It only executes on the first call to a subprogram (there are exceptions). Whereas MOVE and INITIALIZE can execute every time in. (Exception is when you code the INITIAL keyword on PROGRAM-ID statement)
2. The INITIALIZE statement is great. Before it was introduced (yes - I'm getting old) you had to often code many MOVE statements to initialize a structure. It was error prone. All these tedious MOVE statements can be replaced with 1 simple INITIALIZE statement. Do I care that the INITIALIZE statement generates a few additional MVI assembler instructions? Nope.
3. If your concern is performance, your time is much better spent optimizing other things (ie. your design, your SQL). Much greater payback on your time investment there.
Cheers |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi !
@ HARM_10
It's COBOl Enterprise V3R4. But There's also al lot more:
• Raise 16Mb COBOL data item size limit
• Unicode support stage 2
• NUMVAL, NUMVAL-C, enhancements
• DB2 enhancements
• REDEFINES enhancement
• MDECK compiler option
• SEARCH ALL statement updates
There are also some stealth features for retrieving Z/OS informations.
• Send your own messages to operator
• Decide if you want to stop or continue after error
• Log error information
– Environment variables: Setting and Retrieving
– Dynamic file allocation without assembler (not CBLQDA)
– Retrieving information about an ABEND with COBOL
– XML GENERATE
– Retrieving SYSTEM info using COBOL
– Displaying HEX data as printable
– Testing bit settings in COBOL
Please check it out at IBM website. There's some PDF stored.
Prettig weekend & Veel succes, UmeySan
@TG Murphy
Respect, I agree. Nowadays some micro-milli-nano or whatever fucking seconds don't matter. Also some Bytes more don't have an effect.
It's better spending time in creating a clear, neatly arranged and structured program, whatever language you use, Cob or Ass, so that mostley everyone could simply do a needed change in the middle of the night after some bottels of red wine and a lazy time with two blonds.
That's what we had to do years ago, and also sometimes today.
Amendment statement: Today, ... there is still only the red wine
Regards & nice Weekend, UmeySan |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
UmeySan wrote: |
night after some bottels of red wine and a lazy time with two blonds.
Amendment statement: Today, ... there is still only the red wine
Regards & nice Weekend, UmeySan |
Did the 2 blonds go because of the cheap red wine or did you go to cheap red wine because the 2 blonds left? |
|
Back to top |
|
|
Harm10
New User
Joined: 13 Oct 2007 Posts: 10 Location: Holland
|
|
|
|
UmeySan wrote: |
Please check it out at IBM website. There's some PDF stored.
Prettig weekend & Veel succes, UmeySan |
Will check it out!
Veel plezier met de blondjes............... |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi Craq !
Who the hell put rumours in circulation, that it had been cheap red wine ?
It's the the exact opposite. In fact of the expensive wine and the conspicuous consumption, I couldn't pay the blonds anymore.
Becoming older, you must change the order of priorities !!! ;-)
Have a nice time, UmeySan |
|
Back to top |
|
|
Harm10
New User
Joined: 13 Oct 2007 Posts: 10 Location: Holland
|
|
|
|
@ Umeysan
I checked the reference guide of Cobol Enterprise Server V3R4 and the option WITH FILLER is not specified.
As we got this version running I tried the option and it is not recognized.
Could you please check again what version contains this option? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
INITIALIZE "WITH FILLER" is valid with Fujitsu and Micro-Focus COBOL (and others i believe).
I've not seen it with IBM mainframe COBOL compilers. |
|
Back to top |
|
|
|