Synopsis
Archives job logs when the maximum number of current logs to retain is exceeded.
Description
Moves job-related logs from the current log tables (such as WS_WRK_AUDIT_LOG and WS_WRK_ERROR_LOG) to the corresponding archive log tables (such as WX_WRK_AUDIT_ARCHIVE and WX_WRK_ERROR_ARCHIVE) depending on the number of logs to retain.
When the maximum number of current logs to retain is exceeded the oldest logs are archived for the specified job(s) to reduce the number of current logs to the specified retention limit. For example, if 10 is specified then only the latest 10 logs are retained. If a retained count of 0 is specified then all the current logs are archived for the specified job(s).

Note

Equivalent functionality is available via a WhereScape RED Scheduler and the "Logs Retained" property of a job.

Input

Input

Description

Common Input

Includes all 5 inputs of the Callable Routines Common Input.

Job Name(s) to Archive

The name of the job(s) whose current logs are to be archived. Wild cards are supported. Specifying % will match ALL jobs.

Maximum Logs to Retain

The maximum number of logs to retain. When the maximum is exceeded, the oldest logs are archived to reduce the number of current logs to the specified retention limit.

Output

Output

Description

Return Code

Output Return Code:

  • S     Success.
  • E     Error.
  • F      Fatal/Unexpected Error.

Return Message

Output message indicating the action applied or the reason for no action.

Result Number

Output Result Number:

  • 1      Success.
  • -2     Error. e.g. Due to invalid job name or job not running.
  • -3     Fatal/Unexpected Error.

SQL Server

SQL Server Parameters: Ws_Job_Clear_Logs
Callable Routine Type: PROCEDURE.

Parameter Name

Datatype

Mode

@p_sequence

INTEGER

IN

@p_job_name

VARCHAR(64)

IN

@p_task_name

VARCHAR(64)

IN

@p_job_id

INTEGER

IN

@p_task_id

INTEGER

IN

@p_job_to_clean

VARCHAR(64)

IN

@p_keep_count

INTEGER

IN

@p_return_code

VARCHAR(1)

OUT

@p_return_msg

VARCHAR(256)

OUT

@p_result

INTEGER

OUT

SQL Server Examples: Ws_Job_Clear_Logs

– The p_ VARIABLES are normally PARAMETERS in a RED-generated Procedure.
DECLARE @p_sequence integer
DECLARE @p_job_name varchar(256)
DECLARE @p_task_name varchar(256)
DECLARE @p_job_id integer
DECLARE @p_task_id integer
DECLARE @p_return_msg varchar(256)
DECLARE @p_status integer
DECLARE @v_result_num integer
DECLARE @v_return_code varchar(1)
DECLARE @v_return_msg varchar(256)
EXEC Ws_Job_Clear_Logs
@p_sequence, @p_job_name, @p_task_name, @p_job_id, @p_task_id
, 'Daily Run', 10
, @v_return_code OUTPUT
, @v_return_msg OUTPUT
, @v_result_num OUTPUT

Teradata

Teradata Parameters: Ws_Job_Clear_Logs
Callable Routine Type: PROCEDURE.

Parameter Name

Datatype

Mode

p_sequence

INTEGER

IN

p_job_name

VARCHAR(64)

IN

p_task_name

VARCHAR(64)

IN

p_job_id

INTEGER

IN

p_task_id

INTEGER

IN

p_job_to_clean

VARCHAR(64)

IN

p_log_keep

INTEGER

IN

p_return_code

VARCHAR(1)

OUT

p_return_msg

VARCHAR(256)

OUT

p_result

INTEGER

OUT

Teradata Examples: Ws_Job_Clear_Logs

– The p_ VARIABLES are normally PARAMETERS in a RED-generated Procedure.
DECLARE p_sequence integer;
DECLARE p_job_name varchar(256);
DECLARE p_task_name varchar(256);
DECLARE p_job_id integer;
DECLARE p_task_id integer;
DECLARE p_return_msg varchar(256);
DECLARE p_status integer;
DECLARE v_result_num integer;
DECLARE v_return_code varchar(1);
DECLARE v_return_msg varchar(256);
CALL [METABASE].Ws_Job_Clear_Logs
( p_sequence, p_job_name, p_task_name, p_job_id, p_task_id
, 'Daily Run', 10
, v_return_code
, v_return_msg
, v_result_num
);

Oracle

Oracle Parameters: Ws_Job_Clear_Logs
Callable Routine Type: FUNCTION.

Parameter Name

Datatype

Mode

p_sequence

NUMBER

IN

p_job_name

VARCHAR2

IN

p_task_name

VARCHAR2

IN

p_job_id

NUMBER

IN

p_task_id

NUMBER

IN

p_job_to_clean

VARCHAR2

IN

p_log_keep

NUMBER

IN

p_return_code

VARCHAR2

OUT

p_return_msg

VARCHAR2

OUT

FUNCTION Return Value

NUMBER

OUT-Function

Oracle Examples: Ws_Job_Clear_Logs

– The p_ VARIABLES are normally PARAMETERS in a RED-generated Procedure.
p_sequence number;
p_job_name varchar2(256);
p_task_name varchar2(256);
p_job_id number;
p_task_id number;
p_return_msg varchar2(256);
p_status number;
v_result_num number;
v_return_code varchar2(1);
v_return_msg varchar2(256);
v_result_num := Ws_Job_Clear_Logs
( p_sequence, p_job_name, p_task_name, p_job_id, p_task_id
, 'Daily Run', 10
, v_return_code
, v_return_msg
);

DB2

DB2 Parameters: Ws_Job_Clear_Logs
Callable Routine Type: PROCEDURE.

Parameter Name

Datatype

Mode

p_sequence

INTEGER

IN

p_job_name

VARCHAR(64)

IN

p_task_name

VARCHAR(64)

IN

p_job_id

INTEGER

IN

p_task_id

INTEGER

IN

p_job_to_clean

VARCHAR(64)

IN

p_keep_count

INTEGER

IN

p_return_code

VARCHAR(1)

OUT

p_return_msg

VARCHAR(256)

OUT

p_result

INTEGER

OUT

DB2 Examples: Ws_Job_Clear_Logs

– The p_ VARIABLES are normally PARAMETERS in a RED-generated Procedure.
DECLARE p_sequence integer;
DECLARE p_job_name varchar(256);
DECLARE p_task_name varchar(256);
DECLARE p_job_id integer;
DECLARE p_task_id integer;
DECLARE p_return_msg varchar(256);
DECLARE p_status integer;
DECLARE v_result_num integer;
DECLARE v_return_code varchar(1);
DECLARE v_return_msg varchar(256);
CALL [METABASE].Ws_Job_Clear_Logs
( p_sequence, p_job_name, p_task_name, p_job_id, p_task_id
, 'Daily Run', 10
, v_return_code
, v_return_msg
, v_result_num
);


  • No labels