1 
  2 /****^  HISTORY COMMENTS:
  3   1) change(2019-08-17,GDixon), approve(2019-10-24,MCR10069),
  4      audit(2020-01-20,Swenson), install(2020-01-20,MR12.6g-0035):
  5      mbuild subroutine to invoke other mbuild requests, or display a banner
  6      describing invocation of such requests.
  7                                                    END HISTORY COMMENTS */
  8 
  9 
 10 /* ======================================================================
 11  *
 12  *  mbuild UTILITY ROUTINES
 13  *
 14  * ====================================================================== */
 15 
 16 mbuild_:
 17      proc();
 18 
 19   dcl  ioa_ entry() options(variable);
 20   dcl  ioa_$general_rs_control_string entry(ptr, char(*), fixed bin, char(*), fixed bin(21), bit(1) aligned,
 21           bit(1) aligned);
 22   dcl  ioa_$rsnnl entry() options(variable);
 23   dcl  cu_$arg_count_rel entry (fixed bin, ptr, fixed bin(35));
 24   dcl  cu_$arg_list_ptr entry (ptr);
 25   dcl  ssu_$evaluate_active_string entry (ptr, ptr, char(*), fixed bin, char(*) var, fixed bin(35));
 26 
 27   dcl  NL char(1) int static options(constant) init("
 28 ");
 29   dcl  NLNL char(2) int static options(constant) init("
 30 
 31 ");
 32 
 33   dcl (addr, length, rtrim, substr) builtin;
 34 %page;
 35 /* ----------------------------------------------------------------------
 36     ENTRYPOINT:  banner
 37 
 38     Display an mbuild banner line without executing any requests in the
 39     banner text.
 40 
 41     If Adisplay = T  &  Arequest_line begins with:
 42       "^/^/"  - then display of banner starts with banner hyphens.
 43       other   - then display only the banner.
 44    ---------------------------------------------------------------------- */
 45 banner:
 46      entry (AsciP, Arequest_line, Adisplay) options(variable);
 47 
 48   dcl  Arequest_line char(*);                               /* ioa_ control string giving request to be executed.     */
 49   dcl  Adisplay bit(1) aligned;                             /* T: display request line before executing it.           */
 50 
 51   dcl  bannerS bit(1) aligned init(F);
 52 
 53      bannerS = T;
 54      goto DO_BANNER;
 55 
 56 
 57 /* ----------------------------------------------------------------------
 58     ENTRYPOINT:  general_request
 59 
 60     Execute an mbuild request line, optionally displaying the entire
 61     request line.
 62 
 63     If Adisplay = T  &  Arequest_line begins with:
 64       "^/^/"  - then display of request line starts with banner hyphens.
 65       other   - then display only the request line.
 66 
 67     Aarg_listP     = pointer to argument list containing args to be used in
 68                      request_line.
 69     Astarting_argI = number of first arg in that arg_list to be used.
 70 
 71    ---------------------------------------------------------------------- */
 72 general_request:
 73      entry (AsciP, Arequest_line, Adisplay, Aarg_listP, Astarting_argI);
 74 
 75   dcl  Aarg_listP ptr;
 76   dcl  Astarting_argI fixed bin;
 77 
 78   dcl  arg_count fixed bin;
 79   dcl  ignore_code fixed bin(35);
 80   dcl  gen_request_line char(500);
 81   dcl  request_line char(500),
 82        request_lineL fixed bin(21);
 83 
 84      call cu_$arg_count_rel (arg_count, Aarg_listP, ignore_code);
 85      if  arg_count < Astarting_argI  then do;
 86           request_line = Arequest_line;
 87           request_lineL = length(rtrim(Arequest_line));
 88           end;
 89      else do;
 90           arg_count = arg_count - (Astarting_argI-1);
 91           call ioa_$rsnnl ("^a^^^d( ^^a^^)", gen_request_line, request_lineL, Arequest_line, arg_count);
 92           call ioa_$general_rs_control_string (Aarg_listP, substr(gen_request_line,1,request_lineL), Astarting_argI,
 93                request_line, request_lineL, F, T);
 94           end;
 95 
 96      go to DO_REQUEST;
 97 
 98 
 99 /* ----------------------------------------------------------------------
100     ENTRYPOINT:  request
101 
102     Execute an mbuild request line, optionally displaying the entire
103     request line.
104 
105     If Adisplay = T  &  Arequest_line begins with:
106       "^/^/"  - then display of request line starts with banner hyphens.
107       other   - then display only the request line.
108    ---------------------------------------------------------------------- */
109 request:
110      entry (AsciP, Arequest_line, Adisplay) options(variable);
111 
112   dcl  arg_listP ptr;
113   dcl  argI fixed bin init(4);
114 
115 DO_BANNER:
116      call cu_$arg_list_ptr (arg_listP);
117      call ioa_$general_rs_control_string (arg_listP, Arequest_line, argI, request_line, request_lineL, F, T);
118 
119 DO_REQUEST:
120      if Adisplay then do;
121           if  substr(request_line,1,length(NLNL)) = NLNL  then
122                call ioa_ ("^/---------- ^a", substr(request_line, 1+length(NLNL), request_lineL-length(NLNL)));
123           else call ioa_ (substr(request_line,1,request_lineL));
124           end;
125 
126      if ^bannerS then
127           call ssu_$execute_line (AsciP, addr(request_line), request_lineL, ignore_code);
128      return;
129 %page;
130 /* ----------------------------------------------------------------------
131     ENTRYPOINT:  general_active_request
132 
133     Execute an mbuild request line, optionally displaying the entire
134     request line.
135 
136     Aarg_listP     = pointer to argument list containing args to be used in
137                      request_line.
138     Astarting_argI = number of first arg in that arg_list to be used.
139 
140    ---------------------------------------------------------------------- */
141 general_active_request:
142      entry (AsciP, Arequest_line, Astring_type, Aaf_ret, Aarg_listP, Astarting_argI);
143 
144 /*dcl  Aarg_listP ptr;
145   dcl  Astarting_argI fixed bin;  */
146   dcl  Astring_type fixed bin;                              /* a NON-ZERO type in: cp_active_string_types.incl.pl1    */
147   dcl  Aaf_ret char(*) var;
148 
149   dcl  active_string char(request_lineL) based(addr(request_line));
150 
151      call cu_$arg_count_rel (arg_count, Aarg_listP, ignore_code);
152      arg_count = arg_count - 1;                             /*  - Don't count af_ret as an input argument.            */
153      if  arg_count < Astarting_argI  then do;
154           request_line = Arequest_line;
155           request_lineL = length(rtrim(Arequest_line));
156           end;
157      else do;
158           arg_count = arg_count - (Astarting_argI-1);
159           call ioa_$rsnnl ("^a^^^d( ^^a^^)", gen_request_line, request_lineL, Arequest_line, arg_count);
160           call ioa_$general_rs_control_string (Aarg_listP, substr(gen_request_line,1,request_lineL), Astarting_argI,
161                request_line, request_lineL, F, F);
162           end;
163 
164      call ssu_$evaluate_active_string (AsciP, null(), active_string, Astring_type, Aaf_ret, code);
165      if code ^= 0 then
166           call ssu_$print_message (AsciP, code, "^/   active string: ^[^;|^;||^][^a]^/   partial result: ^a",
167                Astring_type, active_string, Aaf_ret);
168      return;
169 %page;
170 %include ssu_subroutine_dcls_;
171 %page;
172 %include cp_active_string_types;
173      end mbuild_;