You are here: Function Reference > Alphabetical Listing > F > FieldRule

FieldRule

Use this procedure/function when you need to execute a field level rule in a DAL script. See the Rules Reference for more information on field level rules.

Note The FieldRule procedure requires a section to be able to process. It cannot be used in an external DAL script called by the SETRCPTB.DAT file, a custom rule, the RecipIf rule, or placed in the SETRCPTB.DAT custom rule parameters field.

Syntax

FieldRule ( )

There are no parameters for this procedure.

This procedure lets you execute field level rules from within a DAL script. The DAL script is called by one of these Documaker processing rules: DAL or IF. This procedure requires the same number of parameters as are required for a field level rule. While not all fields must contain data, you must include the correct number of delimiters.

You can use overflow variables if the called field level rule supports overflow. Generally, the IF rule does not support overflow but it can be supported using the FieldRule procedure. See the examples for this procedure for more information.

Note All semicolons in a field level rule must be replaced with two colons (::). If any of your parameters contain quotation marks ( " ), use apostrophes ( ' ) instead.

Here is a list of parameters for this procedure with sample entries. The entries illustrate the following example. An asterisk indicates the parameter is generally required, depending on the rule you are using.

Parameter

Description

Example

File number

* (required by TblLkUp)

0

Record number

* (required for overflow)

1

Source field name

* (required by TblText)

Town_State

Source field offset

*

55

Source field length

*

9

Destination field name

*

Rec-Town_State

Destination field offset

*

0

Destination field length

*

25

Format mask

*

blank

Field rule name

*

KickToWip

Rule parameters

* (also called data)

blank

Flag1

(also called not required)

N

Flag2

(also called host required)

N

Flag3

(also called operator required)

Y

Flag4

(also called either required)

N

X position

 

3001

Y position

 

5602

Font ID

 

11010

Example

For example, suppose you want the transaction sent to WIP when the record PRODAREC, at offset 11, contains a string of four characters ("0000") starting at position 20. And, you always want the system to get 25 characters of data from PRODAREC, starting at position 65. Furthermore, you want the system to remove any trailing spaces.

For this scenario, you would use the FieldRule procedure to call the KickToWIP field level rule and use the standard IF rule to do the rest. The script for this example would look like this:

::A={11,PRODAREC 20,4}::B={11,PRODAREC 65,25}:: IF(A='0000')::

FieldRule("::0::1::Town_State::55:9::;Rec-Town_State::0::25::::

KickToWip::::N::N::Y::N::3001::5602::11010::")::Else::B=Trim(B)::

Return("^" & B & "^")::End::Return("^" & 1 & "^");

Here is another example:

Suppose you want to move multiple lines of text from N number of specific external extract records to the output buffer when the HEADERREC record (at offset 11) contains an F in position 1.

For this scenario, you could use the FieldRule procedure to call the MoveExt rule and use the standard IF rule to do the rest. The script for this example would look like this:

CON={11,HEADERREC 1,1}:: A=FIELDRULE("::0::1::E::45::4::PREM/OPS RATE1::0::4::::moveext::@GETRECSUSED,QCPVR5,OVSYM1/11,CLSSCDREC::N::N::N::N::::::::")::if(CON='F')::return("^" & A & "^")::end ;N;N;Y;N;12461;2119;16010

See also