CALL Function PROC |
Scroll |
The CALLPROC function invokes a predefined mapping procedure (PROC) within an Apply Engine script.
Category
Specialized
Syntax
CALLPROC(proc_name)
Parameter Descriptions
proc_name - The name of a mapping procedure (PROC) that was previously created using the CREATE PROC command.
Example
Assume that there are two (2) PROCs that contain different mapping logic based on the contents of a status (STATUS) in the source datastore records. These PROCs are defined as follows:
CREATE PROC MAP_CASE1 AS SELECT
{
TARGET_FIELD1 = SOURCE_FIELD1
TARGET_FIELD2 = SOURCE_FIELD2
}
FROM <source_datastore>;
CREATE PROC MAP_CASE2 AS SELECT
{
TARGET_FIELD1 = SOURCE_FIELD1 + SOURCE_FIELD3
TARGET_FIELD2 = ,ADD(SOURCE_FIELD2, SOURCE_FIELD4)
}
FROM CDCIN;
In the main SELECT subcommand, check the STATUS field in the source datastore. If the STATUS field is 'AAA' then call PROC MAP_CASE1 otherwise, call PROC MAP_CASE2 as shown below.
SELECT
{
IF STATUS = 'AAAA'
{
CALLPROC(MAP_CASE1)
}
ELSE
{
CALLPROC(MAP_CASE2)
}
FROM CDCIN;