Validation and execution
The input data is processed, output is generated, and saved for the specified data
source, on successful validation and execution of the macro.
These are the execution rules:
- The status of the macro job is set to Error and an error log is displayed in the Job Manager, if an error occurs during the execution of the macro job.
- The status of the macro job is set to Warning and a discarded log is displayed in the Audit Log entry, if an exception occur during the execution of the macro job.
- The status of the macro job is set to Completed, if there is no
exception or warning during the execution of the macro job.Note: Errors and Warnings are logged in the Audit Log as an attached Log file for the script run.
- The input data is prepared for the script code as follows, for each ‘input’ entry in
script mappings:
- If ‘table’ is used in the mapping, the script code is provided with all records and columns from the specified table as a file, including the input file name.
- If 'query' is used in the mapping:
- The application variables in the specified query are replaced with actual values.
- The script code is provided with all records and columns from the specified query as a file including the input file name.
- The output data is generated for each ‘output’ entry in the script mappings by the script
code. The output data is saved in SCV as follows:
- When ‘delete_mode’ is set to ‘Physical’ and ‘delete_condition’ is not used in the
mapping, the existing records in the specified SCV table are deleted using this command:
DELETE FROM <table>
- When ‘delete_mode’ is set to ‘Physical’ and ‘delete_condition’ is used in the mapping,
the existing records in the specified SCV table are deleted using this
command:
DELETE FROM <table> WHERE <delete_condition>
- When ‘update_mode is set to ‘Insert’ in the mapping, the output data in the specified
output file is saved in the specified SCV table using this command:
INSERT INTO <table> ... (records from the specified output file, including only the columns available in the output file) Following control columns are always set in <table>: created_by = "SCRIPT:" + <current script name> creation_time = <current timestamp in UTC> modified_by = "SCRIPT:" + <current script name> modification_time = <current timestamp in UTC>
- When ‘update_mode’ is set to ‘Merge’ in the mapping, the output data in the specified
output file is saved in the specified SCV table using this
command:
The PK columns of the specified table are retrieved from the corresponding PK constraint definition in SCV for the table MERGE INTO <table> USING ... (records from the specified output file, including only the columns available in the output file)ON <PK columns on table> When an existing record is updated by the MERGE: Any columns that are not included in the output file remain unchanged Following control columns are always set in <table>: modified_by = "SCRIPT:" + <current script name> modification_time = <current timestamp in UTC> When a new record is inserted by the MERGE: Following control columns are always set in <table>: created_by = "SCRIPT:" + <current script name> creation_time = <current timestamp in UTC> modified_by = "SCRIPT:" + <current script name> modification_time = <current timestamp in UTC>
Note: The system defined macro has no restrictions to the status of cycle period, scenario or planning engine during execution of the macro. - When ‘delete_mode’ is set to ‘Physical’ and ‘delete_condition’ is not used in the
mapping, the existing records in the specified SCV table are deleted using this command: