Unix command for clearing datastage job logs.

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
jpradeep.net
Participant
Posts: 21
Joined: Mon Jul 12, 2010 2:05 am
Location: India

Unix command for clearing datastage job logs.

Post by jpradeep.net »

I built a script which ckecks the status for all datastage jobs in a project and clears the log if the status of the job is successful. I used the "CLEAR.FILE RT_LOG" $project_name $job_name which is throwing an error as "Unable to clear file RT_LOG." I heard that CLEAR.FILE command resets the auto purge properties for the job which we want to clear the log.Can anyone help me by providing the command for clearing the job log with out resetting the auto purge properties?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You are missing the job number from the clear command. Each job has a unique number assigned to it that all of the internal structures are tagged with:

CLEAR.FILE RT_LOG1234

You can get the number by querying DS_JOBS:

Code: Select all

SELECT JOBNO FROM DS_JOBS WHERE NAME = 'YourJobName';
I'm not aware of any command to purge logs without losing the auto-purge values.
-craig

"You can never have too many knives" -- Logan Nine Fingers
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

I still use this command to get the job ID:

Code: Select all

LIST DS_JOBS WITH @ID=job_name
Choose a job you love, and you will never have to work a day in your life. - Confucius
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Or that. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

It's less to type. :idea:

And a word of caution: Don't run DELETE.FILE accidentally or you will have damage to repair. :!:
Choose a job you love, and you will never have to work a day in your life. - Confucius
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Thanks Eric.
going forward i will use this:

Code: Select all

LIST DS_JOBS WITH @ID=job_name
pandeeswaran
Post Reply