Aggregate - Create and Store a Data Aggregate
Aggregate < storagept value1 value2... > Error erropt | |
Aggregate < #tablename# > Error erropt |
storagept | The point used to store the aggregate. This point is not part of the aggregate and may not be extracted by the AggVal module (i.e. repeat/duplicate the point to be able to reference it.) | |
valuen | A value point. This may be any type of V4 point. If the point is an intersection then it is evaluated (use the quote '@' to insert an intersection into an aggregate). If 'dim*' is specified then the current value of the dimension is used. | |
ERROR | If given, then the following keyword specifies the error handling option. | |
erroropt | How errors are to be handled, one of: Warn (default) to output warning message, Ignore (to silently ignore all errors), Abort to abort V4 on an error. | |
Out | If given then the following id specifies the area to written into. | |
id | The id of the area (see the Id tag of the V4 module or the Id option of the Area command. |
The Aggregate command is used to combine multiple V4 points into a single aggregate entity and store that entity in an area designated for Aggregates or in an area with bindings. An aggregate is similar to a traditional database record in that multiple fields (or points) are stored (referenced) by a single key (point). The AggVal module is used to extract individual points from an aggregate created by any of the aggregate commands.
The FAggregate (Fixed-length-Aggregate) command is identical to Aggregate except it may only be used when each aggregate results in the same structure. This is usually the case except when alpha points are included in the aggregate. Unless each of the alpha points is the same length, aggregates containing strings cannot be used with the FAggregate command (the Column parameters FixedLength and FWidth may be used to ensure fixed length alpha fields.) The benefit of the FAggregate command over Aggregate is that the internal structure of the aggregate is stored once, not with each individual aggregate. This, obviously, can result in a tremendous performance boost - both in disk space used and access times.
The BFAggregate (Blocked-Fixed-length-Aggregate) is one step beyond the FAggregate in that not only are all the aggregates fixed length, but it is assumed that the aggregates are loaded in ascending key order. With this assumption, V4 is able to block or group-together many aggregates into a single keyed record. Again there is a tremendous performance boost by doing this. Note that the AggRef point type can be used with the BFAggregate command to ensure that points are generated in ascending order.
Aggregates are integrated with V4 Tables. The contents of a Table can be easily included within an aggregate by specifying the table name enclosed in cross hatches ('#'). All columns of the table will be included in the aggregate except those marked with the Ignore option. See the Table command for more information and an example.
In most cases the values in a given aggegate position are all of the same dimension. It is possible, with Tables, to have more than one dimension in a single position. When this is done, the AggVal module must specify all possible dimensions. Again, see the Table command for more details.
There are certain classes of data that are continuously being created. Sales data is a good example- each day new sales data is created but sales from prior days never changes. In many database systems, this type of data has to be consider one set or the user of the data has to take special care to scan multiple datasets.
With the V4 AggRef point, system designers can load historical information once into one area and then keep a much smaller, current area up to date with recent information. When these areas are concurrently open in V4, the runtime system will automatically see all of the points in all of the areas.
For instance consider two areas- SalesHis, which is updated once a quarter with all wanted sales history and another area, SalesCur, which is updated daily with current sales history. Both areas use the following dimension as the storage point for the aggregates-
Dimension SlsHis AggRef |
Then with the following example-
Area Read SlsHis Aggregate Area Read SlsCur Aggregate Tally(SlsHis.. whatever... ) |
The reference to SlsHis.. would include all points in SlsHis and SlsCur.
Aggregate < Cus* 'Cus123' 'The Smith Company' State:PA Money:123.33 > |
In this example, four points are stored in a aggregate record referenced by the point 'Cus*'.
Area - Open/Create a V4 Area
Area access area option(s) | |
Area Close area | |
Area Rename area newarea options(s) | |
Area Rebuild area newarea options(s) | |
Area Index area options(s) | |
Area Reset extdict options(s) | |
Area isct |
access | How the area is to be accessed, see below for list of valid values. | |
area | The file to be accessed. If the area is not enclosed in quotes it is assumed to be area.v4a. | |
option | One or more additional attributes/options, see below for a list | |
newarea | A new file to be created from the existing (Rename/Rebuild only). | |
extdict | The path name of an external dictionary file to be reset. | |
isct | The intersection isct is evaluated and the resulting string is parsed as the arguments to the command. If the result is Logical:False or the empty string then no action is taken. |
The Area command creates or accesses an existing V4 area. The access keyword determines the type of access. One of the following is permitted.
Close | Close the area. This should be done just before exiting from V4. | ||
Create | Create a new area. See the option list below. | ||
CreateIf | Create a new area only if it does not already exist. If it exists then open for Update access. | ||
Index | Create a new index for the area. This is for use after creating an area with the FastAdd option. | ||
ORead | Same as the Read option but no error is generated if the area does not exist (OptionalRead). | ||
Read | Open an existing area for read-only access. | ||
Rebuild | Rebuild an area. This copies the area into a new area. | ||
Rename | Rename the area. | ||
Reset | Resets an external dictionary file. The file is first backed up with the extension '.old'. Then a new version is created containing only dimension information. All other dictionary entries are removed. | ||
Update | Open an existing area for read and write access. |
The file specification (area) may be a keyword or a quoted string. If it is a keyword then it is assumed to be a file with extension '.v4a' in the current directory. A file enclosed in quotes may be any valid file path specification as allowed by the host operating system. Note that logicals are permitted and are supported on all operating systems. The following table lists other Area options.
Aggregate | Open the area for aggregates only. This area will be the destination for all aggregate records created with the Aggregate command. | ||
BucketSize | bytes | Create a new area with a bucket size of bytes. Normally, the default bucket size if sufficient. | |
Dictionary | The area to be accessed or created is a V4 dictionary. | ||
FastAdd | Used with the Aggregate on a new area. This tells V4 to write aggregates to the data portion of the area and not to update the index. When creating large aggregates, this is much faster. Note that an 'Area Index' command must be given to create an index structure for the area. | ||
Hierarchy | num | Specifies the hierarchy number for the area. All concurrently opened V4 areas must have a different hierarchy number. The permitted range is from 1 to 8. The default is 5. | |
Id | name | Associates the unique name with this area. This name may be later referenced via the Out argument in the AggPut module and the 'Out' options in the Agg and Bind commands. | |
Locks | This option only applies to external dictionary files opened for update access. If specified then multiple processes can access and update the external dictionary file simultaneously. | ||
NewMacro | name | The name of a macro to be invoked if this is a new area. This macro may be used to initialize the area. | |
OnError | IGNORE | If any errors occurs, output a warning but continue without generating an error. | |
OnError | file | Execute an Include on the V4 file if any errors occur as a result of executing this command. | |
OnError | FAIL | Exit V4 immediately if any errors occur within the command. | |
Retry | number | Specifies the number of times to retry on an 'Area Open' or 'Area Rename'. This option is to be used when the target file may be busy (open). If the initial rename fails, V4 will sleep for one second and retry. This will repeat until the command is successful or the retry limit is exhausted. The default value for this is 3. | |
Scan | Optimize the access to the area for sequential scanning of the entire area. |
Multiple areas can be concurrently accessed within a V4 process. No two areas may have the same Hierarchy number however. This number is used to indicate the parent-child relationships among concurrent areas. Areas with higher numbers are parents to those with lower numbers. This ordering is critical for the synchronization of area dictionaries. All Dictionary dimension entries within an area are stored as numeric values. As an area is being created, source words are converted to numeric values by searching the current area dictionaries. The ordering is from highest hierarchy number to lowest.
Dictionary synchronization problems can occur in V4 applications containing multiple areas, especially with multiple aggregate areas. Once an area is created in the context of a parent area, its dictionary entries are set. If the parent is recreated at a later time, its dictionary entries may change which could invalidate the entries in the child area. There are two ways to circumvent this problem. The first is to rebuild all V4 areas. This method is reliable but can be very costly from a systems resource standpoint.
The other solution is with V4 dictionary areas. A dictionary area is a standalone area containing just dictionary entries. Once a dictionary entry is created, all subsequent area builds should reference this area. Common entries remain constant and thus child areas and aggregates do not have to be reconstructed each time a parent area is rebuilt.
The OnError option is used to force V4 to evaluate commands within another file if errors occur while attempting to load the specified area(s). Typically, the loading of areas is used to initialize the V4 runtime environment so that if errors occur there is no environment and hence any type of error recovery is difficult. The OnError include file can be then read in to initialize a new (safe) environment and presumably return a reasonable error condition.
The Area command with no arguments is permitted. No action is taken.
Area Create DataArea data Aggregate FastAdd ... Area Close Area Index data |
This example creates a new area 'data.v4a' as an aggregate. The FastAdd option prevents the creation of an index. After all records have been added, the area is closed and the index created.
BFAggregate - Create and Store a Blocked Fixed Data Aggregate
BFAggregate < storagept value1 value2... > | |
BFAggregate < #tablename# > |
storagept | The point used to store the aggregate. This point is not part of the aggregate and may not be extracted by the AggVal module (i.e. repeat/duplicate the point to be able to reference it.) | |
valuen | A value point. This may be any type of V4 point. If the point is an intersection then it is evaluated (use the quote '@' to insert an intersection into an aggregate). If 'dim*' is specified then the current value of the dimension is used. |
See the Aggregate command for a discussion of this and other aggregate-related commands.
Bind - Bind Intersection to a Value
Bind (factor) isct = value | |
Bind (factor) isct <- value | |
EBind arguments identical to those of Bind |
factor | An optional factor for the weighting factor used to prioritize bindings. | |
isct | The intersection to be bound. | |
= | An optional equal-sign may be used as a delimiter between the intersection and value. | |
<- | This optional token, when used, disables the 'Replacing existing binding...' warning. | |
value | The value point to be associated with the intersection. |
The Bind family of commands binds an intersection to a value. The Bind command takes the value point, as is, and binds it to isct. EBind differs in that if value is itself an intersection, EBind will first evaluate it and bind the evaluated result to isct. (The Bind command is equivalent to the BindQQ primitive, the EBind command is equivalent to the BindQE primitive.)
A weighting factor may be specified as part of the bind command. If given it must be enclosed in parentheses. The factor may be prefaced with a + or - indicating a plus or minus off the calculated weight to be assigned. Or the factor may be a plain number indicating the specific weighting factor.
Be sure to see the section on BindEval for a discussion on when a bind may not be a bind.
Bind [MgrName Cus..] [Name [Manager Cus.SlsRep] ] EBind [MgrName Cus*] [Name [Manager Cus.SlsRep] ] |
The first example binds an intersection to an intersection. The effect is that the MgrName of any customer is found by evaluating the name of the manager of the salesrep for that customer. The second binding is for a particular customer (the one in the context). The EBind is going to evaluate the 'name of the manager of the salesrep for the customer' and bind the result to [MgrName customer].
CAggregate - Create and Store a Data Aggregate
CAggregate valpt |
valpt | The value point to be stored in the currently write-able aggregate area. Any point type may be written. Only one point from a given dimension may be written to a particular area. |
The CAggregate command is used to create a 'constant' value for all aggregates in an area. A typical example would be a sales history aggregate where each record in an are was from a given month. Rather than duplicate the month value for every record in the aggregate, one CAggregate command could be given. CAggregate values are retrieved with the AggVal primitive by specifying the aggregate key and dimension, but no index.
CAgg UMonth:0302 |
Clipboard - Copy File to Client Clipboard
Clipboard file |
file | The file to be copied to the clipboard. |
This command simply copies the specified file to the clipboard associated with the currently running V4 process. The command has no effect on systems that do not support a clipboard.
Clipboard 'result.tmp' |
Column - Define a Table Column
Column name dimension options | |
Column name dimension options , name dimension options , ... |
name | The column name. This becomes a psuedo context value within the macro handling the row. | |
dimension | The dimension associated with the column. If the dimension is specified as an asterisk (*) then the dimension name is assumed to be identical to the column name. | |
options | Any of the options described below |
A Column command is used to define each column in a table.
Acceptor | isct | If defined, then insert the text value of the column into the context on Dim:Alpha and then evaluate isct. The resulting value is taken as the column point value. | |
After | str | Only take the portion of the column that appears after str. If str does not appear in the column then the entire column is used as-is. | |
AggKey | Removes the column from the #table# list within the Loop command but include the column within the aggregate. | ||
BaseYear | year | Assume that year is the base year for this date field. | |
Before | str | Only take the portion of the column that appears before str. If str does not appear in the column then the entire coumn is used as-is. | |
Decimals | num | The number in this column has num implied decimal places. | |
Default | value | A default value to be used if the column entry is blank for a given row. | |
Description | text | An optional description of the column. This attribute is referenced with the #x# parameter in a Loop. | |
Dim | dim | An alternate dimension for the column. If the column value cannot be parsed as a point on the primary dimension, then this dimension is attempted. | |
End | index | The ending character index for the column. | |
Error | value | A value to be used if the column entry for a row cannot be properly parsed for the given dimension. If not specified and the column value cannot be parsed then a V4 error is generated and the entire row is skipped. | |
Expression | value | A V4 point to be used as the value of this column. See discussion below for more information. | |
FixedLength | num | The resulting column value is to be truncated/padded to num characters. This option is used to convert a variable length column to a fixed length. | |
Format | type | The format of the column value. The allowed types are described in the section below. | |
FWidth | length | A combination of the Width and FixedLength options. | |
Ignore | Ignore the contents of this column. The dimension should be Alpha for columns of this type. Ignored columns are not included in any #tablename# macro expansions. | ||
Lowercase | Convert the column to all lowercase. | ||
Mask | pattern | Defines an inclusion pattern mask for this column. The pattern may be a list of numbers from 1 through 32. See discussion below. | |
Missing | point | Defines a point value to be used if the aggregate value is missing. See also the AggVal module and Loop command. | |
NPTable | This column defines the macro to be invoked to process the row. No prefix (NP) is assumed in the macro name. | ||
Offset | num | Add the offset num to the value of the column. | |
Point | point | Use point as the value for this column and not a value taken from the table source data. It is recommended that the point be specified as a string. This option can be used to add context points and/or evaluated expressions to a table. The column name and/or evaluated point is included in all #tablename# expansions. | |
Prefix | str | Insert str as a prefix to the value found in the column. For example if the column references a two digit year and all years are the twentieth century then use 'Prefix 19'. The prefix for telephone points has a slightly different use. If a telephone number does not contain an areacode and a Prefix is specified then the prefix is used as the areacode. | |
Quoted | Normally, if a TAB or CSV delmited column begins with a double-qoute, then the leading quote is removed, two double-quotes are treated as single quote and the trailing double-quote is removed. If this option is given and the column entry begins with a quote then the leading and trailing quotes are left intact as well as any embedded quotes. | ||
Scale | num | Scale (multiply) the value of the column by num. | |
Skip | col | Skip this column an col-1 columns to the right of this column. | |
Start | index | The starting character index for the column. If End or Width is given with no Start then the character after the last column is defaulted. If not width or end is specified then the width/end is determined by taking the starting position of the next column and subtracting one. | |
Substitution | new=old,... | The option permits one to specify multiple value substitutions on a column. The old value is substituted with the new value. | |
Suffix | str | Append the str to the end of colum value. | |
Table | This column is used to determine the real table to parse the row. The value of the column is appended to the name of this column to form a new table name. This table is then used to parse the row. | ||
Trim | Trim leading and trailing white space from the field. | ||
UOM | id | Assume that this unit-of-measure field has a UOMId of id. | |
Uppercase | Convert the column to all uppercase. | ||
Width | length | The total length, in characters, of the column |
Both the Point and Expression options define a value for the column. The column value is NOT to be taken from any input source file (via Include). A column with the Point option is assumed to be included in any aggregates created as part of the table processing. A column with the Expression option is not included in aggregate output. For this reason, columns with the Point option are included in #tablename# expansion within one of the Aggregate commands.
It is possible to partition columns in a single table into multiple sub-groups. This may be usefull for moving information from one table into several different aggregates and/or perform different processing on different groups of columns. Each column may be tagged with a mask consisting of integers from 1 to 32. A column with no mask is assumed to have all 32 entries tagged. The column groups may be referenced with the #tablename# construct. For example #dataTable:3# would reference all of the columns in dataTable tagged with Mask:3.
Example 17 - Output of Single Table to Two Aggregates
|
ddmmmyy | The date is to be given in day-month-year format where the month is a three letter code (e.g. 20-May-98) | ||
ddmmyy | The date is to be given in day-month-year format. | ||
Default | Use the default formatting for the dimension. | ||
Hex4 | Each byte of a binary value is given as two hexadecimal digits. | ||
Hexadecimal | The numeric column is in hexadecimal notation. | ||
Internal | The value is to be given in internal V3/V4 format. See detail on specific dimension types for more detail (e.g. UDate or DateTime). | ||
mmddyy | The date is to be given in month-day-year format. | ||
MMM | The month is to be given in year-month or month-year where the month is an alpha month abbreviation (e.g. 'Jan'). | ||
mmyy | The month is to be given in month-year numeric format (2 or 4 digit years allowed). | ||
Money | The numeric column contains money- strip off leading dollar signs, embedded commas, etc. | ||
yymm | The month is to be in year-month format (2 or 4 digit years allowed). | ||
yymmdd | The date is in year-month-day format. |
Table Fixed Column A Int Width 5 Column B UDate Format MMDDYY Width 6 Column C Alpha Start 30 Width 20 Column D UDate Point UDate:{now} Desc "Date data created" EndTable Table Variable Column Cus *, InvDate UDate, Type *, EndTable |
Context - Update or Examine the Context
Context Add point | |
C point | |
Context ADV dim value | |
Context Examine | |
C | |
Context Push frame | |
Context Pop frame | |
Context PopAny frame, frame, ... |
point | Any V4 point to be added to the context. | |
dim | Any defined dimension. | |
value | Any valid value for points on dim. | |
frame | The name or numeric id of a context frame. |
The Context command is used to manipulate the current context-
Add | point | To add point to the current context overwriting any other point with the same dimension. | |
ADV | dim value | Similar to the Add option in that a point is added to the context. The point is determined by the dim dimension and value point on that dimension. The value always continues to the end of the line. This option is primarily used by WWW servers that are not sure of the exact format of a V4 point value. This option will automatically enclose string values in quotes and list values in parentheses. If no value is specified then 'none' will be inserted for time and numeric points, an empty string will be inserted for alpha points. See examples below. Also see the JSON attribute within the Dimension declaration. | |
Examine | To output the current context. This command with no arguments also outputs the current context. | ||
Pop | frame | To pop frames until frame is popped off the context stack. An error is generated if the frame cannot be located. | |
PopAny | frame,frame | Attempts to pop any of the named frames from the context stack. No errors are generated if none of the named frames currently exist on the context stack. | |
Push | frame | To push a new frame onto the context with name frame. See the discussion of context frames for more information on this concept. |
Context Add UDate:951231 |
Context Add Cus:{new} | create new cus point and insert into context | |
C cus+ | identical to above example | |
Context ADV Alpha now "is" the time | adds Alpha:"now \"is\" the time" | |
Context ADV List now is the time | adds List:(now is the time) | |
Context ADV Num:123,456.44 | parsed as two numbers because Dim:Num has MULTIPLE attribute | |
Context ADV Money:123,456.44 | parsed as single number (assuming MULTIPLE attribute is not set) |
The first example adds the point corresponding to the date 31-Dec-95 to the current context. The second example creates a new point on the Cus dimension and adds it to the current context. An ambiguous condition arises when a number contains embedded commas. It could either be multiple numbers (normal V4 syntax when Multiple is declared on a dimension or it could be one number with commas being used to delimit groups of a thousand (normal for currency). V4 resolves this by looking at the dimension declaration. If Multiple was given then V4 assumes that commas delimit mulitple numbers. If the Multiple was not given then the commas are removed and a single number is parsed. Leading currency characters are also removed.
The example below shows the output of a Context Examine command. The values in parentheses are for debugging purposes and have no end-user meaning.
Context Examine Dim:Int (4533) (hx=134) = Int:123, (px=1) Dim:Cus (3213) (hx=150) = Cus:43985534, (px=20) Dim:IM (1232) (hx=169) = No point currently defined |
Debug - V4 Debugging Command
Debug option [value] | |
DB (same as Debug Break) | |
D option [value] | |
DC (same as Debug Continue) | |
DS (same as Debug Step) | |
DS num (same as Debug Source num) | |
DSI (same as Debug StepInto) | |
DSN (same as Debug SNC) |
option | One of the debug options below. | |
value | A value or parameter for the debugging option. |
This command is used to set, remove, and manipulate breakpoints. Setting a breakpoint is a two step process. The first step is identifying the source file containing the V4 code to be debugged. This is done with the 'Debug Source' command and makes a particular file active for debugging. The second step is to set breakpoints at one or more lines within the active file. This is achieved with the 'Debug Break' command. The Break option has many sub-options for controlling when a breakpoint is entered and what actions are taken when entered. Multiple sub-options may be entered on a single line. The default options for a breakpoint are 'Evaluations Location' (display evaluations and current location).
Break | line | Set a breakpoint at line of the current source file (see Break Source). | |
Break | This option, with no arguments, lists all active breakpoints. | ||
Break After | num | Only break after reaching this breakpoint num times. | |
Break AutoStep | This is used to define a 'breakpoint' to be invoked with each 'Debug Step' command. It is to be used in conjunction with other options. | ||
Break Context | Output the current context when this breakpoint is reached. | ||
Break Continue | Immediately continue after performing breakpoint actions (i.e. do not wait for user input). | ||
Break Delete | num | Delete the specified breakpoint. | |
Break Do | point | Evaluate the V4 point (intersection/module) when the breakpoint is hit. | |
Break Evaluations | Display the number of V4 evaluations performed. | ||
Break Fail | Only break if the evaluation at the breakpoint location fails. | ||
Break If | point | Evaluate the point and break only if the result is Logical:True. | |
Break Location | Display the current location. | ||
Break Module | intmod | Break whenever the V4 module intmod is entered. | |
Break Once | This is a one-time breakpoint, delete it after executing breakpoint actions. | ||
Break Point | Display the intersection/point at the breakpoint location. | ||
Break Results | Display the results of evaluating the intersection at the breakpoint location. | ||
Break Return | point | Return the evaluation of point instead of the evaluating the intersection at the breakpoint location. | |
Break Silent | Perform a silent breakpoint, do not output anything when breakpoint is reached. | ||
Break Skip | Skip the intersection (do not evaluate) at the location of the breakpoint. This cannot be used with the Fail option. | ||
Break Stack | Show the evaluation stack when the breakpoint is reached. | ||
Break Time | Show the cpu and wall-clock time. | ||
Continue | Continue running from the breakpoint. | ||
SNC | Step to the next point and evaluate it but do not honor any ',failpoint' | ||
Source | List all source files included in the current V4 runtime environment. The starred ('*') file is the active file. | ||
Source | name | Make the file described by name the active source file. | |
Source | num | Make the numth source file the active file. | |
Stack | Immediately display the runtime evaluation stack. | ||
Step | Continue from the breakpoint, evaluate any (nested) intersections on the current line, and then break on the next line. | ||
StepInto | Continue from the breakpoint, step into the the next (nested) evaluation, and then break again. | ||
Stop | Stop the V4 process. This is same as the 'Exit' command. | ||
Time | Immediately output the incremental and cumulative cpu/wall clock times. |
Debug Source file1 | make the source file- file1.v4 the active file | |
Debug Break 234 | set a breakpoint at line 234 in file1.v4 | |
DC | continue evaluating after entering a breakpoint | |
D Break AutoStep Time | Sets an auto-step breakpoint to display run/wall times | |
DC | continues but automatically stops at next statement (due to above auto-step breakpoint) |
Dimension - Declare a new Dimension
Dimension name [,name] type options |
name | The dimension name. More than one name can be given if all dimensions are being created with the same attributes. | |
type | The dimension type. See Dimension Types for a complete discussion of dimension types. | |
type | If the dimension type is specified as 'LOCALLY' then it is assumed that the dimension has already been declared and that this command line is to redefine one or more of its attributes. | |
options | One or more additional attributes/options, see below for a list |
The Dimension command is used to create a new dimension. If the Locally keyword is given in place of a dimension type then the dimension is assumed to exist and attributes for the dimension are temporarily modified. The dimension name and type are mandatory, one or more options, listed below may also be given.
Acceptor | The points on this dimension are to be parsed via a special routine. See 'Acceptors & Displayers' below. | ||
ADPoint | point | Specifies a point to be passed to both the Acceptor and Displayer routines. | |
All | num | Same as the AllValue option. | |
AllValue | num | Specifies the numeric value to use when creating a binding using the dim.. construct. This is specifying what value to use when referencing all values. | |
AsIs | If given then escape sequences for literal values for BigText points are taken as-is, i.e. they are not interpreted. This option is useful when passing JSON values and you want to defer the processing of escape sequences for the JSON parser, not the V4 parser. See below for an example. | ||
Attributes | string | Specifies additional dimension attributes. Currently this is allowed only for BigText points. | |
BaseDate | pnt | Specifies the base date for a UWeek dimension. pnt must be a point on a UDate dimension. | |
Bind | level | Same as the Binding option. | |
BindEval | Bindings on this dimension are handled as an evaluation, see below. | ||
Binding | level | The binding number to use. | |
Calendar | name | The type of calendar for Calendar dimensions. | |
CaseSensitive | Dictionary entries are normally case-insensitive. This option specifies that they are to be case sensitive for the dimension. This option may also be specified with Alpha dimensions - see the Format module for details on its usage with alpha dimensions. | ||
Decimals | num | Defines the number of implied decimals for dimensions of type Fixed. | |
Desc | text | Same as the Description option. | |
Description | text | An optional description of the dimension. The V4 module can be used to retrieve this descriptive text. | |
Displayer | The points on this dimension are to be output via a special routine. See 'Acceptors & Displayers' below. | ||
DisplayerTrace | Whenever the points on this dimension are to be output as a result of a trace or context dump then use a module to format the point. See 'Acceptors & Displayers' below. | ||
DotDotToList | Triggers [UV4:DimToList] processing whenever 'dim..' is encountered for this dimension. | ||
DotIndex | If this attribute is set on a List dimension then expressions of the form list.point are converted to List(list* Nth::point). | ||
DotList | If this attribute is set on a List dimension then expressions of the form dim.value.value... will be converted to a list of the form: [UV4:Eval dim:(value value ...)]. This option can be used to implement any kind of nested access to data (such as XML trees). | ||
Entries | dim | This option is only valid for List dimensions. It is used to associate a dimension with all of the list entries. The primary use is with bitmaps stored in external areas. | |
FileName | Parse points on this Alpha dimension as filenames. | ||
Format | string | A format string to be used on output of points on the dimension. The format of string is that of the C language printf routine. | |
Hexadecimal | All values for points on this dimension are assumed to be input/specified as hexadecimal. This option applies only to Integer dimension types. Output remains decimal unless overriden with the OutFormat option (OutFormat "%x"). | ||
Hierarchy | num | The hierarchy number associated with this dimension. | |
History | This option is only valid for dimensions associated with time. If given then only historical dates (i.e. no future dates) are allowed. This option is also used in disambiguating two-digit years. A two digit year is assumed to be equal to or less than the current year. For instance, if today's date is June 10, 2008 then '20-Mar-11' would be parsed as '20-Mar-1911'. | ||
Intersection | Allows the declared List dimension to contain references to intersections and internal modules. | ||
IsA | dim | Points on this dimension are to take on all of the properties (e.g. Acceptor, Displayer) of dimension dim. | |
JSON | This is used on Alpha and BigText point types to indicate that the contents will be JSON. The Context ADV command will immediately parse the input string. This will allow for extremely long JSON values to be sent to V4 from the web. | ||
Local | Declares this dimension to be local to the current compilation unit. The scope of the compilation unit may be either the current included file or the current point. Local dimensions interpretively declared with the Dimension command are local to the remainder of current include file. Local dimensions declared within the specification of a point (with the ^v"v4command" construct are local only through the end of that point. Multiple local dimensions with the same name may be defined. | ||
MMDDYY | This option is only valid for UDate, Date-Time, and Calendar point types. It assumes numeric dates will be in month-day-year format, NOT year-month-day which is the default. | ||
MMYY | This option is only valid for UMonth point types. It assumes numeric months of the form mmyy or mmyyyy. | ||
Multiple | Allow the specification of multiple points (i.e dim:a,b,c). | ||
NoCreate | Do not permit the automatic creation of points for this dimension. This applies only to dimensions of type Dictionary. | ||
NoDuplicate | The dimension is to be considered a set. This applies only to dimensions of type List. Lists that are sets will not contain duplicate points. V4 will prevent the addition of a point to a list if that point already exists (no error is issued). | ||
None | num | Defines a numeric value to be used when the none value for a numeric dimension is referenced. | |
NoPrefix | logical | Normally a point is prefixed with its dimension name when it is output. Declaring this option inhibits the displaying of the dimension name prefix. | |
Normalize | Specifying this option for Alpha point types forces all points on that dimension to be uppercase. For Int2 points, V4 ensures that the first value is always less than or equal to the second. | ||
Numeric | The points on this dimension are assumed to be numeric. This only applies to dimensions of type Dictionary. With this option, the two points dim:00123 and dim:123 are considered identical. Without it the two points would be considered different. | ||
OutFormat | mask | An output format string. If the format mask begins with a percent symbol ('%') then C-language formatting is performed, otherwise V4 formatting (see Format) is done. | |
Overload | percent | This option applies only to AggRef dimensions and specifies the percentage that the aggregate blocking should be overloading. V4 stores all BFAggreate records in fixed sized blocks of approximately 64K bytes. Each 64K byte buffer is normally compresses before output and usually results in a block 33% to 50% smaller than the original. This means that a BFAggregate block could actually be greater than 64K as long as the compressed size fits into 64K. The Overload percent specifies a percentage to extend this block. | |
Periods | num | Specifies the number of periods per year for a UPeriod dimension. The default is 13. | |
Point | how | Same as the PointCreate option. | |
PointCreate | how | Specifies how points are to be created. The two how parameters are Point meaning that points are to be created with the Point command, and New meaning that points are to be created with dim:{new}. | |
Range | Allow the specification of a range of points (i.e. dim:a..b). | ||
RDB | Same as the RDBNumeric option. | ||
RDBNumeric | Causes the Format module to use a point's internal (numeric) value when formatting for a relational database value (RDB tagged argument). | ||
TimeZone | num | Specifies the timezone (hours ahead or behind Greenwich mean time GMT) for Calendar dimensions. | |
UOMId | num | The units-of-measure on this dimension are associated with UOMId num. | |
Value | type | Enables the parsing of 'dim:[...]' and 'dim:(...)' constructs with the dimension. The allowed values for type are List and Tree. See the discussion below for more detail on this option. | |
XML | Strings that are passed into V4 from the web (via the Context ADV command) are checked for embedded tags. If a tag is detected then the leading '<' symbol is replaced with '<'. This is done to prevent the possibility of cross-site scripting security problems. However, if this option is specified then this check is not performed. Note: This option must be specified on any dimension that will be passing HTML/XML strings from the web. | ||
YMDOrder | ymd | Specifies the ordering of Year, Month, and Day within any of the date point types. The ymd parameter may be any of the six permutations: YMD, YDM, MYD, MDY, DYM, or DMY. The default is by country and is defined in the V4CountryInfo.v4i file. Up to three permuations (separated with commas) may be given. A date will be parsed with the first and if that fails (ex: day not valid) then the date will be re-parsed with the second value, and then the third if necessary. |
The Acceptor and Displayer options are used when the specification and/or display of a dimension point does not directly match how the point is to be represented. For example many systems internally use numeric parameters yet accept and display keywords instead of the internal codes.
Dimensions with these attributes cause V4 to evaluate bindings whenever a point on the dimension is input or output. The format of these bindings is
[UV4:Acceptor Dim:dim [adpoint] Alpha..] = acceptor-rules [UV4:Displayer dim:point [adpoint]] |
where dim is the dimension, adpoint is an optional point given by the ADPoint option. See also the Include? option for the V4 module. This option is useful for displaying the location within an include file of an acceptor error.
The DisplayerTrace option is similar except it applies to formatting of points in debugging traces, error messages and context dumps.
The following example defines the ProgId dimension (for Program-Identifier). The points on the dimension are numeric, yet the user format is yyyyp where yyyy is a year and pp is program name, usually S for spring or F for fall. Additionally CURRENT can be used to default to the current program.
Example 18 - A Dimension Acceptor and Displayer
Bind [UV4:Acceptor Dim:ProgId Alpha..] If(Str(Alpha* UC? Head::"CURRENT") @ProgId:=Str(DTInfo(UDate:{now} UYear?) LE(DTInfo(UDate:{now} Month?) 6 "S" "F")) @If(Str(Alpha* UC? Head::"OTHER") 1 @If(Str(Alpha* UC? Head::"ALL") 2 @DefQ(Int:=Str(Alpha* Length::4) @{(2025 - Int:=Str(Alpha* Length::4)) * 100 + TEQ(NId:=Str(Alpha* Begin::5 End::Int:-1) F 99 S 98 F2 97 S2 96 FC 95 SC 94)} @{(2025 - UYear:=Int:=Str(Alpha* Length::2)) * 100 + TEQ(NId:=Str(Alpha* Begin::3 End::Int:-1) F 99 S 98 F2 97 S2 96 FC 95 SC 94)} ))) ) Bind [UV4:Displayer ProgId..] TEQ(ProgId* 1 "Other" 2 "All" Str(Int:={2025 - ProgId* / 100} TEQ(MthMod(ProgId* 100) 99 F 98 S 97 F2 96 S2 95 FC 94 SC XX))) |
!Begin of an Include file Dim Dim1 Int Local /* Dim1 local through the end of the include file */ [FunctionXXX] Do(^v"Dim Dim2 Alpha Local" /* Dim2 local throughout the Do( ... ) point */ . . . . . . ) !Dim1 still defined, Dim2 no longer defined |
This attribute is used to control how the backslash character is interpreted on strings (Alpha and BigText) coming in through the Context ADV command.
Dim d1 BigText | Define a bigtext dimension | |
Dim d2 BigText AsIs | and another with the AsIs attribute | |
Context ADV d1:This has an embedded " quote | Add to context | |
Context ADV d2:As does this " as well | Add to context | |
Eval Echo(d1* " vs " d2*) | Note difference in backslash-- | |
This has an embedded " quote vs As does this \" as well |
The AutoContext attribute can be used to indirectly specify how a point is to be 'valued' during the evaluation of an intersection if that point is not currently defined in the context. For example, if the Customer dimension has been defined as-
Dimension Customer Integer AutoContext NId:NeedCustomer |
and the following binding has been made-
Bind [NeedCustomer Dim:Customer Order..] [BilltoCus Order*] |
and if we are in the context of (Order:543210 Date:4/15/93 Item:123) and attempt to match (through an evaluation)-
[ItemPrice Item:123 Date:1/1/93..12/31/93 Customer:5678] |
then it would appear that no match can be made because we do not have any point in the Customer dimension in the current context. However, V4 will automatically attempt to evaluate
[NeedCustomer Dim:Customer] |
and use the result as the value for the Customer dimension for this match. This would match the binding above, re-evaluate to determined the billto customer for the current order and if it equaled Customer:5678 permit the match to succeed.
Points referenced on dimensions marked with the AutoIsct option can be automatically evaluated without the use of bounding brackets. The following is an example-
Dim AI Dict AutoIsct Bind 5 Point AI Val1 Val2 Bind [Val1] 100 Bind [Val2] 200 |
= Minus(Val1 Val2) | Note that the points are not enclosed in brackets" |
Int:-100 |
Binding numbers are an important aspect of a large V4 environment. These numbers control how a binding is to be stored. During a binding, V4 scans all points in the binding intersection from left to right and tracks the first dimension with the highest binding number. This becomes the dimension used as the primary 'key' for storing the binding. For this reason, all dimensions with a binding number must be stored as a number- Integer, Dictionary, Time, etc. Alpha, foreign, data elements, etc. cannot have binding numbers.
V4 assumes, for most dimensions, that all possible points already EXist for that dimension and that any point on that dimension can be referenced. Any point on the Int (integer) dimension can be referenced as a integer literal, any point on the Alpha dimension can be referenced as a quoted string. Dimensions of type Dictionary are different. Points on these dimensions correspond to specific points. V4 can create these points as they are referenced or with the NoAutoCreate option, force the user to declare all points with the Point command.
The PointCreate dimension option enables another level of control by declaring how points are to be created. If PointCreate Point is given, then all points on the dimension must be done with the Point command. If PointCreate New is given then points are created with the dim:{new} construct. Each reference to dim:{new} creates a new, unique point for that dimension. In both cases, the use of PointCreate, causes V4 to create an internal list of all created points for that dimension so that the dim.. construct can be used to reference all points on that dimension.
Dim Division Dictionary PointCreate Point NoAutoCreate Point Division USA CANADA MEXICO Eval EchoT( Division.. ) USA CANADA MEXICO |
The BindEval option is used to control how bindings are created on a dimension. In most cases, V4 makes all the decisions on how to represent a store a binding. With this option, when a binding is to be done on the dimension, V4 evaluates an intersection that contains all of the points in the binding intersection plus a new point of Value:bindval where bindval is the value point of the dimension. The EXample below shows how a binding on the GL dimension can be converted to another binding.
Dimension GL Bind 5 BindEval Bind [GL.. Period.. Year.. Type.. Value..] BindQE([Pack1616(GL* Period*) Year* Type*] Value*) |
The DotDotToList option is used to map from dim.. to a list of points when that list might not be explicitly given or when that list may vary. The example below demonstrates the definition of the Year dimension which corresponds to the years that a fictional company has been in business. The DotDotToList binding defines the years as being from 1990 to the present and the Acceptor function ensures that only years within that time span are referenced.
Dim Year UYear DotDotToList Acceptor Range Multiple Dim Arg IMArg |
[UV4:Acceptor Dim:Year Alpha..] | The use of " IntMod:In ensures that the year specified is valid |
In(MakeP(Dim:Year Int:=Alpha*),0 [UV4:DotDotToList] Arg:1 @EchoE("Year must be 1990 through " UYear:{now})) |
[UV4:DotDotToList Dim:Year] | Note that the UYear dimension is used to define points. If the Year dimension was used then problems arise from using this definition in the Acceptor binding (it recurses into oblivion!) |
 Num(UYear:1990 To::UYear:{now} Dim:Year |
The Value option enables two types of dimension reference that would not normally be allowed. If 'Value List' is given then the following two dimension references are possible: 'dimension:( list of points )' and 'dimension:[ list of points ]'. The former is parsed and converted to [UV4:ValuesList Dim:dimension (list)] and the latter to [UV4:ValueList Dim:dimension (list)] (compare UV4:ValuesList to UV4:ValueList). If the 'Value Tree' option is given then the following two types of references are possible: 'dimension:( logical expression )' and 'dimension:[ logical expression ]'. These are parsed and converted to [UV4:ValuesList Dim:dimension Int:treeId] and [UV4:ValueList Dim:dimension Int:treeId] where Int:treeId points to the top node a V4 Tree structure.
If the list of points or logical expression consists of a single intersection or module and is prefaced with a back quote ('`') then that intersection/module is is inserted into the resulting binding. At runtime the evaluation must return either a list or integer corresponding to a tree node.
The purpose of this option is to allow the referencing of a set of points on a dimension without explicitly specifying how those points are to be determined. By writing handlers to V4 areas, SQL databases or other data sources, one can use a consistent expression to refer to data (points) from many sources of data.
Dim data Integer Value Tree | define dimension with Value attribute | |
[UV4:ValuesTree Dim:data Int..] | define 'handler' to enumerate through the tree | |
List(Tree(Int* ListOf? Enter::"(" Leave::")" | ||
Return::@Format(Tree(Int* Value?) Point?) Bottom::@Format(Tree(Int* Value?) Point?)) Column::" ") | ||
= data:(foo > 12 & moo < 15) | returns "( ( NId:foo UV4:Rangle Int:12 ) UV4:Ampersand ( NId:moo UV4:LT Int:15 ) )" |
Dump - Dumps out Bindings Containing Dimension or Matching Pattern
Dump dim | |
Dump pattern | |
Dump pattern > file | |
Dump pattern >> file |
dim | A dimension name. | |
pattern | An intersection specification. | |
file | A file name to receive any output of the dump. |
This command searches all currently active areas for bindings containing a point on dim or bindings containing the point(s) contained within pattern.
If a '> file' is specified then all output is sent to the file, not the user's console. The '>' construct specifies that a new file is to be created. The '>>' construct specifies that a new file is to be created if it does not already exist, otherwise append to the end of the existing file.
Dump IM | Outputs all bindings containing points referencing Dim:IM | |
Dump [LId.. NId..] | Outputs all bindings containing both Dim:LId points and Dim:NId points |
Echo - Echo Text to Controlling Window
Echo point point ... |
point | Any V4 point. |
The Echo command simply echos or outputs its argument points to the controlling window.
Echo Here we are |
Element - Define a V4IS Structure Element
Element ref sub index name bytes offset v3dt decimals |
ref | The file reference of the structure to which this element belongs. | |
sub | The substructure index for this field, i.e. which substructure within the main structure of the record. Use 0 for elements within the main structure. | |
index | The element index number within the structure. | |
name | The name of the data element. | |
bytes | The length of the element in bytes. | |
offset | The offset to the starting byte of this element within the parent structure. | |
v3dt | The V3 datatype code. | |
decimals | The number of implied decimal places. |
The Element command is used to define elements within a V4IS structure. These definitions are then used by the V4ISVal module to access and interpret data within V4IS records. The following two macros are recommended for defining elements. The V3 compiler will output macro calls adhering to this format-
{/STRUCT( aFileRef, aStructName ) }/STRUCT {/FLD(aFieldName, aRef, aIndex, aDim, aV3DT, aKeyNum, aSubStruct, aOffset, aBytes, aDecimals, aComment ) Element aRef aSubStruct aIndex aName aBytes aOffset aV3DT aDecimals ; }/FLD {/FLDS(aRef, aSubStruct, aIndex, aBytes, aMaxCount, aName, aOffset ) Structure aRef aSubStruct aIndex aName aBytes aOffset aMaxCount ; }/FLDS |
Example 20 - V3 Commands / Structure and Resulting V4 Macros
dcl v4b "example.v4" ; dcl struct FileInfo=1234 { int a ; alpha 10 b ; } ; sys_exit() ; The result in example.v4 STRUCT( 1234, FileInfo) FLD( A, 1234,1,Int,1,0,1,0,4,0, "") FLD( B, 1234,2,Alpha,3,0,1,4,10,0, "") FLD( FileInfo, 1234,3,Alpha,3,0,0,0,16,0, "") FLDS( 1234,1,3,16,0,"",0) |
End - End a Section of V4 Source
End | |
EndTable |
The End command is used to end multiline V4 source sections such as If statements and Tables.
If not Dimension Cus Dim Cus AggRef Dim CusId Dictionary End |
Error - Generate Error Message
Error text |
text | Any V4 text string. |
The Error command generates a V4 error with the text message.
Error Should not be here |
Evaluate - Evaluate an Intersection
Evaluate isct | |
Evaluate isct > file | |
Evaluate isct >> file | |
= isct |
isct | An intersection (not quoted) to be evaluated. | |
file | A file name to receive any output of the evaluation. |
The Evaluate command evaluates the given intersection. The result of the evaluation is not displayed on the user's console. The '=' command also evaluates an intersection and then displays the result on the user's console.
If a '> file' is specified then any output generated in the evaluation is sent to the file, not the user's console. The '>' construct specifies that a new file is to be created. The '>>' construct specifies that a new file is to be created if it does not already exist, otherwise append to the end of the existing file. The output stream is named UV4:EvalStream.
= [Name Cus:123] Alpha:The Jones Company Eval [BalanceSheet Period:3 Year:1995] > bs.rpt |
The first example evaluates the Name of a customer. The returned name is output (shown underlined). The second example evaluates a balance sheet and directs the output to the file bs.rpt.
Exit - Exit from V4
Exit | |
Exit File | |
Exit Statistics |
The Exit command simply exits from V4 to the host operating system-
File | Exit from the any include files and return to the V4 interpreter command prompt (does not exit from V4). | ||
Statistics | The optional use of the Statistics keyword tells V4 to output a runtime summary (default). |
xv4>Exit Statistics |
Example 21 - Processing Summary
Processing Summary Time: 31 elapsed seconds, 12.62 CPU seconds Scan: 6975 lines, 93426 tokens Bind: 10415 added Isct: 5341026 eval's, 18549 value I/O's, 74% cache hits Ctx: 3768380 adds, 68478 I/O, 25994 Cache's, 3672021 Slams Cnbl: 1520 insertions, 11930 hits XDict: 557 XDict lookups, 61% cache hits RAgg: 3985967 calls, 3974151 repeats (99 %) Wall: 172291 evals/sec, 121560 context-adds/second CPU: 423219 evals/cpusec, 298603 context-adds/cpusec Errs: 0 |
The first line shows the total wall-clock time and cpu time spent in V4. The second line shows the total number of lines (command) scanned. This includes lines within macros. The token count is the total number of symbols, commands, literals, etc. scanned. The Bind line shows the total number of bindings added. The Isct line is the number of intersections evaluated. The value I/O count is the number of separate I/O's needed to get 'big' values. and the percentage of cache hits is the reflects percentage of values obtained in a runtime cache (larger is better). The Ctx line shows the number of context calls, the number of I/Os to support, and the number of context cache hits. The Slams count represents the number of fast point replacements into the context (slams are very fast and the more the merrier).
The Cnbl insertions count is the number of context value cache insertions and the hits represents the number of cache hits on those insertions (the larger the hits is to the insertions the better). The XDict line shows number of External dictionary lookups and percentage found in the cache. The RAgg line is the number of aggregate value lookups. The percentage should be close to 100% showing that blocking and buffering within the Aggregate structure is operating properly. If aggregates are written then a WAgg line will show the number of logical writes as well as the number of actual writes to the underlying V4IS file system.
The next two lines (Wall and CPU) average the wall clock time and cpu time over the number of intersections. While there is no average time to perform an intersection, rates of over one million per second can be achieved with a fast cpu. The last line shows the number of errors detected.
FAggregate - Create and Store a Data Aggregate
FAggregate < storagept value1 value2... > | |
FAggregate < #tablename# > |
storagept | The point used to store the aggregate. This point is not part of the aggregate and may not be extracted by the AggVal module (i.e. repeat/duplicate the point to be able to reference it.) | |
valuen | A value point. This may be any type of V4 point. If the point is an intersection then it is evaluated (use the quote '@' to insert an intersection into an aggregate). If 'dim*' is specified then the current value of the dimension is used. |
See the Aggregate command for a discussion of this and other aggregate-related commands.
#if - Conditional Processing
#if [:label] condition argument | |
#elseIf condition | |
#else | |
#end [:label] | |
#if1 condition argument command |
condition | A condition to be checked, see list below. | |
argument | A macro argument or parameter to be checked for the condition. | |
command | A single line command to be executed if the condition-argument pair is true. | |
label | An optional #if/#end label that can be used to help match up statements if nested If are required. An error is generated if the label names do not match. |
Conditional inclusion/compilation of V4 is achieved with this set of pre-processing directives.
The #if1 statement is a one line command that can be used if the conditional command is a single line. The conditions to test are:
Bind | isct | True if the intersection has a value bound to it (in current context). | |
Defined | dim* | True if the dimension is defined in the current context, false otherwise. | |
Defined | arg | True if the argument or Set Parameter symbol is defined, false otherwise. | |
Dimension | arg | True if arg is a valid dimension name. | |
Empty | arg | True if the argument is a zero length string. | |
Errors | True if there have been any V4 errors. | ||
Exists | file | True if the file exists, false otherwise. | |
False | Never true. | ||
Macro | name | True if the macro name is currently defined. | |
MoreRecent | file1 file2 | True if the create/update date of file1 is more recent than that for file2. | |
Not | option | Reverses the logic of the next test option. | |
Numeric | arg | True if the argument is numeric | |
Same | arg1 arg2 | True if both arguments are the same or equal. Either of the arguments may be specified as a keyword, a quoted string, a context point (either in current table or current context), or of the form `v4point which is evaluated as a V4 point. | |
Section | name | True if the section name has been specified in the V4 start-up command line. This can be used to conditionally process different sections of a V4 command file. See the -rs switch under V4 Startup Switches and Options. | |
Test | v4point | Evaluates the v4point as a logical point. | |
True | Always true. | ||
ValidPoint | dim value | True if the Value is valid for the dimension Dim. |
Example 1: If/If1 Usage in V4 Macro {/DEMO( aArg1, aArg2, aArg3 ) #if1 NoBind [Listof DimX:aArg1] Bind [Listof DimX:aArg1] List:() #if Defined aArg2 ; Bind [Value Func:aArg3] Alpha:aArg2 ; #else ; Bind [Value Func:aArg3] 'No value defined' ; #end ; }/DEMO |
The first line of the macro is an #if1 statement. If the intersection is not defined then perform the Bind command to bind it to an empty list. The following #if-#else-#end tests to see if Arg2 has been defined or not and issues the appropriate Bind commands.
The next example demonstrates the use of the Dimension option-
#if not Dimension Cus Dim Cus AggRef Dim CusId Dictionary #end |
Include - Read V4 Commands (Data) from File
Include file options | |
Include `point |
file | The file to be included. If a keyword is given then file.v4b is assumed. If the file is a quoted string then a full file path is used. | |
point | The point is evaluated. If the result is a single line string then the result is taken as the file name. If the result is a multi-line string then that string is taken as the input to be included. |
The Include command causes the V4 interpreter to take all the commands in the specified file and execute them. The lines of input are not normally echoed, but this can be controlled with the 'Set Echo' command.
If no file extension is given then '.v4b' is tried. If the lookup fails then '.v4c' is tried. If the latter succeeds then the file is assumed to be compressed and is automatically expanded (see the section on xv4 commands).
A filter option may be specified to preprocess all input lines. When a filter intersection is specified V4 process the input as follows. First the input line is added to the context as a Dim:Alpha point. Then the filter point is evaluated. If the resulting value is an Alpha or BigText point then that point is used as the current input line. If the value is Logical:True then the current Alpha* point is used. If the value is Logical:False then the line is skipped and processing continues with the next input line. If the result is the point UV4:Retry then the line is re-processed (this may be useful for altering the context and then rereading the line). If the result is a List then each point in the list is read as the next input line before resuming input from the main input stream.
Blanks | Any blank lines found in the input are to be ignored. | ||
Comment | chars | Any line beginning with one of the characters in chars is considered a comment line and skipped. | |
Continued | Long input lines may be continued by ending a continued line with a backslash character. | ||
CSV | The input is taken to be in comma-delimited format. | ||
Delimit | char | Use char as the column delimited character. | |
Embedded | The first column of the input is assumed to be the macro name and following columns are data (where columns are delimited by tabs or commas as described above). If the first column is blank then the previously defined macro is used and the remaining columns are treated as data. | ||
Filter | isct | Evaluate the filter isct for every input line. See the Include command for more information. | |
Goto | Normally an 'include' nests to the the specified file and upon hitting the end-of-file returns to the next line in the current file. The use of this option closes off the current file and continues with the include file. This option can be used with V4 conditional-line processing to move from one file to another. | ||
Header | num | Skip the first num (header) line of the input file. | |
Macro | [bname,]name | The macro name is to be invoked for each row of this table. If the optional bname is given is used when parsing XML files (see Include for more information). The name macro is always invoked after the last element of the row has been parsed. | |
Minimum | num | Skip any input lines that are less than num characters in length. | |
Section | name | Declare the V4 section(s) to be name for the duration of the include. | |
Tab | The input is taken to be in tab-delimited format. | ||
Table | name | The input is parsed row-by-row according to the format specified in the V4 table. If the specified table is not currently defined then V4 attempts to evaluate [UV4:TableDefine name] where name is the table name. If the table is still not defined then an error is generated. | |
XML | The input is assumed to be in XML format. See below for more discussion. |
This example defines a macro to read in inventory data. The Include command reads the file 'inventory.data'. The first line of the file is skipped (Header). The data file is assumed to have four columns- Id, Desc, Qty, and Price.
{/INV( aId, aDesc, aQty, aPrice ) Context Add INV:{new} ; Bind [INV* Id] ID:aId ; Bind [INV* Desc] Alpha:aDesc ; Bind [INV* Qty] Int:aQty ; Bind [INV* Price] Money:aPrice ; }/INV Include inventory.data Macro INV Header TAB |
The example below defines a set of V4 tables and macros to parse an XML file. V4 handles XML files somewhat differently then rows of data. V4 attempts to match each <xxx>...</xxx> entry with a column in the current table. If no match is found then it attempts to match it with a table name. If a match occurs then that table becomes the current (nested) table. If two macros are defined for a table, the first is invoked when a nested table is entered and the second macro is invoked when then nested table is exited. The syntactic parsing of column elements is similar to that of non-XML tables.
Example 22 - V4 Tables to Parse XML File
Include v4 Dim Client External Dim DateTime DateTime Range Multiple Dim Device External Multiple Dim Directory Alpha Dim Form External Multiple Dim MonitorUDT DateTime Range Multiple Dim Process Int Dim Status External Multiple Dim User External Multiple Dim ChkDisk,ChkProc,ChkBU,ChkV4,ChkDemon AggRef Table Defaults Col DateTime Format DDMMMYY Col MonitorUDT Format DDMMMYY Col Process Format Hexadecimal EndTable Table MIDASMonitor Macro MIDASMonitorB,MIDASMonitorE Col Client * Col MonitorUDT * EndTable {/MIDASMonitorB() Context Add Client* ; Context Add MonitorUDT* ; Eval Echo("Starting " Client* " as of " MonitorUDT*) ; }/MIDASMonitorB {/MIDASMonitorE() Eval Echo("Finished Monitor of " Client* " as of " MonitorUDT*) ; }/MIDASMonitorE Table CheckDisk Macro CheckDisk Col Device * Col Status * Col Errors Int Error Int:0 Col Label Alpha FixedLength 12 Default Alpha:"" Col FreeMB Int EndTable {/CheckDisk() BFAgg < ChkDisk+ #CheckDisk# Client* MonitorUDT* > ; }/CheckDisk Loop #CheckDisk# Bind [ChkDisk.. #c#] AggVal(ChkDisk* Dim:#d# #i#) Bind [ChkDisk.. Client] AggVal(ChkDisk* Dim:Client #i+#) Bind [ChkDisk.. MonitorUDT] AggVal(ChkDisk* Dim:MonitorUDT #i+#) Table CheckActiveProcess Macro CheckActiveProcess Col Process * Col User Alpha Col CPUPercent Int EndTable {/CheckActiveProcess() BFAgg < ChkProc+ #CheckActiveProcess# Client* MonitorUDT* > ; }/CheckActiveProcess Loop #CheckActiveProcess# Bind [ChkProc.. #c#] AggVal(ChkProc* Dim:#d# #i#) Bind [ChkProc.. Client] AggVal(ChkProc* Dim:Client #i+#) Bind [ChkProc.. MonitorUDT] AggVal(ChkProc* Dim:MonitorUDT #i+#) Table CheckBackup Macro CheckBackup Col BackupDT DateTime EndTable {/CheckBackup() BFAgg < ChkBU+ #CheckBackup# Client* MonitorUDT* > ; }/CheckBackup Loop #CheckBackup# Bind [ChkBU.. #c#] AggVal(ChkBU* Dim:#d# #i#) Bind [ChkBU.. Client] AggVal(ChkBU* Dim:Client #i+#) Bind [ChkBU.. MonitorUDT] AggVal(ChkBU* Dim:MonitorUDT #i+#) Table CheckV4Build Macro CheckV4Build Col DateTime * Col Status * Col V3Errors Int Default Int:-1 Col V4Errors Int Default Int:-1 EndTable {/CheckV4Build() BFAgg < ChkV4+ #CheckV4Build# Client* MonitorUDT* > ; }/CheckV4Build Loop #CheckV4Build# Bind [ChkV4.. #c#] AggVal(ChkV4* Dim:#d# #i#) Bind [ChkV4.. Client] AggVal(ChkV4* Dim:Client #i+#) Bind [ChkV4.. MonitorUDT] AggVal(ChkV4* Dim:MonitorUDT #i+#) Table CheckExecDemon Macro CheckExecDemon Col ScheduleDT DateTime Col CurrentDT DateTime Col DemonUpSec Int EndTable {/CheckExecDemon() BFAgg < ChkDemon+ #CheckExecDemon# Client* MonitorUDT* > ; }/CheckExecDemon Loop #CheckExecDemon# Bind [ChkDemon.. #c#] AggVal(ChkDemon* Dim:#d# #i#) Bind [ChkDemon.. Client] AggVal(ChkDemon* Dim:Client #i+#) Bind [ChkDemon.. MonitorUDT] AggVal(ChkDemon* Dim:MonitorUDT #i+#) |
Below is a sample XML file that would be parsed by the above tables and macros. The command to start the parsing would be of the form-
Include file.xml Table XML |
Example 23 - XML File to Parse
<MIDASMonitor Client="ABC" MonitorUDT="09-Jun-03 15:51"> <CheckDisk> <Device>MIDAS$DKB200</Device><Status>Mounted</Status><Errors>0</Errors><Label>DISK1</Label><FreeMB>17351</FreeMB> </CheckDisk> <CheckActiveProcess> <Process>0002ADC7</Process><User>BATCH_653</User><CPUPercent>1</CPUPercent> </CheckActiveProcess> <CheckBackup> <BackupDT> 7-JUN-2003 03:43:08.09</BackupDT> </CheckBackup> <CheckV4Build> <DateTime>9-JUN-2003 01:31:17.43</DateTime><Status>Moving</Status> </CheckV4Build> <CheckExecDemon> <ScheduleDT>9-Jun-03 15:36</ScheduleDT><CurrentDT>9-Jun-03 15:36</CurrentDT><DemonUpSec>32547</DemonUpSec> </CheckExecDemon> </MIDASMonitor> |
#include - Read V4 Commands from File
#include file | |
#include `point |
file | The file to be included. If a keyword is given then file.v4b is assumed. If the file is a quoted string then a full file path is used. | |
point | The point is evaluated. If the result is a single line string then the result is taken as the file name. If the result is a multi-line string then that string is taken as the input to be included. |
The #include directive causes the V4 interpreter to read the contents of the specified file. The lines of input are not normally echoed, but this can be controlled with the 'Set Echo' command.
If no file extension is given then '.v4b' is tried. If the lookup fails then '.v4c' is tried. If the latter succeeds then the file is assumed to be compressed and is automatically expanded (see the section on xv4 commands).
The #include directive is similar to the V4 Include command. It does not support all the options of the command but since it is not a command it can be used within the definition of a binding.
#include foo | Reads the contents of file foo.v4 |
Loop - Enumerate through List of Values
Loop #table# | |
Loop param = start..end |
table | A table name. The Loop command enumerates through all columns in the table. | |
param | A parameter name (single letter from A - Z). | |
start | The starting integer value. | |
end | The ending integer value. |
The Loop command is used primarily to enumerate through all columns in a table. For each iteration, the following parameters are set- #c# is set to the current column name, #q# is identical to #c# excpet that the name is enclosed in quotes, #d# is set to the dimension name of the column, #i# is set to the index or position of the colum in the table (1 for the first column), #m# is set to the Column Missing option (or empty string if none), and #x# for the description of the column.
The second form of Loop is to simply enumerate through a range of integer values.
Loop #Table1# Bind [Entry.. #c#] AggVal(Entry* Dim:#d# #i# #m#) |
Pattern - Save Binding as a Pattern
Pattern pisct value |
pisct | A pattern intersection to be bound to the value. These are similar to regular intersections without the constraint of one point per dimension. | |
value | The value associated with the pattern. |
A pattern is defined and accessed much like a normal intersection. There are differences however. First is that the order of the points in pisct is important. An evaluating intersection must have points in the same order to match. The second difference is that the pisct can contain more than one point of the same dimension.
When a pattern is 'matched' any points in the pattern that are ranges are not entered into the context as those dimensions but rather with the shell dimensions P1, P2, ..., Pn where n is the number of non-explicit points.
Pattern [Int.. TakeAway Int..] Minus(P1* P2*) [10 TakeAway 4] |
Point - Define a Point on a Dimension
Point dimension value value ... |
dimension | The dimension for which the point is to be created. | |
value | One or more value points for the dimension. |
This command adds points to a dimension. If a dimension is declared with the 'NoAutoCreate' option then this must be used to create points. If the dimension has been declared with 'PointCreate Point' then each point added with the Point command is added to an internal list for that dimension. All of the points defined for the dimension may be referenced with 'dimension..' or List(Dim:dimension).
If a value is the name of a column in an active table then its value is used, not the literal value/column name.
Dim Country Dictionary Point Country USA Mexico Canada Bind [Capitol USA] WashDC' |
Recognize - Define Recognition Pattern for V4 Parser
Recognize pattern substitution [options] | |
Recognize pattern `v4point [options] |
pattern | A regular expression pattern to match | |
v4point | A V4 point to be parsed, evaluated and converted to a string that becomes the pattern value. | |
substitution | A string to be substituted in place of the pattern. Regular expression groups within the pattern may be referenced as '\n' where n is the group number ('\0' for the entire pattern). Note that this string should be enclosed in single quotes if the '\n' construct is to be used. | |
options | Any of the options below. |
This command defines a recognition pattern for the V4 interpreter. Any V4 keyword or string (enclosed in single quotes, NOT double quotes) may be potentially recognized and substituted. This may be used to automatically recognize points on a particular dimension, convert keywords to function references, or reformat complex points to standard V4 formats.
Evaluate | Evaluate the substitution as a V4 point and use that evaluation as the value. | ||
NoCase | Make the pattern upper/lower case insensitive, otherwise it is case sensitive. | ||
Trace | Output a trace each time the pattern is matched. This is particularly useful when the use of a pattern does not do exactly what was intended. |
Recognize 'tomorrow' '{UDate:{now} + 1}' Eval | Recognizes 'tomorrow' as the date determined by evaluating the substitution string at compile time. | |
Recognize 'yesterday' '{UDate:{now} - 1}' | Recognizes 'yesterday' and substitutes it with the expression which is then determined at run time. | |
Rec "^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([0-9]+), ([0-9]+)$" 'UDate:\2-\1-\3' | Recognizes dates such as 'Jan 2, 2002' and converts to valid UDate format. | |
Recognize 'Func.*' 'Func:\0' | Results in a compile-time error because the substitution string matches the pattern. | |
Recognize 'Func[^:].*' 'Func:\0' NoCase | Correctly recognizes all tokens of the form Funcxxx as being a point on the Func dimension. | |
Recognize 'uniquePoint' `V4(Unique?) | Evaluates the V4(Unique?) module and assigns the result as the value of 'uniquePoint' | |
Recognize 'uniquePoint' "V4(Unique?)" Evaluate | Assigns the string "V4(Unique?)" to uniquePoint. Each time 'uniquePoint' is referenced the V4() module is evaluated returning (another) unique point. |
Recognize "\\$([0-9]+),([0-9]+),([0-9.]+)" 'Money:\1\2\3' |
Recognize "\\$([0-9]+),([0-9.]+)" 'Money:\1\2' | These three rules recognize patterns of the form '$n,nnn.nn' and convert to points on the Money dimension |
Recognize "\\$([0-9.]+)" 'Money:\1' |
Set Aggregate - Sets the Default Aggregate for Output
Set Aggregate aggid |
aggid | The identifier of the aggregate to be written into as a default. |
This command is used to define the default output aggregate when multiple aggregates has been open for update. See the Id option of the Area command.
Area Create agg1.v4a Aggregate Id ag1 | Open first area | |
Area Create agg2.v4a Aggregate Id ag2 | Open second area | |
Set Aggregate ag2 | By default, all Agg/FAgg/BFAgg commands output to agg2.v4a |
Set Ajax Errors - Defines error return mask for error handling back to AJAX web site
Set Ajax Errors errorpattern |
errorpattern | A string pattern set up for 2 Unicode arguments. The first argument is the error level and the second is the error message. |
This command defines an error-message pattern when V4 is called from the web via AJAX. When the pattern is defined, the normal processing of the EchoE / EchoW / EchoA modules is altered. Instead of the standard error message, the pattern is used to format another message (typically in JSON format).
Set AJAX Errors "{'meta': {'status':'%1U', 'msg':%2U}}" |
Set AJAX JSON - Defines a Pattern for Returning JSON Formatted Results Back to a Web Application
Set AJAX JSON jsonpattern |
jsonpattern | A string pattern accepting a single Unicode argument. This argument is replaced with what would normally be V4 output. |
Normally, V4 outputs with each Echo module call. A web function calling V4 and expecting a JSON result will require some sort of wrapper around the output to conform to JSON standards. This can be easily done with this command. After issuing this command, all V4 output is buffered internally into a single string. When the evaluation is complete, the string is merged with the given jsonpattern and the resulting string is then output.
Set AJAX JSON "{'meta': {'status':'ok'}, %1U}" | set up the pattern | |
[Test] | Set up a test | |
Enum(Int:1..5 @Echo(JSON(Name::Str("Res" Int*) Str("The value is " Int*)))) | ||
Eval [Test] | evaluate then expression | |
{'meta': {'status':'ok'}, 'Res1':"The value is 1",'Res2':"The value is 2",'Res3':"The value is 3"} | is the result |
Set Argument - Sets the Value of Current Macro Argument
Set Argument argname value |
argname | The name of one of the current macro's arguments. | |
value | A new value to be assigned to the argument |
This command is used to set/change the value of a macro argument.
{/Macro(arg1, arg2, arg3) . . . If1 not ValidPoint ZipCode arg2 Set Argument arg2 00000 ; . . . }/Macro |
Set BindContext - For Automatic Inclusion of Points within Bindings
Set BindContext isct | |
Set BindContext `isct | |
Set BindContext UV4:none |
isct | The points within the intersection isct are included in all subsequent bindings. | |
`isct | The points specified by the evaluation of isct are included in all subsequent bindings. | |
UV4:none | Stops the automatic inclusion of points. |
This command is to be used automatically include one or more points in bindings without having to explicitly give the points.
Set BindContext [UDate:1/1/2009 factor:1.3] | Specify two points | |
Bind [alpha] beta | the actual binding becomes [alpha UDate:1/1/2009 factor:1.3] beta | |
Set BindContext UV4:none | 'turns off' the automatic binding context |
Set Duplicates - Controls Handling of Duplicate Dictionary and External Points
Set Duplicates Error | |
Set Duplicates Ignore | |
Set Duplicates Warn |
This command is used to control the handling of duplicate dictionary and external dictionary points. The default is to output a warning. The Ignore option can be used to disable all messages. The Error option generates a V4 error when a duplicate is encountered.
Dim X External | define dimension | |
Point X a b c d | create points on dimension | |
POINT X a | generates warning (default) that X:a is a duplicate | |
Set Duplicates Ignore | turn off warning | |
POINT X b | no warning or error is generated |
Set Echo - Controls Echo of Include Lines from File
Set Echo value |
value | How to enable echoing. If set to ON then all Include lines in the current file are echoed. If set to OFF then echoing is not done. If set to an integer number then that number is stored internally and decremented by one for each nested Include file. Echoing is enabled as long as the number is greater than 0. If set to ALL then the current and all nested include files are echoed. If set to HTML then V4 automatically outputs HTML to bracket prompts, input, and output (see below). If echoing is on then DISABLE will temporarily disable the echoing and ENABLE will make it resume. DISABLE and ENABLE have no effect if echoing is not being performed. |
The HTML option causes V4 to embed html span segments separating V4 prompts from V4 input from V4 output. Each span segment is given a class: 'v4prompt' for prompts, 'v4input' for input into V4, and 'v4output' for all output generated by V4. This is a useful option when V4 is being run for the purposes of documentation.
Set Echo 1 ... ... Include file ... |
In this example, all lines after the first Set Echo would be echoed up to the Include command. Lines read from that file would not be echoed because the counter would be decremented to 0. Lines after the Include command would be echoed however.
Set EchoS - Control Format of EchoS() Output
Set EchoS mode |
mode | Mode should be Spreadsheet for EchoS to output in spreadsheet format or Text for EchoS to operate as EchoT. |
The EchoS module outputs in a format that is interpreted by spreadsheet clients. It is not a text file readable by the user. When debugging it is often useful to be able to see the results before sending them to a spreadsheet. This command can be used to temporarily change all EchoS module calls to EchoT without having to actually change V4 code. The EchoS module supports many more features (i.e. tagged arguments) than EchoT, therefore the EchoT module ignores any tagged arguments it does not normally handle.
Set Errors - Controls handling of V4 Errors and Messages
Set Errors EchoE filename | |
Set Errors Output filename | |
Set Errors URLonError url | |
Set Errors mode | |
Set Errors None |
filename | Is a filename to be updated with all V4 error and EchoE output. | |
url | Is a URL to be used as a destination after the (presumed) WWW application outputs an error message. | |
mode | Compiling to enable compiler-only error messages, Interpreting (default) for full V4 error messages and context information. |
This command controls various aspects of error handling within V4. The Output option forces errors to a specific file (as opposed to stdout). The URLonError option specifies a target web address to be followed after a web error. The Compiling and Interpreting options control the type of error message that is output. The Compiling option only outputs the error and location. The Interpreting option outputs the error, location, and V4 context/environment at the time of the error. The None option resets the internal V4 error count.
Set Error Compiling | Limits error messages to just the error and source location | |
Set Error Output foo.err | Directs all error messages to the file foo.err |
Set Input - Controls the Format of V4 Input (Include) Files
Set Input mode |
mode | The mode or format of the input (include) files read by V4. The allowed values are ASCII (default), UTF16 for 16-bit characters (endian of the running machine), UTF16be for 16-bit big-endian, UTF16le for little-endian, UTF8 for UTF-8 encoded output, and UTF8nh for UTF-8 encoded output without the byte order mark (BOM) at the beginning of the file. |
This command is used to set the format of subsequent V4 input. It is necessary when reading UTF8 files that are not encoded with the UTF8 prefix (codepage 65001).
Set Input UTF8nh | The subsequent input/include files will be read as UTF8 without the standard UTF8 file header. |
Set Logical - Defines a Logical Device/Path
Set Logical logdev = path |
logdev | The name of the logical device. This device name may preface a file specification. A colon delimits the device name from the remainder of the file path. | |
path | A full or partial directory path. The logdev may be substituted for the path. |
Logical devices are a convenient way of altering file paths without having to change detailed code.
The use of the equal sign between the logical device name and path is optional.
Set Logical v4_Lib=d:/Source/V4Library/ | Assigns the path d:/Source/V4Library to logical device v4_Lib |
Set MacroBind - Controls Macro Storage
Set MacroBind isctmask point | |
Set MacroBind isct |
isctmask | An intersection mask to be used for storing macro. The current macro name is indicated by an asterisk in the mask. | |
point | The point to use to store a macro, usually of the form dim:{new}. |
This option is used to control how macros are stored in a V4 area. The intersection mask, isctmask, should contain an asterisk '*' which is replaced with the name of the current macro. The point is evaluated and the integer value associated with the point is used as a unique key to store the macro in the 'BigText' format. The intersection and value are bind'ed together and the binding area selected is also used to store the actual macro. Note that when the Set MassUpdate option is set, macro values are cached within the V4 runtime to provide faster processing.
Dim Macro Int PointCreate New Set MacroBind [* Dim:Macro] Macro:{new} Set MacroCall [* Dim:Macro] |
This example gives the standard macro setup found in v4kernel.inc. The dimension Macro is declared with PointCreate New. The MacroBind mask includes the current macro name ('*') as well as a point to use to store the macro. The MacroCall mask is the same and is used to retrieve a macro value.
Set MacroSave - Enables saving of macro definitions within V4 area
Set MacroSave |
Normally macros are defined and used at compile time. Macro definitions are lost when a V4 process terminates. This option may be enabled to force V4 to save all subsequent macro definitions within the current writeable V4 area. These macros may then be referenced at a later time (in another process) without having to read in the actual source file definitions.
A point is added to the Dim:UMacro dimension for each defined macro when this option is enabled. 'UMacro..' may be used to enumerate through all defined macros. The actual text definition of a macro may be obtained through the intersection [UMacro:macroname UV4:Definition].
Set MassUpdates - Enables Mass Update Mode
Set MassUpdates |
none | This command requires no parameters. |
The use of this command tells the V4 environment that many bindings are coming down the pike and to optimize for this scenario. It is assumed that evaluations, other than to process the bindings, are not going to be performed. This option triggers the following:
Enables the internal caching of macro values.
Disables the updating of context points with the addition of each new binding. This may cause some valid evaluations to fail, thus the use of this command is urged only for loading areas with bindings and aggregates.
Inhibits the rewriting of certain summary structures with each binding. These structures are held internally and written out with the final Area Close command.
Set MaxAllowedErrors - Sets Maximum Allowed Errors before Abort
Set MaxAllowedErrors number |
number | The number of allowed processing errors before V4 terminates. |
This command sets an internal counter which is decremented with each V4 error detected. When the counter hits zero, V4 terminates processing and exits. The initial setting for this parameter is currently set to 100, meaning that after 100 processing errors, V4 will abort.
Set MaxPointOutput - Sets Maximum Characters When Displaying a Point
Set MaxPointOutput characters |
characters | The maximum number of characters to display in a point. |
This command sets the maximum number of characters to display in a point. This is useful for points such as lists and intersections that may require a large number of characters to display. The default is 100 characters. Points that are truncated end with "..."
Note that this is an approximate maximum. V4 might go over this limit as it will not truncate a point within a point to limit the outer point to the exact number of characters.
Set MaxPointOutput 50 | sets the maximum to 50 characters |
Set Output - Controls the Format of V4 Output Files
Set Output mode |
mode | The mode or format of the output file. The allowed values are ASCII (default), UTF16 for 16-bit characters (endian of the running machine), UTF16be for 16-bit big-endian, UTF16le for little-endian, UTF8 for UTF-8 encoded output, and UTF8nh for UTF-8 encoded output without the byte order mark (BOM) at the beginning of the file. |
This command is used to set the format of subsequent V4 output where the output format is not explicitly declared (for example the '>' construct within the Evaluate command). Options within the Output module can be used to override this command for a given output stream.
The UTF16, UTF16be, UTF16le, and UTF8 options all create files with a BOM at the beginning of the file. Web pages in UTF-8 format should use the UTF8nh option but include '' within the header section of the page.
Set Output UTF8nh | Sets the output format to UTF-8 without the header. |
Set Parameter - Assigns Value to Macro Parameter
Set Parameter parameter value | |
Set Parameter parameter += value |
parameter | The parameter to be set. A parameter is a single character upper case letter. If the parameter is prefaced with a ' (single back quote) then it is evaluated first as a V4 point (e.g. if it is an intersection it is evaluated.) | |
value | The value for that parameter- a text string or numeric. |
This command is usually used with macro calls to save one or more pieces of information between macro calls. Up to 26 different parameters may be set, one for each letter of the alphabet. The parameter values are referenced by enclosing the letter in cross-hatches (example #S#). Both alphanumeric and numeric parameters are supported.
The use of the plus-equal adds the value into the parameter. Numeric parameters can also be automatically incremented using the '#x+#' construct. Each reference of this form automatically increments the parameter value by one. This is useful in defining sequential V4IS and Aggregate fields (see second example below).
Parameters may also be set in the command line starting V4. See the '-rp' option in V4 Startup Switches and Options.
{/HEADER( aDim, aCounter, aTitle ) Set Parameter D aDim ; ... }/HEADER {/BODY( aArg1, aArg2, ... ) Bind [#D#:aArg1 Value] Int:aArg2 ; ... }/BODY HEADER( SUB, 123, 'This is the title' ) BODY( CODE1, 400, ... ) ... |
The HEADER macro saves the first argument as the #D# parameter. Subsequent BODY macro calls reference the parameter, in this case SUB. The parameter D will remain as SUB until another HEADER macro is invoked.
The second example, below, demonstrates the use of the auto-incrementing feature-
Set Parameter n 0 Bind [Sales.. Date] AggVal(Sales* Dim:UDate #n+#) Bind [Sales.. Cus] AggVal(Sales* Dim:Cus #n+#) ... |
Set PointMax - Sets Maximum Number of Points in Tally()
Set PointMax number |
number | The maximum number of points to scan in a Tally module. |
The PointMax set command is a debugging tool to limit the number of points scanned in a tally operation. This command may be repetitively used to set different maximums for different Tally's.
Set PointMax 1500 |
Set QParameter - Assigns Quoted Value to Macro Parameter
Set QParameter parameter value |
parameter | The parameter to be set. A parameter is a single character upper case letter. If the parameter is prefaced with a ' (single back quote) then it is evaluated first as a V4 point (e.g. if it is an intersection it is evaluated.) | |
value | The value for that parameter- a text string or numeric. |
This command is usually used with macro calls to save one or more pieces of information between macro calls. Up to 26 different parameters may be set, one for each letter of the alphabet. This command is similar to the Set Parameter command except that the value is enclosed within double qoutes.
Quoted parameters may also be set in the command line starting V4. See the '-rp' option in V4 Startup Switches and Options.
Set Parameter a "now is the time" | sets parameter a | |
Eval Echo(#a#) | outputs "nowisthetime" because #a# is expanded without quotes | |
Set QParameter b "for all good men" | sets parameter b | |
Eval Echo(#b#) | outputs "for all good" because #b# is expanded as a single quoted string literal |
Set Section - Sets Section(s) to Load (same as -rs startup)
Set Section name | |
Set Section name, name, ... | |
Set Section |
This command defines the V4 source code sections to be loaded or executed. It is identical to the '-rs' startup option. If the command is given with no arguments then any previous sections are cleared.
Set TableSave - Enables Saving of Table/Column Definitions within a V4 Area
Set TableSave |
Normally table and column definitions are defined only throughout the process that reads the table definition. This command forces V4 to save all subsequent table/column definitions in the current writeable V4 area. Future V4 processes may reference the tables by opening the V4 area. Re-reading the actual table defintions from the source file are unnecessary.
A point is added to the Dim:UTable dimension for each defined table when this option is enabled. 'UTable..' may be used to enumerate through all defined tables. The actual text definition of a table may be obtained through the intersection [UTable:tablename UV4:Definition].
Set Trace - Controls Various Debugging/Trace Features
Set Trace tracelist |
tracelist | One or more of the trace options listed below. More than one option may be included by separating them with commas. |
The various trace options are listing below. This command normally overrides any previous settings. You may preface the options below with a plus (+) or minus (-) to incrementally set/reset particular options.
AddContext | Output a trace message every time a point is added to the context. | ||
All | Output all trace messages. Note that this will generate more trace messages than you could possibly decode. | ||
Arith | Trace all arithmetic errors such as divide by 0 | ||
AutoContext | Output a trace message every time an auto-context evaluation is executed. | ||
BindEval | |||
Binding | Output a trace for each binding saved. | ||
Compare | Output a trace for each point comparison in an evaluation (this generates a considerable amount of output). | ||
Dimensions | Enables compile-time tracing of dimension usage/reference. See the References? tag in the Dim module for details on access this information. | ||
Errors | Outputs errors as they occur. This option triggers a trace of all errors (even if a nested error is eventually trapped). | ||
EvalPt | Traces evaluations of the EvalPt module. | ||
EvalToContext | Not currently used. | ||
Frames | Generate a trace for each context frame created. | ||
IsctFail | Generate a trace of all [UV4:IsctFail] evaluations | ||
Lists | Output a trace message for each list update via Insert/Append from the V4 interpreter. | ||
Log | start | Output a trace for each intersection evaluated but do not start until after V4 has evaluated start intersections (see V4(Count::Evaluations) option for determining current number of evaluations). | |
Log | Output a trace for each intersection evaluated. | ||
Macro | Output a trace for each macro definition recorded. This can be useful for finding a macro that has not been properly terminated. | ||
NBLBindings | Output a trace as each binding bucket is accessed (generates considerable output!) | ||
None | Turn off all tracing | ||
Optimize | Used with the Optimize? tag to get a trace of each optimized point. | ||
Progress | Output a trace at the begin and end of each Tally and Enum operation. | ||
Progress | num | Only outputs a trace if there are at least num points being processed. | |
Recursion | Sets an immediate breakpoint if V4 detects that a binding has been invoked recursively. | ||
TallyBind | Output a trace of all bindings generated by a Tally. | ||
TimeStamp | Prefix all V4 status/progress/debug messages with a date-time/cpu-usage time stamp. | ||
V4IS | Output a trace of any V4IS access and/or processing errors. | ||
XDB | Trace all external database activity and errors. |
Set Trace Progress | traces the progress of Tally() and Enum() |
Structure - Define a V4IS Structure
Structure ref sub index name bytes offset max |
ref | The file ref associated with this structure. | |
sub | The substructure index, 0 for the top level structure. | |
index | Not used. | |
bytes | The total length, in bytes, of the structure. | |
offset | The offset or starting byte relative to the parent structure. | |
max | The maximum number of bytes in the structure. |
The Structure command is used with the Element command to define V4IS structures and fields (elements) for use by the V4ISVal module.
See the Element command for Examples. |
This puts a trace on the progress of each Tally and enters the interactive debugging mode on failed intersections.
#switch - Conditional Processing II
#switch [:label] svalue argument | |
#case cvalue | |
#mcase cvalue | |
#else | |
#end [:label] |
svalue | A value to be compared with the #case values below. | |
cvalue | A #case value compared with the svalue |
The #switch directive evaluates the svalue argument and then compares it against the multiple #case:cvalue options. When a match is found then the V4 source code between the #case and the following #case is compiled. All other code within the scope of the #switch-#end block is skipped.
If no cvalue matches the svalue and an #else is found at the end then the code between the #else and #end is compiled.
The #mcase option is similar to the #case except that multiple #mcase sections can be matched and the associated source code compiled.
#switch:siteSelect TRUE # case Str("192.168.1.231" Exact::OSInfo(IPAddress::v4)) Set parameter T mksVEHcwc # case Str("192.168.166.150" Exact::OSInfo(IPAddress::v4)) Set parameter T mksIBGcwc # case Str(OSInfo(IPAddress?) Has::"192.168.109.137") Set parameter T mksWJT # case Str(OSInfo(IPAddress?) Has::"10.200.166.25") Set parameter T cwcAMZ # case Str(OSInfo(IPAddress?) Has::"172.26.8.91") Set parameter T gntAMZ # case Str(OSInfo(IPAddress?) Has::"172.26.0.231") Set parameter T dfsAMZ # case Str(OSInfo(IPAddress?) Has::"169.254.220.133") # switch NId:=Str(OSInfo(Directory?) After::"Midas\" Before::"\") # case bkf Set parameter T bkfMKS-GD # case cwc Set parameter T cwcMKS-GD # case gnt Set parameter T gntMKS-GD # case gwr Set parameter T gwrMKS-GD # case mdf Set parameter T mdfMKS-GD # else Eval Echo("???Not a recognized directory on GoDaddy???") Exit # end #else Eval Echo("???The current server (" OSInfo(IPAddress?) ") is not configured to run this application.") Exit #end:siteSelect |
Table - Define a Dataset
Table name options |
name | The name of the table. | |
options | Any of the below options. |
The Table command is used to start the definition of a new table. It must be followed by one or more Column commands. The table definition is terminated with the EndTable or End command. The optional Macro argument is used to associate a macro with each row of the table (i.e. the macro is invoked for each row). The optional Header argument can be used to skip one or more lines at the beginning of table. The values in a row are assumed to be separated with tabs (Tab) or commas (CSV). Fixed format (fixed width) columns are also permitted and are specified with the Column commands.
The Prefix and Suffix command options are used to add/append a fixed string to each column name. This can be useful when creating a table with elements that all match elements of another table or record but need to be somehow distinguished from the originals. Note that if the dimension for a column is specifified with an asterisk ('*') then the column name given (without a prefix/suffix) is used.
Blanks | Any blank lines found in the input are to be ignored. | ||
Comment | chars | Any line beginning with one of the characters in chars is considered a comment line and skipped. | |
Continued | Long input lines may be continued by ending a continued line with a backslash character. | ||
CSV | The input is taken to be in comma-delimited format. | ||
Delimit | char | Use char as the column delimited character. | |
Dim | dims | Associates one or more dimensions with the table. | |
Embedded | The first column of the input is assumed to be the macro name and following columns are data (where columns are delimited by tabs or commas as described above). If the first column is blank then the previously defined macro is used and the remaining columns are treated as data. | ||
Filter | isct | Evaluate the filter isct for every input line. | |
Header | num | Skip the first num (header) line of the input file. | |
Macro | [bname,]name | The macro name is to be invoked for each row of this table. If the optional bname is given is used when parsing XML files (see Include for more information). The name macro is always invoked after the last element of the row has been parsed. | |
Minimum | num | Skip any input lines that are less than num characters in length. | |
Other | string | Associates a user-defined string with the table. See the Table module for more information. | |
Prefix | string | Add the string to the beginning of each column name in the table. | |
Suffix | string | Appends the string to the end of each column name in the table. | |
Tab | The input is taken to be in tab-delimited format. | ||
XML | The input is assumed to be in XML format. See below for more discussion. |
Table MidasUOM Macro MidasUOM Col Midas Alpha Ignore Col UOM *, Id UOMId, UOMType Int, Desc Alpha EndTable {/MidasUOM() Point UOM UOM* ; Context Add UOM* ; Agg }/MidasUOM Loop #MidasUOM# Bind [UOM.. #c#] AggVal(UOM* Dim:#d# #i#) Table MidasUOME Macro MidasUOME Col Midas Alpha Ignore Col Index Int, Factor Num, Suffix Alpha, Desc Alpha EndTable {/MidasUOME() Agg }/MidasUOME Loop #MidasUOME# Bind [UOME.. #c#] AggVal(UOME* Dim:#d# #i#) Bind [UOME.. UOM] AggVal(UOME* Dim:UOM #i+#) |