Subject: ARMRCALC02
ARMRCALC's Programming Language
First take a macro view of a calc program. Please read the document showing a "Comparative Example" (ARMRCAL02) . The following text will refer to this example.
A typical calc program defines any number of processing cycles. Each processing cycle may contain up to three distinct operations. These are as follows:
VIEW | define a book view to be used in the calc operation |
PRUNE | define any number of data base subsets |
CALC | apply any number of calculations to specified data subsets |
The end of a VPC cycle is recognized by the key word "end=".
Each cycle starts with a clean slate. Views defined in cycle n are not recognized in cycle n+1.
For each cycle the VIEW-PRUNE-CALC sequence (VPC-cycle for short) must be maintained. Nevertheless, a cycle need not contain all three operations. To be exact, the following five VPC combinations are valid:
Our earlier example contains two cycles, a PRUNE cycle followed by a VIEW-PRUNE-CALC cycle. The first cycle (PRUNE only) defines and deletes the record subset with LINE=19.
The second cycle defines and copies the record subset with ITEM="SIIA" and LINE=20. The copied subset is named "action". The calc in the second cycle is applied to the "action" subset.
The second cycle also has a VIEW step (columns= line). The view is not crucial here! We use it only to streamline the internal processing. Had we omitted the view, ARMRCALC would have applied the specified calc program to every record of the "action" subset. On the other hand, the view (columns= line) causes a single application of the specified calc procedure. Think of the equivalent Noodle screen when setting up a view. Our example's view would display a single line on an Noodle screen.
Before we describe the three cycle operations in detail we define the basic rules of the language syntax.
ARMRCALC treats certain symbols special; a list if these is as follows:
  | |
; | a semicolon in column 1 denotes a comment line. |
  | |
() | left-right parenthesis pairs denote nulls applicable to tabular fields. |
  | |
\ | a backwards slash denotes embedded blanks in a text string. |
  | |
? | question marks are used as wild card characters when used in the argument of a mask= operation. |
  | |
Key words | Key words are the basic ingredients of the language. Only one key word per line is recognized. The key word can start in any column. All key words have a terminal equal sign ("="). There must be at least one blank to the right of the terminal equal sign! |
  | |
Case sensitivity | ARMRCALC's translator accepts both lower and upper
case spellings of key words, field names, and calc
function names. Internally all input will be
converted to lower case. In addition, ARMRCALC
translates the data base field names to lower case
as well.
Compare values are not translated; i.e. compare values ARE case sensitive! |
  | |
Blank lines | Lines which are totally blank are ignored by ARMRCALC. |
Given the basic rules described above, we shall look at VIEW PRUNE and CALC in detail. But before we do this let's get three special statements which are valid under EXTRACT only out of the way.
If you are running under the EXTRACT option, two statements are required at the very beginning of the calc program. These are not part of the VPC cycle. The special statements are as follows:
target_base= FN
This statement defines the file name of the output base to be extracted by the calc. The file type is always assumed to be "BASE".
target_fields= f1 f2 f3 ....
These statements define the output fields. You may use several target_fields= if required. The field names given here must be in the input base's directory file. You may append plus (+) symbols to denote summaries.
Under the EXTRACT option ARMRCALC does not write out the input base but writes the extract base instead. When extracting we write out a single output base even if the input base consists of a series of segments.
The final EXTRACT statement is as follows:
output= list1, list2, ...
The output= must appear immediately ahead of the final end= statement. list1, list2, ... are the pruned subsets to be extracted. If no list was specified we extract the entire file; this corresponds to a horizontal seg-prune.