1 
 2 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
10 
11 
12 
13 get_kstep:
14      proc (a_segno, a_kstep, a_code);
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 dcl  a_kstep ptr,
38      dir bit (1) aligned init ("1"b),
39      a_code fixed bin (35),
40     (a_segno, segno) fixed bin (17);
41 
42 dcl (error_table_$invalidsegno, error_table_$notadir) ext fixed bin (35);
43 
44           %include kst;
45 
46           dir = "0"b;
47 
48 dir:      entry (a_segno, a_kstep, a_code);
49 
50           segno = a_segno;
51           a_kstep = null();
52           a_code = 0;
53           kstp = pds$kstp;
54           if segno < kst.lowseg | segno > kst.highest_used_segno
55           then do;
56 err:           a_code = error_table_$invalidsegno;
57                return;
58           end;
59           kstep = addr (kst.kst_entry (segno));
60           if unspec (kste.entryp) = "0"b then go to err;
61           if dir
62           then if ^kste.dirsw | kste.uid = "0"b
63                then do;
64                     a_code = error_table_$notadir;
65                     return;
66                end;
67           a_kstep = kstep;
68           return;
69 
70      end get_kstep;