midrange.com code scratchpad
Name:
Initialize Arrays using D specs
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
08/08/2013 11:43:19 pm
IP:
Logged
Description:
A sample of initializing arrays in D specs
Code:
  1.  //----------------------------------------------------------------- 
  2.  // array definition & initialization                                
  3.  //----------------------------------------------------------------- 
  4.                                                                      
  5. d code_init       s              4a   inz('fFhH')                    
  6. d value_init      s             24a   inz('footerFOOTERheaderHEADER')
  7.                                                                      
  8. d codes           s              1a   dim(4) based(code_ptr)         
  9. d values          s              6a   dim(4) based(value_ptr)        
  10.                                                                      
  11. d code_ptr        s               *   inz(%addr(code_init))          
  12. d value_ptr       s               *   inz(%addr(value_init))         
  13.                                                                      
  14. d i               s              5u 0                                
  15. d string          s              8a                                  
  16.                                                                      
  17.                                                                    
  18. //-----------------------------------------------------------------
  19. // what are the codes and their values?                            
  20. //-----------------------------------------------------------------
  21.                                                                    
  22. /free                                                              
  23.                                                                    
  24.  for i = 1 to %elem(codes);                                        
  25.   string = codes(i) + '=' + values(i);                             
  26.   dsply  string;                                                   
  27.  endfor;                                                           
  28.                                                                    
  29.  *inlr = *on;                                                      
  30.                                                                    
  31. /end-free                                                          
  32.  
© 2004-2019 by midrange.com generated in 0.006s valid xhtml & css