Purging logs in Datastage using a UNIX Script

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

Purging logs in Datastage using a UNIX Script

Post by jpradeep.net »

Need a customized unix script to purge the log in data stage. The only condition is,if it is a successful job then the log must clear for just one day, If it is an aborted job, then the log must be fully cleared.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ok, which part do you need help with? For the first requirement, why not just let 'Auto Purge' handle that?
-craig

"You can never have too many knives" -- Logan Nine Fingers
jpradeep.net
Participant
Posts: 21
Joined: Mon Jul 12, 2010 2:05 am
Location: India

Post by jpradeep.net »

I want the script for the second part. that is for this condition "If it is a successful job then the log must be fully cleared, If it is an aborted job, then the log must clear for just one day."
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

jpradeep.net wrote:I want the script for the second part. that is for this condition "If it is a successful job then the log must be fully cleared, If it is an aborted job, then the log must clear for just one day."
Two points:

1. We'll be glad to help you write one, don't expect someone to just hand one to you.

2. You just completely reversed the requirement.

Aren't those requirements now equal? Meaning, if good runs clear the log what other days would exist in the log when the job fails? :?

Things to look into. Use dsjob with the -jobinfo option to check a job's status. And while there are options to display log information via dsjob (-logsum,-logdetail,-lognewest) there's no mechanism there to purge anything. For that you'll need to shell into the project in question using dssh and issue commands like CLEAR.FILE there. However, off the top of my head I'm not aware of any API to remove individual log entries.
-craig

"You can never have too many knives" -- Logan Nine Fingers
arvind_ds
Participant
Posts: 428
Joined: Thu Aug 16, 2007 11:38 pm
Location: Manali

Post by arvind_ds »

I am not sure but check the below one.

https://www-304.ibm.com/support/docview ... wg1JR30253
Arvind
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Interesting but that must be behaviour that was changed in 8.x:
When Auto-purging is in use, all instances of a job will be purged, without checking for the success or fail status.
Before 8 auto-purge only worked for successful runs.

Regardless, I have some concerns that it seems you want to remove information about a failed run automatically before anyone has a chance to see it. Is that the case?
-craig

"You can never have too many knives" -- Logan Nine Fingers
jpradeep.net
Participant
Posts: 21
Joined: Mon Jul 12, 2010 2:05 am
Location: India

Post by jpradeep.net »

:) I am sorry, for changing the requirement, but the second time posted is my exact requirement. Can you help me in that regard? I am new to unix and even dont know how to write a script.. So, it will be helpful for me a lot if you send that script to me....
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

Nothing can replace a good course in basic scripting. In the meantime, one of my best reference investments -- since I didn't expect to have much local help after I took that course -- is Unix in a Nutshell by Arnold Robbins, O'Reilly Media Inc. It looks like the fourth edition is still the most recent: http://shop.oreilly.com/product/9780596100292.do
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
Post Reply