Example
Using the previous example as a baseline, increment a counter of the relative source record read and update a target field with the counter. This effectively puts the relative source record number into the target records.
-- Declare a 5 byte numeric variable COUNTER and initialize it to zero (0)
DECLARE V_COUNTER 5 ‘0’;
PROCESS INTO TARGET_DS
-- Store the COUNTER while incrementing it by 1
SELECT
{
V_COUNTER = INCREMENT(V_COUNTER)
V_EMP_NUM = EMPLOYEE_ID
V_EMPLOYEE_LNAME = EMPLOYEE_LNAME
TARGET_DS.RECORD_NO = V_COUNTER
}
FROM SOURCE_DS;