6. Manage an Action File Export

An action export defines which table or view is exported to which file with which export format. It is used by the export actions (export_mail, export_sftp, export_file).

Make sure that the export format exists: Create an Export Format.

6.1. Create an Action Export

Define the export with API_REDADM.ADD_APP_ACT_EXPORTS:

p_filename

Name of the target file. It may contain the placeholders @{bdate} (business date as YYYYMMDD), @{app_name}, @{run_id}, @{sysdate}, and @{systimestamp}.

p_where

Optional WHERE condition with the same placeholders. In the condition, @{bdate} is replaced by a date expression, so it can be compared with date columns directly.

p_skip_on_empty

If true, the export action is skipped if the export returns no rows.

The following example exports the rows of the view PSV_TEST_DR.TEST_TAB that are functionally valid on the business date of the action.

Example: Create the Export ‘test_exp’

1EXECUTE SCRIPT API_REDADM.ADD_APP_ACT_EXPORTS(
2    'test_exp'                                      -- p_exp_name
3   ,'test_fmt'                                      -- p_fmt_name
4   ,'PSV_TEST_DR'                                   -- p_obj_schema
5   ,'TEST_TAB'                                      -- p_obj_name
6   ,'@{bdate}_@{app_name}_export.csv'               -- p_filename
7   ,'@{bdate} BETWEEN BDATE_FROM AND BDATE_TO'      -- p_where
8   ,false                                           -- p_skip_on_empty
9);

The export is stored in REDADM.RED_APP_ACT_EXPORTS:

EXP_NAME

FMT_NAME

OBJ_SCHEMA

OBJ_NAME

FILENAME

WHERE_CLAUSE

SKIP_ON_EMPTY

test_exp

test_fmt

PSV_TEST_DR

TEST_TAB

@{bdate}_@{app_name}_export.csv

@{bdate} BETWEEN BDATE_FROM AND BDATE_TO

false

6.2. Modify an Action Export

Modify the export with API_REDADM.MODIFY_APP_ACT_EXPORTS. NULL leaves a parameter unchanged, while a blank (’ ‘) restores its default value.

Example: Skip Empty Exports

1EXECUTE SCRIPT API_REDADM.MODIFY_APP_ACT_EXPORTS(
2    'test_exp'    -- p_exp_name
3   ,null          -- p_fmt_name
4   ,null          -- p_obj_schema
5   ,null          -- p_obj_name
6   ,null          -- p_filename
7   ,null          -- p_where
8   ,true          -- p_skip_on_empty
9);

The entry in REDADM.RED_APP_ACT_EXPORTS has changed:

EXP_NAME

FMT_NAME

OBJ_SCHEMA

OBJ_NAME

FILENAME

WHERE_CLAUSE

SKIP_ON_EMPTY

test_exp

test_fmt

PSV_TEST_DR

TEST_TAB

@{bdate}_@{app_name}_export.csv

@{bdate} BETWEEN BDATE_FROM AND BDATE_TO

true

6.3. Remove an Action Export

To remove an action export, pass its name to API_REDADM.REMOVE_APP_ACT_EXPORTS.

Example: Remove the Export ‘test_exp’

1EXECUTE SCRIPT API_REDADM.REMOVE_APP_ACT_EXPORTS(
2    'test_exp'    -- p_exp_name
3);

The entry is removed from REDADM.RED_APP_ACT_EXPORTS.