Subject: ARMRCALC
Call: armrcalc -extract -nocan -virtual -prunechk fn++ calcspec
Armrcalc is an advanced ARMR data manipulation module. It is intended to be used by seasoned ARMR applications developers. Armrcalc reduces the need for custom programming. Its uses include mathematical calculations, text manipulation, data conversion, and data queries.
A Comparative Armrcalc Example |
Armrcalc's Programming Language |
fn++ | the file name of the input data base to be processed. On VM/CMS systems, a file type of BASE is assumed. For PC and UNIX systems a file extension of .bas is assumed. Armrcalc can be applied either to a single base or to a segmented data base. For segmented data bases, append the file name with plus signs, '+', as required to denote segment numbers. |
calcspec | is the file name of the calc program to be applied to fn+ base. Both fixed and variable record length file formats are acceptable. The maximum line width must not exceed 255 bytes. |
-extract | is an optional argument. Use EXTRACT when you want to extract a summary file a la ARSEGPRUN. |
-nocan | is an optional argument. When NOCAN is specified,
Armrcalc will not canonize the output; i.e.
redundancies created due to some calc operations will
not be eliminated.
Note: NOCAN can not be used in conjunction with EXTRACT. NOCAN is valid only in the default case. |
-virtual | is an optional argument. Use VIRTUAL when you want to
create virtual prune files for use in reporting.
Note: VIRTUAL may be used for pruning only. Calc operations are not valid when it is in effect. The VIRTUAL option may not be used in conjunction with EXTRACT. |
-prunechk | also used to create virtual prune files. Exits with a non-zero return code when pruning results in an empty data set. |
Apply MYTEST CALC to TEST1 BASE through TEST9 BASE.
armrcalc test+ mytest.calc
When you run Armrcalc in the default mode, the module writes the updated input segment(s) back to the current work disk. On the other hand, when the -extract option is in effect, the input segment(s) are not written back to disk. Instead we write out the specified extract base. Likewise, when the -virtual option is in effect, virtual prune files are written rather than the input segment(s).
If you are unfamiliar with the Armrcalc language , you should read the document section that describes it first! This section is intended to provide a quick reference to the initiated reader.
The following is a list of all of the key words recognized by Armrcalc. The key words are arranged in VIEW-PRUNE-CALC sequence.
Pre-VIEW | Operands | Remarks |
---|---|---|
target_base= | data base name | valid under EXTRACT only! |
target_fields= | extract field names | valid under EXTRACT only! |
  | ||
VIEW-Component | Operands | Remarks |
header= | header fields | |
columns= | columnar fields | |
global= | ||
  | ||
PRUNE-Component | Operands | Remarks |
prune_start= | ||
  | ||
bracket_start= | input subset(s) | |
group_bracket= | input subset(s) | |
  | ||
input= | input subset(s) | optional method for specifying input subset(s) |
  | ||
field= | one field | |
compare= | two fields | |
  | ||
value= | compare values | |
range= | compare ranges | |
scan= | scan values | |
mask= | mask values | |
value_table= | table name | |
  | ||
match= | output subset | |
leftover= | output subset | |
greater_than= | output subset | |
less_than= | output subset | |
  | ||
copy= | output subset | valid for bracket_start= only |
delete= | valid for bracket_start= only | |
sos= | diagnostic message | valid for bracket_start= only |
  | ||
virtual= | input subset(s) | valid under VIRTUAL only! |
note= | user's note | valid under VIRTUAL only! |
  | ||
bracket_end= | ||
  | ||
prune_end= | ||
  | ||
CALC-Component | Operands | Remarks |
calc_start= | input subset(s) | |
calc_end= | ||
  | ||
END-Component | Operands | Remarks |
output= | input subset(s) | valid under EXTRACT only! |
end= |
The following lists all of the functions supported by Armrcalc. See individual documentation of more details.
Calc Function | Description |
---|---|
x=previous(y) | set x to previous line's y |
x=prev(y) | set x to previous line's y (abbreviated form) |
x=next(y) | set x to next line's y |
x=line_sum(y) | set x to sum of y over columnar clones |
x=sqrt(y) | set x to square root of y |
x=int(y) | set x to truncated y |
x=min(y,z) | set x to smaller of y or z |
x=max(y,z) | set x to larger of y or z |
x=today(0) | set x to YMD of today's date |
x=getasd(y) | set x to absolute serial of YMD y |
x=getymd(y) | set x to YMD of serial y |
x=testdate(y) | returns 0 if YMD y is a valid date, or 1 for an invalid date value. |
arcgen(enditem) | generate arcs for distribution calculation |
split(Q,f1p,f1w,O1,f2p,f2w,O2...) | single t-type input into one or more output sub-strings |
mend(I1,f1p,f1w,I2,f2p,f2w, ... ,O) | combine one or more source field values into a single t-type output field. |
concat(I1,I2,...,O) | Concatenates any number of input fields into a single T_Type output field, without intervening blanks. |
clr_bits(bits) | set zeroes in all bits of input bit-string |
set_bits(index,bits) | set bits(index) to 1 |
line_or (bits) | form union of bits over columnar clones |
line_and(bits) | form intersection of bits over columnar clones |