midrange.com code scratchpad
Name:
Anonymous
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
03/02/2010 08:46:29 pm
IP:
Logged
Description:
The user was to lazy to give a description
Code:
  1.   /Free                                               
  2.                                                      
  3. P myProc          B                                   
  4. D                PI            10I 0                 
  5. D  parm1                        8    Const           
  6.                                                      
  7. D once            S              3U 0                 
  8. D rtnValue        S                  Like(myProc)
  9.                                                      
  10. /Free   
  11.  
  12.   // This approach doesn't add unnecessary condition tests
  13.   // to the flow - that is as clean as any alternative.  It
  14.   // also adheres to the "one entry / one exit" standard of
  15.   // programming.
  16.  
  17.   rtnValue = -9999 ;
  18.   For once = 1 to 1 ;                                 
  19.     // Stuff                                         
  20.     // Oops - an error is found.  We gotta get out. 
  21.     If oops ;                                       
  22.         // do stuff                                   
  23.         rtnValue = -1 ;                               
  24.         exsr return;                                       
  25.     EndIF ;                                         
  26.     // More stuff
  27.     // More stuff                                   
  28.     If oopsToo ;                                     
  29.         // do stuff                                   
  30.         rtnValue = -2 ;     
  31.         exsr return;             
  32.     EndIF ;               
  33.     rtnValue = *Zero ;     
  34.   EndDO ;                   
  35.   exsr return;
  36.   
  37.   begsr return;
  38.     // Cleanup
  39.     Return rtnvalue;
  40.   endsr;
  41.                            
  42. /End-free                 
  43.                            
  44. P myProc          B         
  45.  
© 2004-2019 by midrange.com generated in 0.007s valid xhtml & css