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:
- //-----------------------------------------------------------------
- // array definition & initialization
- //-----------------------------------------------------------------
-
- d code_init s 4a inz('fFhH')
- d value_init s 24a inz('footerFOOTERheaderHEADER')
-
- d codes s 1a dim(4) based(code_ptr)
- d values s 6a dim(4) based(value_ptr)
-
- d code_ptr s * inz(%addr(code_init))
- d value_ptr s * inz(%addr(value_init))
-
- d i s 5u 0
- d string s 8a
-
-
- //-----------------------------------------------------------------
- // what are the codes and their values?
- //-----------------------------------------------------------------
-
- /free
-
- for i = 1 to %elem(codes);
- string = codes(i) + '=' + values(i);
- dsply string;
- endfor;
-
- *inlr = *on;
-
- /end-free
-
|
|
|