×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




In his example you couldn't use the select since between oops and OopsToo there is extra processing.


Sharon Wintermute

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Taylor iSeries
Sent: Tuesday, March 02, 2010 1:26 PM
To: rpg400 l
Subject: More on RPG style

Dennis' code:
1. For once = 1 to 1 ;                                 
2.     // Stuff                                         
3.     // Oops - an error is found.  We gotta get out. 
4.     If oops ;                                       
5.         // do stuff                                   
6.         rtnValue = -1 ;                               
7.         Leave ;                                       
8.     EndIF ;                                         
9.     // More stuff
10.     // More stuff                                   
11.     If oopsToo ;                                     
12.         // do stuff                                   
13.         rtnValue = -2 ;     
14.         Leave ;             
15.     EndIF ;               
16.     rtnValue = *Zero ;     
17.   EndDO ;                   
18.   // Cleanup               
19.   Return rtnValue ;
The idea is good: 1 entry point into code and 1 entry point out.   I use that method too..... Sort of
 
My university professors would have rejected my code because the LEAVE is considered nothing but a GOTO.
Instead they would have INSISTED on the Select statement because that is structured programming technique.
 
1. Select ;    
2.  when oops ;                                       
3.         // do stuff                                   
4.         rtnValue = -1 ;                                                                                                       
5.   when oops2  ;                                     
6.         // do stuff                                   
7.         rtnValue = -2 ;     
8.    Other;         
9.     rtnValue = *Zero ;     
10.   Endsl ;                   
11.   // Cleanup               
12.   Return rtnValue ;




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.