param
The param function is used to read the value of the PARAM(n) variable. The extended rule allows you to reference values that have been passed into the translator via the command line.
Introduction
The -u switch can be used during
the invocation of the translator to pass values in so they can be
referenced by an extended rule. Typically, the param extended rule
is not used by maps that are running within the Sterling Gentran:Server® environment
because Sterling Gentran:Server does
not use the -u switch when invoking the translator. However, if you
are invoking the translator to perform translation outside of Sterling Gentran:Server (tx32
-f <inputfile> <templatefile> <outputfile> <reportfile>),
you have the option to pass values into the translator using the -u
switch and reference those values using the param extended rule.
Syntax
param(integer_PARAM_number);where:
interger_PARAM_number= the number of the pre-defined variable
Example
For example, if you invoke TX32.EXE in the following manner:
tx32.exe -f input.txt 850.tpl output.txt out.rpt -u "PurchaseOrderNumber" -u 12345
-u 500.25Then you could write an extended rule in the \GENSRVNT\Tutorial\Pet_850.map that looks like the following:
string [32] strDescription;
string [32] strPONbr;
string [32] strTotalCost;
real nTotalCost;
strDescription = param(0);
strPONbr = param(1);
strTotalCost = param(2);
nTotalCost = aton(strTotalCost);
if nTotalCost > 200 then
begin
messagebox("Get approval from boss",0);
endYou can run this rule from any scope in your map (for example, pre-session, post-session, group onbegin, field).