Subject: ARMRCALC04
The PRUNE Bracket
Each VPC cycle may contain one prune bracket. Each prune bracket may contain any number of operational brackets. A skeleton prune bracket structure is as follows:
Key Words | Description |
---|---|
prune_start= | start of prune bracket |
    bracket_start= | start of first operational bracket |
    bracket_end= | end of first operational bracket |
    group_bracket= | start of a group prune bracket |
    bracket_end= | end operational bracket |
    . | |
    . | any number of operational brackets |
    . | |
    bracket_start= | start of last operational bracket |
    bracket_end= | end of last operational bracket |
prune_end= | end of prune bracket |
The operations recognized by the ARMRCALC prune bracket are coded inside of the operational brackets.
The delimiting key words of a regular operational bracket are:
bracket_start= | start of operational bracket |
bracket_end= | end of operational bracket |
A group prune operational bracket is coded as follows:
group_bracket= | start of group prune operational bracket |
bracket_end= | end of operational bracket |
In general each operational bracket has one input sublist and up to three simultaneous output sublists. The delete operation and the sos operation are exceptions to the general rule; the latter have no explicit outputs.
The general flow of the operational bracket is shown on the following diagram:
+-----------------+ one input-sublist --> ^ prune operation ^ ---> up to 3 output-sublists +-----------------+
A sublist represents a set of specific data base records. ARMRCALC stores data base sublists in a bit matrix. The bit matrix columns refer to physical record numbers. The matrix rows represent the various sublists.
The sublist names which you assign are internally associated with distinct matrix rows as shown in the following figure:
Bit Matrix Defines Records Of Given Subsets ------------------------------------------------------- 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - sublist A 0 0 1 1 1 0 0 0 0 0 1 1 1 0 1 0 1 0 0 0 0 0 0 0 1 1 1 1 sublist B 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 0 1 1 0 0 0 0 0 1 sublist C 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0
A bit value of 0 denotes absence while a value of 1 implies inclusion. For example, sublist A consists of physical records 3-5, 11-13, 15, 17, and 25-38.
An input sublist is specified as follows:
either
bracket_start= sublists1 sublist2 ...
or
group_bracket= sublists1 sublist2 ...
or
input= sublists1 sublist2 ...
If sublist(s) are not specified, ARMRCALC uses all data base lines by default.
When the bracket_start=, group_bracket=, or the input= statement contains more than one sublist name, ARMRCALC will form the union of all sublists entered; i.e. the single input sublist to be processed is simply the union of all sublists entered in the input= statement.
Key words for specifying output sublists are as follows:
match= sublist leftover= sublist greater_than= sublist less_than= sublist copy= sublist
The choice of key word(s) depends on the particular prune operation. The various operations are described below.
ARMRCALC will store each output sublist in a unique matrix row. The names you give to the output sublists are kept unique; i.e. ARMRCALC scans the existing matrix rows for a matching name. If one exists we overwrite the existing bit vector. If none match, we append the bit matrix with a brand new row. To conserve processing space you are encouraged to reuse existing list names when convenient, as we did with the list name "keep" in our first example in this document.
To be safe, assume that pruned subsets defined in any earlier cycle are no longer defined in the new cycle! Nevertheless, when you associate a pruned subset to a given name, ARMRCALC will remember the line numbers which made up the original subset at the point of its definition. A line set thus defined remains the same until you reuse the subset name for a new subset!
Under certain conditions and with some careful thinking on your part, you can refer to a subset which was defined in a previous cycle.
ARCALC remembers subsets by their absolute record numbers. Clearly, if you invoked a physical delete operation with ARMRCALC's delete= you must assume that all previously defined line sets are now garbage!
You may have modified one or more field values in the calc brackets such that a previous prune operation is no longer valid! For example, assume subset x represents all lines whose field y contains A, B, or C. If a calc bracket stores a D in field y for subset x, subset x will no longer represent what you pruned for originally!
Nevertheless, once you feel comfortable with what goes on behind the scene, you should not hesitate to take advantage of the fact that original line sets remain defined unless you have performed physical deletions.
Several operations are supported. These can be categorized into six distinct classes as follows:
The general bracket structure of a single field compare operation is as follows:
bracket_start= sublist(s) field= data-base-field-name value= or range= or scan= or mask= explicit ranges or values match= sublist leftover= sublist bracket_end=
You may specify the input sublists with an input= statement.
The field compare operations scan each record of the input sublist. This may be the union of several lists if more than one list was entered on the input= statement or on bracket_start=.
Every record of the input sublist will be scanned. The values of the data base field specified in field= will be compared with all values or ranges specified by value= or range= or scan= or mask=.
The input sublist will be split into two mutually exclusive sublists based on the following:
Records for which at least one match occurred are moved to the
output list named in the match= statement.
Records which had no match at all are moved to the sublist named in the leftover= statement. NoteEither match= or leftover= may be omitted if one or the other corresponding output subset is of no interest. |
Key words for the compare operations currently supported by ARMRCALC are as follows:
v1 v2 v3 .... are any number of strings. These can be textual or numeric.
Use the special string () when you want to look for a blank entry in a tabular field. Use back-slash "/" to look for a blank in an E-type field.
rl1 rh1 rl2 rh2 . . . are any number of low-high range pairs. These may be textual or numeric.
A record will end up in the output list named by match= if the specified data base field contains a value which falls within any of the ranges: rl1-rh1, rl2-rh2 .. etc.
s1 s2 s3 . . . are any number of substrings. The scan= operation is valid for tabular and E-Type fields only.
The scan operation works like a locate function of a standard text editors; i.e. if s1, or s2, or s3, etc. appears anywhere within the specified data field, ARMRCALC treats that record as a matching record. In other words, scan= specifies a sliding search for a match!
m1 m2 m3 . . . are any number of substrings. The mask= operation is valid for tabular and EBCDIC fields only.
The mask search is equivalent to the value= operation, except that we recognize any number of embedded wild-card characters. To code a wild-card character use the question mark symbol "?".
For example,
mask= A??B
defines A??B as a search token to be treated as follows. When we compare the field's value we consider it to be a match when column 1 is "A" and column 4 is a "B". We don't care about columns 2 and 3.
This function is similar to the value= function; however, the current function may be used with tabular fields only.
One argument is expected, the name of the table values file. The entries stored in the defined field are compared with the entries of the specified table; e.g. for
field= WRT value_table= WRT.TABLE
the values entered in the field WRT will be compared with the entries of WRT TABLE.
The general bracket structure of the field pair compare operation is as follows:
bracket_start= input= sublist(s) compare= field1 field2 match= sublist greater_than= sublist less_than= sublist bracket_end=
The input sublists may be specified on the bracket_start= statement. The input= must be omitted in this case!
The general rules with regard to input sublist(s) and output sublists which we have stated earlier apply here as well; e.g. you may omit all but the output sublist(s) of interest.
The current function is valid only if field1 and field2 are of the same data type and if the field width are equal!
All field types are acceptable. The basic routine which does the comparison performs a logical compare. This works fine for textual as well as for numeric data; however, it will not work as you might expect when dealing with a mixture of negative and positive numbers. You will experience the same phenomenon as you find on ARMR reports of negative numbers; i.e. negative numbers are logically larger than positive numbers! Nevertheless, the comparison of two negative numbers yields the correct results.
The field compare operation compares the contents of field1 with the contents of field2 for all members of the input set.
Records for which field1=field2 are returned in the subset named by the match= statement.
Records for which field1>field2 are returned in the subset named by the greater_than= statement.
Records for which field1 The bracket structure of the copy operation is as follows:
The bracket containing copy= is never the first bracket in the prune
bracket; i.e. before you can make a copy you must first identify
the record subset to be copied.
ARMRCALC physically appends the memory based data base with copies of
the specified subset. The internal bit-matrix of subsets is updated
in a corresponding manner.
For example, assume that we make a copy of sublist A; see bit matrix
shown earlier above. The earlier bit matrix shows us that sublist A
is made up of 12 records. A copy of sublist A will therefore extend
our data base by 12 records. The updated bit matrix with the copied
set included will look as follows:
If your requirements dictate it, you may reference the copied
set (sublist D) in subsequent bracket operations. More
importantly, you will enter the copied sublist into a calc
operation. The latter will modify one or more data fields. If
you do not do the latter, ARMRCALC's canonization will simply
remove the copied records provided you dod not specify NOCAN
when you called the module.
The bracket structure of the delete operation is as follows:
The bracket containing delete= is always the last of two or more
brackets in the prune bracket; i.e. before you can delete records
you must first identify the record subset to be deleted.
The prune bracket which contains the delete= operation must also end
the current VPC cycle; i.e. we expect that you follow the prune_end=
with end=!
If required, you may code any number of additional VIEW-PRUNE-CALC
cycles following the cycle in which a subset of record was deleted.
ARMRCALC will delete the specified subset physically. Once this has
been done, all earlier subset definitions will vanish. ARMRCALC will
clean the data base after the deletion took place. Of course, it
may also happen that the deletion has removed all records from the
data base. In the latter case, ARMRCALC will erase the data base
from the your disk! When this happens ARMRCALC prints the following
message:
Erasing the data base is not considered to be an error. The
above message is strictly for the user's information!
Whenever a data base vanishes we skip all additional VPC
cycles.
The bracket structure of the sos operation is as follows:
The SOS operation is provided for the sake of securing data
integrity. Whenever you assume that the data has a specific state,
it is a good idea to verify your assumptions. If your assumptions
are incorrect, abort the run. Don't produce unpredictable results!
ARMRCALC will return with code 8 if the input subset(s) to the sos=
bracket is not empty! Before leaving, ARMRCALC displays the textual
message which you have coded to the right of the sos= statement.
A sample of sos usage is as follows:
The group prune operation provides 'VERTICAL' data selection. In
other words, the user selects record groups based on group
properties. This means that if one or more records from a group of
records matches, then all records in the group are selected.
ARMRCALC uses the current view fields, those specified in header= and
columns= statements, as the grouping fields. The user may identify
any field as the pruning field. Any of the single field compare
operations described in (1) above may be applied to the pruning
field. A binary prune is applied to the matching and non-matching
group records in the usual fashion.
Let's use the following example to illustrate the notion of group
pruning:
Suppose we have a data base of telephone features. The three
fields, AREA, PREFIX, and PHONE define a phone number. The field
BOSOC is a code for a telephone line feature. There is one record
in the data base for each telephone feature.
The following ARMRCALC coding would select all records found in
groups 2 and 3:
bracket_start= sublist(s)
copy= sublist
bracket_end=
Bit Matrix After Sublist A Was Copied
-------------------------------------------
2 2 2 3 3 3 3 3 3 3 3 3 3 4
1 2 3 4 5 7 8 9 0 1 2 3 4 5 6 7 8 9 0
- - - - - - - - - - - - - - - - - - -
sublist A 0 0 1 1 1 .. 1 1 0 0 0 0 0 0 0 0 0 0 0 0
sublist B 1 0 0 0 1 .. 0 1 0 0 0 0 0 0 0 0 0 0 0 0
sublist C 1 1 0 1 0 .. 0 0 0 0 0 0 0 0 0 0 0 0 0 0
sublist D 0 0 0 0 0 . . 0 0 1 1 1 1 1 1 1 1 1 1 1 1 copy of A
^---------------------^
12 new records
Note
4) Delete Operation
bracket_start= sublist(s)
delete=
bracket_end=
** DELETE= REMOVES ALL LINES **
** DATA BASE WILL BE ERASED **
Note
5) The SOS Operation
bracket_start= sublist(s)
sos= a one line message
bracket_end=
prune_start=
bracket_start=
field= thru
value= 0
match= datesos
bracket_end=
bracket_start=
input= datesos
sos= EMPTY THRU DATE ON ONE OR MORE RECORDS
bracket_end=
.
.
.
prune_end=
(6) Group Prune Operation
Grouping fields Other fields
------------------- --------------
AREA, PREFIX, PHONE BOSOC, -, -, -
206 865 8651002 CCG + record set of
206 865 8651002 PXI + group 1
206 865 8651002 PX2SO +
206 865 8651002 VMCOS +
206 865 8651003 CCG + record set of
206 865 8651003 CPG + group 2
206 865 8651003 LITE +
206 865 8651003 NDB +
206 865 8651003 PXI +
206 865 8651003 PX2SO +
206 865 8651003 VMCOS +
206 865 8651004 CCG + record set of
206 865 8651004 CPG + group 3
206 865 8651004 LITE +
206 865 8651004 NDB +
206 865 8651004 PXI +
206 865 8651004 PX2SO +
206 865 8651004 VMCOS +
columns= AREA PREFIX PHONE
prune_start=
group_bracket=
field= BOSOC
value= LITE
match= keep
bracket_end=
prune_end=