Routines

Routines allow directives definitions to be reused. Once a definition has been written in a routine, it does not have to be written again – it can be called anywhere else within the directive file body. Routines make the directives code more readable and reusable. For a full example, see the Example Purge/Archive Directives File with Routines included with this guide.

The routine form:

[ROUTINE <routine name> <export body> END_ROUTINE]

Use the <routine name> value to name the routine. Enter the directives definitions in the <export body>. In the example below, the routine is named TO_ACT_ENTRY_THROUGH, and the export body is comprised of a to clause.

ROUTINE TO_ACT_ENTRY_THROUGH

TO act_entry THROUGH $1

ACTIONS = EXPORT,DELETE

END_TO

END_ROUTINE

To call a routine somewhere else in the directive file body, use the form:

<name> (parameters)

The <name> value specifies which routine to call. For the (parameters) value, list one or more parameters that can be passed to the routine being called. For example:

to_act_entry_through (subcase2act_entry)

Within the routine being called, the parameters being passed to it can be accessed using the $<number> substitution, where <number> refers to the order the parameters are listed. So, $1 would call the first parameter, $2 would call the second parameter, and so on.

In the following example, the routines TO_SUBCASE_THROUGH and TO_ACT_ENTRY_THROUGH are called in the EXPORT OBJECT body. When the routine TO_SUBCASE_THROUGH is called, case2subcase will be substituted for the $1. When the routine TO_ACT_ENTRY_THROUGH is called, case_act2act_entry will be substituted for the $1.

EXPORT OBJECT case

WHERE arch_id = 1

ACTIONS = EXPORT,DELETE

TO_SUBCASE_THROUGH(case2subcase)

TO_ACT_ENTRY_THROUGH(case_act2act_entry)

ROUTINE TO_SUBCASE_THROUGH

TO subcase THROUGH $1

ACTIONS = EXPORT,DELETE

TO_ACT_ENTRY_THROUGH(subcase2act_entry)

END_TO

END_ROUTINE

ROUTINE TO_ACT_ENTRY_THROUGH

TO act_entry THROUGH $1

ACTIONS = EXPORT,DELETE

END_TO

END_ROUTINE

See Also

Common Purge/Archive Directives Elements

Export Object

Uniques

Where

Actions

Stop Ifs

To Clauses

Conditional To Clauses

Next

Complete List of Purge/Archive Directives Elements

Routines