1 /*   BEGIN INCLUDE FILE rw_report_structures.incl.pl1
  2 
  3    Written - Al Dupuis - August 1983
  4 */
  5 /* format: off */
  6 %skip (1);
  7 /* Used in column_info.alignment and column_info.subsystem_data_type */
  8 %skip (1);
  9      dcl     BIT_DATA_TYPE          fixed bin static int options (constant) init (1);
 10      dcl     BOTH_ALIGNMENT         fixed bin static int options (constant) init (1);
 11      dcl     CENTER_ALIGNMENT       fixed bin static int options (constant) init (2);
 12      dcl     CHAR_DATA_TYPE         fixed bin static int options (constant) init (2);
 13      dcl     DECIMAL_ALIGNMENT      fixed bin static int options (constant) init (3);
 14      dcl     DECIMAL_DATA_TYPE      fixed bin static int options (constant) init (3);
 15      dcl     LEFT_ALIGNMENT         fixed bin static int options (constant) init (4);
 16      dcl     NUMERIC_DATA_TYPE      fixed bin static int options (constant) init (4);
 17      dcl     RIGHT_ALIGNMENT        fixed bin static int options (constant) init (5);
 18 %skip (3);
 19      dcl     1 column_info          aligned based (column_ip),
 20                2 flags,
 21                  3 folding_is_fill  bit (1) unaligned,        /* fill or truncate */
 22                  3 outline          bit (1) unaligned,        /* on means the display has been suppressed */
 23                  3 editing          bit (1) unaligned,        /* on means there is an editing request */
 24                  3 restore_editing  bit (1) unaligned,        /* used to toggle the editing bit */
 25                  3 available        bit (32) unaligned,
 26                2 order              fixed bin,                /* as specified by the user */
 27                2 input_column       fixed bin,                /* # of the column in the table */
 28                2 output_column      fixed bin,                /* # of the column on the page */
 29                2 output_line        fixed bin,                /* within the block */
 30                2 starting_position  fixed bin,                /* within the page width */
 31                2 width              fixed bin,                /* in characters */
 32                2 alignment          fixed bin,                /* set to one of the above alignment constants */
 33                2 decimal_position   fixed bin,                /* only needed for decimal alignment */
 34                2 subsystem_data_type fixed bin,               /* set to one of the above data type constants */
 35                2 editing_string_length fixed bin (21),        /* before evaluation */
 36                2 editing_string_result_length fixed bin (21), /* after evaluation */
 37                2 editing_string_ptr ptr,                      /* before evaluation */
 38                2 editing_string_result_ptr ptr,               /* after evaluation */
 39                2 prefix_character   char (1) varying;         /* column prefix */
 40      dcl     column_ip              ptr;
 41 %skip (3);
 42      dcl     1 columns_info         aligned based (columns_ip),       /* an array of column_info's */
 43                2 number_of_columns  fixed bin,
 44                2 columns            (initialize_number_of_columns
 45                                     refer (columns_info.number_of_columns)) like column_info;
 46      dcl     columns_ip             ptr;
 47 %page;
 48      dcl     1 column_map           (column_map_number_of_columns) aligned based (column_mp),
 49                2 present            bit (1),      /* the column is present in the list */
 50                2 position           fixed bin;    /* position where this column was found in the list */
 51      dcl     column_map_number_of_columns fixed bin;
 52      dcl     column_mp              ptr;
 53 %skip(3);
 54      dcl     1 count_columns_info like columns_info based (count_columns_ip);
 55      dcl     count_columns_ip ptr;
 56 %skip(3);
 57      dcl     1 count_info like total_info based (count_ip);
 58      dcl     count_ip ptr;
 59 %skip (3);
 60 /* Used to access the current row from the table */
 61      dcl     current_row_value      char (table_info.row_value_length) based (status.current_row_ptr);
 62 %skip (3);
 63 /* Used to pick up the value before or after evaluation */
 64      dcl     editing_string_result  char (editing_string_rl) based (editing_string_rp);
 65      dcl     editing_string_rl      fixed bin;
 66      dcl     editing_string_rp      ptr;
 67 %skip (3);
 68      dcl     editing_strings_next_byte fixed bin (21);
 69 /* Used to store editing strings before and after evaluation. */
 70      dcl     editing_strings_temp_seg char (maximum_segment_size) based (editing_strings_tsp);
 71      dcl     editing_strings_temp_seg_as_an_array (maximum_segment_size) char (1) based (editing_strings_tsp);
 72      dcl     editing_strings_tsp    ptr;
 73 %page;
 74      dcl     1 format_report_info   aligned based (format_report_ip),
 75                2 flags,
 76                  3 unlimited_page_length bit (1) unaligned,   /* -page_length equal to zero */
 77                  3 unlimited_page_width bit (1) unaligned,    /* -page_width equal to zero */
 78                  3 page_header_is_defined bit (1) unaligned,  /* -page_header_value */
 79                  3 group_header_is_defined bit (1) unaligned, /* -group_header_value */
 80                  3 group_header_trigger_is_defined bit (1) unaligned, /* -group_header_trigger */
 81                  3 title_block_is_defined bit (1) unaligned,  /* -title_line */
 82                  3 row_header_is_defined bit (1) unaligned,   /* -row_header_value */
 83                  3 row_value_is_defined bit (1) unaligned,    /* if all of the columns weren't excluded */
 84                  3 row_footer_is_defined bit (1) unaligned,   /* -row_footer_value */
 85                  3 group_footer_is_defined bit (1) unaligned, /* -group_footer_value */
 86                  3 group_footer_trigger_is_defined bit (1) unaligned, /* -group_footer_trigger */
 87                  3 page_footer_is_defined bit (1) unaligned,  /* -page_footer_value */
 88                  3 editing_is_defined bit (1) unaligned,      /* -editing */
 89                  3 exclude_is_defined bit (1) unaligned,      /* -exclude */
 90                  3 group_is_defined bit (1) unaligned,        /* -group */
 91                  3 outline_is_defined bit (1) unaligned,      /* -outline */
 92                  3 page_break_is_defined bit (1) unaligned,   /* -page_break */
 93                  3 subtotal_is_defined bit (1) unaligned,     /* -subtotal */
 94                  3 subcount_is_defined bit (1) unaligned,     /* -subcount */
 95                  3 total_is_defined bit (1) unaligned,        /* -total */
 96                  3 count_is_defined bit (1) unaligned,        /* -count */
 97                  3 available        bit (15) unaligned,
 98                2 page_width         fixed bin,                /* as given by the user */
 99                2 page_length        fixed bin,                /* as given by the user */
100                2 number_of_formatted_rows fixed bin (35),     /* updated at the end of each page */
101                2 editing_strings_next_available_byte fixed bin (21), /* beginning of temp space for execution */
102                2 headers_next_available_byte fixed bin (21),  /* beginning of temp space for execution */
103                2 report_iocb_ptr    ptr,                      /* for saving copies of the page */
104                2 table_info_ptr     ptr,                      /* to avoid repetitive calls to rw_table$info */
105                2 format_document_op ptr,                      /* format_document_options structure */
106                2 page_info_ptr      ptr,                      /* page_info structure */
107                2 copy_of_page_info_ptr ptr,                   /* version of page_info structure that can be changed */
108                                                               /* after each page */
109                2 formatted_page_info_ptr ptr,                 /* formatted_page_info structure */
110                2 overstrike_info_ptr ptr,                     /* page_overstrike_info structure */
111                2 status_ptr         ptr,                      /* status structure */
112                2 template_map_ptr   ptr,                      /* template_map array */
113                2 page_header_info_ptr ptr,                    /* header_info structure */
114                2 page_footer_info_ptr ptr,                    /* header_info structure */
115                2 group_header_info_ptr ptr,                   /* header_info structure */
116                2 group_footer_info_ptr ptr,                   /* header_info structure */
117                2 group_header_trigger_info_ptr ptr,           /* group_info structure */
118                2 group_footer_trigger_info_ptr ptr,           /* group_info structure */
119                2 row_header_info_ptr ptr,                     /* header_info structure */
120                2 row_footer_info_ptr ptr,                     /* header_info structure */
121                2 title_block_columns_info_ptr ptr,            /* title_block_columns_info structure */
122                2 title_block_info_ptr ptr,                    /* title_block_info structure */
123                2 input_columns_info_ptr ptr,                  /* input_columns_info structure */
124                2 input_columns_order_ptr ptr,                 /* input_columns_order array */
125                2 output_columns_info_ptr ptr,                 /* output_columns_info structure */
126                2 group_info_ptr     ptr,                      /* group_info structure */
127                2 outline_info_ptr   ptr,                      /* outline_info structure */
128                2 page_break_info_ptr ptr,                     /* page_break_info structure */
129                2 subtotal_info_ptr  ptr,                      /* subtotal_info structure */
130                2 subcount_info_ptr  ptr,                      /* subcount_info structure */
131                2 total_info_ptr     ptr,                      /* total_info structure */
132                2 count_info_ptr     ptr,                      /* count_info structure */
133                2 row_value_template_info_ptr ptr,             /* row_value_template_info structure */
134                2 generic_template_ptr ptr,                    /* generic_template char string */
135                2 header_part_delimiter char (1) unaligned,    /* delimits the different portions of a header/footer */
136                2 truncation_indicator char (32) varying unaligned, /* used to indicate that truncation has occured */
137                2 report_directory_name char (168) unaligned,  /* dir where we place copies of the page */
138                2 report_entry_name  char (32) unaligned;      /* entry name portion of above */
139      dcl     format_report_ip       ptr;
140 %skip(1);
141 /* used to format page/row headers and footers */
142      dcl     generic_template       char (generic_template_length) based (generic_tp);
143      dcl     generic_template_length fixed bin;
144      dcl     generic_tp             ptr;
145 %skip (3);
146 /* these columns form a group of rows and are used with outlining, etc. */
147      dcl     1 group_info aligned based (group_ip),
148                2 number_of_columns_to_group fixed bin,
149                2 column_number (gi_init_number_of_columns_to_group
150                          refer (group_info.number_of_columns_to_group)) fixed bin;
151 dcl gi_init_number_of_columns_to_group fixed bin;
152 dcl group_ip ptr;
153 %skip (3);
154      dcl     headers_next_byte      fixed bin (21);
155 /* used to hold the page/row headers/footers, and temp space for totals/subtotals. */
156      dcl     headers_temp_seg       char (maximum_segment_size) based (headers_tsp);
157      dcl     headers_temp_seg_as_an_array (maximum_segment_size) char (1) based (headers_tsp);
158      dcl     headers_tsp            ptr;
159 %skip (3);
160      dcl     1 header_info          aligned based (header_ip),
161                2 number_of_lines    fixed bin,              /* number of header lines typed in by the user */
162                2 maximum_number_of_parts fixed bin,         /* 3 parts maximum (left, right, and center) */
163                2 lines              (hi_init_number_of_lines
164                                     refer (header_info.number_of_lines)),
165                  3 parts            (hi_init_maximum_number_of_parts
166                                     refer (header_info.maximum_number_of_parts)),
167                    4 flags,
168                      5 present      bit (1) unaligned,      /* this particular part is defined */
169                      5 active       bit (1) unaligned,      /* and it contains active functions */
170                      5 available    bit (34) unaligned,
171                    4 index          fixed bin (21),         /* before evaluation */
172                    4 length         fixed bin (21),         /* before evaluation */
173                    4 starting_position fixed bin,           /* within the page width */
174                    4 width          fixed bin,              /* within the page width */
175                    4 alignment      fixed bin;              /* left, right, or center */
176      dcl     header_ip              ptr;
177      dcl     hi_init_maximum_number_of_parts fixed bin;
178      dcl     hi_init_number_of_lines fixed bin;
179 %skip (3);
180      dcl     initialize_number_of_columns fixed bin;  /* columns_info refer extent */
181 %skip (3);
182      dcl     1 input_columns_info   aligned like columns_info based (input_columns_ip); /* the columns in the table */
183      dcl     input_columns_ip       ptr;
184 %skip (3);
185      dcl     input_columns_order    (input_columns_info.number_of_columns) fixed bin based (input_columns_op);
186      dcl     input_columns_op       ptr;
187 %skip (3);
188      dcl     maximum_segment_size   fixed bin (21);         /* in characters */
189 %skip (3);
190 /* Used to access the next row from the table */
191      dcl     next_row_value         char (table_info.row_value_length) based (status.next_row_ptr);
192 %skip (3);
193      dcl     1 outline_info         aligned based (outline_ip),       /* who gets oulining attempted */
194                2 maximum_number_of_single_columns fixed bin,
195                2 maximum_number_of_grouping_columns fixed bin,
196                2 number_of_single_columns fixed bin,                  /* columns who are not a member of the group */
197                2 number_of_grouping_columns fixed bin,                /* columns who are a member of the group */
198                2 single_columns     (oi_init_maximum_number_of_single_columns refer (
199                                     outline_info.maximum_number_of_single_columns)) fixed bin,
200                2 grouping_columns   (oi_init_maximum_number_of_grouping_columns refer (
201                                     outline_info.maximum_number_of_grouping_columns)) fixed bin;
202      dcl     oi_init_maximum_number_of_grouping_columns fixed bin;
203      dcl     oi_init_maximum_number_of_single_columns fixed bin;
204      dcl     outline_ip             ptr;
205 %skip (3);
206      dcl     1 output_columns_info  like columns_info based (output_columns_ip); /* the columns that will go on the page */
207      dcl     output_columns_ip      ptr;
208 %skip (3);
209 /* these columns will be checked to determine if a page break is required */
210      dcl     1 page_break_info aligned based (page_break_ip),
211                2 number_of_columns fixed bin,
212                2 columns (pbi_init_number_of_columns refer (
213                          page_break_info.number_of_columns)) bit (1) unaligned;
214 dcl page_break_ip ptr;
215 dcl pbi_init_number_of_columns fixed bin;
216 %skip (3);
217 /* Used to access the previous row from the table */
218      dcl     previous_row_value     char (table_info.row_value_length) based (status.previous_row_ptr);
219 %skip (3);
220 /* The templates for the row value (also used for titles, subtotals, and totals.) */
221      dcl     1 row_value_template_info like template_info based (row_value_template_ip);
222      dcl     row_value_template_ip  ptr;
223 %skip (3);
224 /* main execution control structure for rw_fr_build_page */
225      dcl     1 status               aligned based (status_pointer),
226                2 flags,
227                  3 still_formatting_detail_blocks bit (1),  /* turned on while we are doing detail blocks */
228                  3 first_row_of_report bit (1),             /* turned on when we are on the first row of a report */
229                  3 last_row_of_report bit (1),              /* turned on when we are on the last row of a report */
230                  3 first_row_on_page bit (1),               /* turned on when we are on the 1st row of a page */
231                  3 page_overflow    bit (1),                /* turned on when we are backing up */
232                  3 subtotals_ejection_in_progress bit (1),  /* turned on when subtotals are being ejected */
233                  3 subcounts_ejection_in_progress bit (1),  /* turned on when subcounts are being ejected */
234                  3 totals_ejection_in_progress bit (1),     /* turned on when totals are being ejected */
235                  3 counts_ejection_in_progress bit (1),     /* turned on when counts are being ejected */
236                  3 header_being_evaluated bit (1),          /* turned on during header evaluation */
237                  3 detail_block_used_some_lines bit (1),    /* turned on when a row header/footer/value/subtotal/total uses a line */
238                  3 row_has_been_processed_before bit (1),   /* turned on when this row has been backed out of the previous page */
239                  3 last_pass bit (1),                       /* true if this is the last pass */
240                2 previous_row_ptr   ptr,                    /* points to the previous row (or null) */
241                2 current_row_ptr    ptr,                    /* points to the current row */
242                2 next_row_ptr       ptr,                    /* points to the next row (or null) */
243                2 total_number_of_rows_used fixed bin,       /* total # per page, used to make sure we don't */
244                                                             /* backup over the 1st row */
245                2 current_pass_number fixed bin,             /* [display_builtins current_pass_number] */
246                2 current_row_number fixed bin (35),         /* [display_builtins current_row_number] */
247                2 current_column_number fixed bin,           /* set to the current output column during row evaluation */
248                2 current_page_number fixed bin (21),        /* [display_builtins page_number] */
249                2 current_line_on_page fixed bin,            /* this is where the next thing is placed on the page */
250                2 remaining_lines_on_page fixed bin,         /* used in estimating if something will fit */
251                2 highest_row_formatted fixed bin,           /* used to keep track of rows backed out of the page */
252                2 current_header_line fixed bin,             /* set to the current header line during header evaluation */
253                2 current_header_part fixed bin,             /* set to the current header part during header evaluation */
254                2 number_of_lines_needed_for_detail_block fixed bin, /* sum of row header, footer, and value */
255                2 number_of_lines_needed_for_row_header fixed bin,   /* may be zero */
256                2 number_of_lines_needed_for_row_value fixed bin,    /* may be zero */
257                2 number_of_lines_needed_for_row_footer fixed bin,   /* may be zero */
258                2 number_of_lines_needed_for_page_footer fixed bin,  /* may be zero */
259                2 number_of_lines_needed_for_group_header fixed bin, /* may be zero */
260                2 number_of_lines_needed_for_group_footer fixed bin, /* may be zero */
261                2 last_row_number fixed bin (35),                    /* zero unless multi-pass */
262                2 last_page_number fixed bin,                        /* zero unless multi-pass mode */
263                2 object_being_evaluated char (16) varying;          /* "page header", "row value", etc. */
264      dcl     status_pointer         ptr;
265 %skip (3);
266      dcl     1 subcount_columns_info like columns_info based (subcount_columns_ip);
267      dcl     subcount_columns_ip    ptr;
268 %skip(3);
269      dcl     1 subcount_generation_info like subtotal_generation_info based (subcount_generation_ip);
270      dcl     subcount_generation_ip ptr;
271 %skip(3);
272      dcl     1 subcount_info like subtotal_info based (subcount_ip);
273      dcl     subcount_ip ptr;
274 %skip (3);
275      dcl     1 subtotal_columns_info like columns_info based (subtotal_columns_ip);
276      dcl     subtotal_columns_ip    ptr;
277 %skip (3);
278 /* Used to restore subtotals when backing up on a page. */
279      dcl     1 subtotal_generation_info aligned based (subtotal_generation_ip),
280                2 maximum_number_of_generation_blocks fixed bin,  /* maximum number of subtotals possibly generated per page + 1 */
281                2 number_of_subtotals fixed bin,                  /* # of subtotals we're taking */
282                2 current_generation_block fixed bin,             /* slot for next subtotal generation  */
283                2 generations (0:sgi_init_number_of_generations
284                     refer (subtotal_generation_info.maximum_number_of_generation_blocks)),
285                  3 subtotals (sgi_init_number_of_subtotals       /* value of the subtotals when the break occured */
286                     refer (subtotal_generation_info.number_of_subtotals)) float dec (59);
287 dcl sgi_init_number_of_generations fixed bin;
288 dcl sgi_init_number_of_subtotals fixed bin;
289 dcl subtotal_generation_ip ptr;
290 %skip (3);
291      dcl     1 subtotal_info        aligned based (subtotal_ip),
292                2 columns_info_ptr   ptr,                              /* points to subtotal_columns_info structure */
293                2 subtotal_generation_info_ptr ptr,                    /* points to subtotal_generations_info structure */
294                2 number_of_columns_to_subtotal fixed bin,             /* the number of subtotals */
295                2 highest_level fixed bin,                             /* the largest number of different subtotals on a single column  */
296                2 current_level fixed bin,                             /* the current level of subtotals being evaluated */
297                2 columns            (si_init_number_of_columns_to_subtotal
298                                     refer (subtotal_info.number_of_columns_to_subtotal)),
299                  3 flags,
300                    4 reset          bit (1) unaligned,                /* reset or running subtotals */
301                    4 group_column   bit (1) unaligned,                /* on means the watch column is a grouping column */
302                    4 available      bit (34) unaligned,
303                  3 input_column     fixed bin,                        /* # of the input column for accumulations */
304                  3 watch_column     fixed bin,                        /* # of the column to watch for generation */
305                  3 level            fixed bin,                        /* different subtotals on the same column receive higher level numbers */
306                  3 ioa_string       char (5) varying,                 /* used to edit the "subtotal" field */
307                  3 subtotal         float dec (59);                   /* used to hold the subtotal until it needs /*
308                                                                       /* to be placed on the page */
309      dcl     si_init_number_of_columns_to_subtotal fixed bin;
310      dcl     subtotal_ip            ptr;
311 %skip (3);
312      dcl     1 template_info        aligned based (template_ip),      /* templates that are laid down before the column values */
313                2 template_width     fixed bin,                        /* how wide they are */
314                2 number_of_templates fixed bin,                       /* how many there are */
315                2 templates          (ti_init_number_of_templates refer (template_info.number_of_templates)) /* the templates */
316                                     char (ti_init_template_width refer (template_info.template_width));
317      dcl     ti_init_number_of_templates fixed bin;
318      dcl     template_ip            ptr;
319      dcl     ti_init_template_width fixed bin;
320 %skip (3);
321 /* used to determine which templates have been placed */
322      dcl     template_map           (template_map_number_of_bits) bit (1) unaligned based (template_mp);
323      dcl     template_mp            ptr;
324      dcl     template_map_number_of_bits fixed bin;
325      dcl     template_map_defined_as_a_string bit (template_map_number_of_bits) based (template_mp);
326 %skip (3);
327      dcl     template               char (template_length) based (template_ptr);
328      dcl     template_length        fixed bin;
329      dcl     template_ptr           ptr;
330 %skip (3);
331      dcl     1 title_block_columns_info like columns_info based (title_block_columns_ip); /* output columns for the titles */
332      dcl     title_block_columns_ip ptr;
333 %skip (3);
334 /* holds the formatted title block after page 1 is finished */
335      dcl     1 title_block_info     aligned based (title_block_ip),
336                2 number_of_lines    fixed bin,                        /* how many lines there are */
337                2 line_length        fixed bin,                        /* how long the lines are */
338                2 lines              (tbi_init_number_of_lines refer ( /* the formatted lines */
339                                     title_block_info.number_of_lines)) char (tbi_init_line_length refer (
340                                     title_block_info.line_length));
341      dcl     tbi_init_line_length   fixed bin;
342      dcl     tbi_init_number_of_lines fixed bin;
343      dcl     title_block_ip         ptr;
344 %skip (3);
345      dcl     1 total_columns_info   like columns_info based (total_columns_ip); /* output_columns_info for totals */
346      dcl     total_columns_ip       ptr;
347 %skip (3);
348      dcl     1 total_info           aligned based (total_ip),
349                2 columns_info_ptr   ptr,                     /* points to total_columns_info structure */
350                2 number_of_columns_to_total fixed bin,       /* # to total */
351                2 columns            (ti_init_number_of_columns_to_total
352                                     refer (total_info.number_of_columns_to_total)),
353                  3 input_column     fixed bin,               /* the input column number */
354                  3 ioa_string       char (5) varying,        /* used to edit the "total" field */
355                  3 total            float dec (59);          /* used to hold the total until it's placed on the page */
356      dcl     ti_init_number_of_columns_to_total fixed bin;
357      dcl     total_ip               ptr;
358 %skip (1);
359 /*   END INCLUDE FILE rw_report_structures.incl.pl1 */