1 
  2 
  3 
  4 
  5 
  6 
  7 
  8 
  9 
 10 
 11 
 12 
 13 
 14 demand_deactivate: proc (a_segptr, a_code);
 15 
 16 
 17 
 18 
 19 
 20 
 21 
 22 
 23 
 24 
 25 
 26 
 27 
 28 
 29 
 30 
 31 
 32 
 33 dcl  a_segptr ptr parameter;
 34 dcl  a_seg_uid bit (36) aligned parameter;
 35 dcl  a_code fixed bin (35) parameter;
 36 
 37 dcl  segno fixed bin (17);
 38 dcl  code fixed bin (35);
 39 dcl  uid bit (36) aligned;
 40 dcl  force_sw bit (1) aligned;
 41 
 42 dcl  sst$demand_deact_attempts fixed bin (35) external static;
 43 dcl  sst$demand_deactivations fixed bin (35) external static;
 44 
 45 dcl  deactivate entry (ptr, fixed bin (35));
 46 dcl  get_kstep entry (fixed bin, pointer, fixed bin (35));
 47 dcl  lock$lock_ast entry ();
 48 dcl  lock$unlock_ast entry ();
 49 dcl  search_ast entry (bit (36) aligned) returns (pointer);
 50 
 51 dcl  error_table_$illegal_deactivation fixed bin(35) ext static;
 52 
 53 dcl  (baseno, binary, null) builtin;
 54 
 55 %page;
 56 
 57           force_sw = "0"b;                                  
 58           goto FIND_UID;
 59 
 60 
 61 demand_deactivate$force_given_segno:
 62      entry (a_segptr, a_code);
 63 
 64           force_sw = "1"b;
 65 
 66 FIND_UID:
 67           segno = binary (baseno (a_segptr), 18);           
 68 
 69           call get_kstep (segno, kstep, code);
 70           if code ^= 0 then do;                             
 71                a_code = code;
 72                return;
 73           end;
 74 
 75           uid = kste.uid;
 76           goto COMMON;
 77 
 78 
 79 demand_deactivate$force: entry (a_seg_uid, a_code);         
 80 
 81           uid = a_seg_uid;
 82           force_sw = "1"b;                                  
 83 
 84 
 85 COMMON:   code = 0;                                         
 86           sst$demand_deact_attempts = sst$demand_deact_attempts + 1;
 87           call lock$lock_ast ();
 88 
 89 
 90 
 91 
 92 
 93           astep = search_ast (uid);
 94           if astep ^= null () then
 95                if force_sw | aste.explicit_deact_ok then do;
 96                     if (astep -> aste.fp | astep -> aste.bp) = ""b
 97                     then do;
 98                          code = error_table_$illegal_deactivation;
 99                          go to RETURN;
100                     end;
101                     call deactivate (astep, code);          
102 
103                     if code = 0 then sst$demand_deactivations = sst$demand_deactivations + 1;
104                end;                                         
105 RETURN:
106           call lock$unlock_ast ();
107           a_code = code;
108           return;
109 
110 
111 %page; %include aste;
112 %page; %include kst;
113 
114      end demand_deactivate;