1
2
3 checksum: proc (p, n) returns (bit (36)aligned);
4
5
6
7
8
9
10 dcl p ptr parm;
11 dcl n fixed bin (18)parm;
12
13
14
15 a = 0;
16 do i = 1 to n;
17 b = fixed (array (i), 36) + fixed (sum, 36) + fixed (carry, 1);
18 a = b;
19 end;
20 b = fixed (sum, 36) + fixed (carry, 1);
21 a = b;
22 return (sum);
23
24 dcl a fixed bin(71);
25 dcl b fixed bin(71);
26 dcl i fixed bin(24);
27 dcl array (n) bit (36) based (p);
28 dcl 1 a_overlay aligned based (addr (a)),
29 2 fill bit (35) unal,
30 2 carry bit (1) unal,
31 2 sum bit (36);
32
33 end checksum;
34
35