Code Comments
Programming Forum and web based access to our favorite programming groups.OK some more since I thought about this... The first quoted statement comes true in your code. You will want to check the code very carefully for things that are getting run all the time that probably shouldn't...but some specific things I've seen... IF WS-VFELD NOT < TB-ABG-ABGRVON (ABG-IND) AND WS-VFELD NOT > TB-ABG-ABGRBIS (ABG-IND) I'm not sure if there's specific reasons for logic like this occurring in your code, or which would be more efficient, but I'm a big opponent of using negative logic, just because it's not as understandable. Something like this would be preferable to me, but it's always worth seeing an assembler list to make sure you're not hurting efficiency. IF WS-VFELD >= TB-ABG-ABGRVON (ABG-IND) AND WS-VFELD <= TB-ABG-ABGRBIS (ABG-IND) Then it helps to simplify things. Inline performs can get confusing and make it hard so you can see what is going on in your code. I would suggest trying to take some of the inline performs and make them into separate paragraphs, so your logic becomes clearer to you. If you do that you will see that the following is getting performed as part of a loop. PERFORM UNTIL BLA BLA IF WS-FORMAT = 'X' IF WS-VFELD >= TB-ABG-ABGRVON (ABG-IND) AND WS-VFELD <= TB-ABG-ABGRBIS (ABG-IND) SET PS-TREFFER-JA TO TRUE END-IF ELSE IF WS-VFELD-N >= TB-ABG-ABGRVON-N(ABG-IND) AND WS-VFELD-N <= TB-ABG-ABGRBIS-N(ABG-IND) SET PS-TREFFER-JA TO TRUE END-IF END-IF SET ABG-IND UP BY 1 END-PERFORM. What I mean by decoupling the code is that we can rewrite things more efficiently to move logic OUT of the perform loop. This logic is hard to see, but becomes clear once you set things out as separate paragraphs. Compare the code up top with this code... IF WS-FORMAT = 'X' PERFORM UNTIL BLA BLA IF WS-VFELD >= TB-ABG-ABGRVON (ABG-IND) AND WS-VFELD <= TB-ABG-ABGRBIS (ABG-IND) SET PS-TREFFER-JA TO TRUE END-IF SET ABG-IND UP BY 1 END-PERFORM ELSE PERFORM UNTIL BLA BLA IF WS-VFELD-N >= TB-ABG-ABGRVON-N(ABG-IND) AND WS-VFELD-N <= TB-ABG-ABGRBIS-N(ABG-IND) SET PS-TREFFER-JA TO TRUE END-IF SET ABG-IND UP BY 1 END-PERFORM END-IF. What is important to remember is that more lines of code does not always equal more processing time. This is a big fallacy that most coders have, and becomes apparent here. While yes the same logic is being expressed in more lines of code, the code I posted will be more efficient. Why? Look at the first code. The "IF WS-FORMAT = 'X'" question is being asked EVERY time the loop is entered. In the rewritten code, the question is only asked ONCE before the loop is even entered. In rewriting this code for your application we reduced the number of comparisons by 399999. I noticed as well that other code that you posted may be decoupled as well. Hope this helps you, if you still are watching. Reply if you have questions...or for anyone, let's talk about program optimization. ggrotz73@hotmail.com (Sky_Eagle1) wrote in message news:<b305dd6.0403032009.7660b91f@postin g.google.com>... > Also, remember any small coding problem will be > magnified 100 fold so it pays to optimize it. This means simplify > simplify simplify...the fewest instructions to do the job... > The third thought I had is to truly think through your logic and try > to decouple some of it from the loops - if you can do that that will > help tremendously on your speed. Basically anything you can get out > of those perform loops and into an iterative cycle will help you. I'm > looking at your code for that and will probably post something if I > can think of it.
Post Follow-up to this messageOn 4-Mar-2004, ggrotz73@hotmail.com (Sky_Eagle1) wrote: > IF WS-VFELD NOT < TB-ABG-ABGRVON (ABG-IND) > AND WS-VFELD NOT > TB-ABG-ABGRBIS (ABG-IND) > > I'm not sure if there's specific reasons for logic like this occurring > in your code, or which would be more efficient, but I'm a big opponent > of using negative logic, just because it's not as understandable. > Something like this would be preferable to me, but it's always worth > seeing an assembler list to make sure you're not hurting efficiency. > > IF WS-VFELD >= TB-ABG-ABGRVON (ABG-IND) > AND WS-VFELD <= TB-ABG-ABGRBIS (ABG-IND) I'm a big proponent of the ELSE clause IF WS-VFELD < TB-ABG-ABGRVON (ABG-IND) OR WS-VFELD > TB-ABG-ABGRVON (ABG-IND) CONTINUE ELSE PERFORM WITHIN-RANGE END-IF
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.