clearing log files at one shot

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
major
Premium Member
Premium Member
Posts: 167
Joined: Mon Nov 26, 2007 12:21 am

clearing log files at one shot

Post by major »

Hi,

I have read somewhere that clear.&ph& command would clear all log files of a particular project at one shot, if executed at command line at datastage admin .

I tried in vain.Any suggestions about that command would be helpful
DS_SUPPORT
Premium Member
Premium Member
Posts: 232
Joined: Fri Aug 04, 2006 1:20 am
Location: Bangalore

Post by DS_SUPPORT »

CLEAR.&PH& wont clear the log files, as you are thinking.

For clearing the log file , you need to execute the command

Code: Select all

CLEAR.FILE RT_LOGXXX
where XXX is the job number. you can get the job number by querying DS_JOBS. but if you just execute this , it will clear your auto purge settings also.

For clearing the Job log, with preserving Auto Purge Settings, Our DS Masters have posted the routines already, Do a search in the forum.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

"CLEAR.FILE &PH&" simply clears that "phantom" directory in the attached project. There is no command to "clear all log files in one shot".
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

There was one on the ADN. It would take a while and each each job's log file. It might be on my tips page. If not then I could post it.
Mamu Kim
JeroenDmt
Premium Member
Premium Member
Posts: 107
Joined: Wed Oct 26, 2005 7:36 am

Post by JeroenDmt »

kduke wrote:There was one on the ADN. It would take a while and each each job's log file. It might be on my tips page. If not then I could post it.
Could you post it? I've been searching in dsxchange and found several references to the ADN one, but haven't been able to find any solution to clear all the log files in a project.
I don't see it on your tips page.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

-craig

"You can never have too many knives" -- Logan Nine Fingers
JeroenDmt
Premium Member
Premium Member
Posts: 107
Joined: Wed Oct 26, 2005 7:36 am

Post by JeroenDmt »

Thanks!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Be aware of what it is doing - getting a list of job numbers and issuing a CLEAR.FILE for each one in a loop, which means you'll lose all of your auto purge information. However, there is another Ken Bland utility out there to set them all as well. Not 'preserve' but set.
-craig

"You can never have too many knives" -- Logan Nine Fingers
JeroenDmt
Premium Member
Premium Member
Posts: 107
Joined: Wed Oct 26, 2005 7:36 am

Post by JeroenDmt »

Do you accidentally know where to find that one?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Accidentally? As a matter of fact...

viewtopic.php?t=106690

:D
-craig

"You can never have too many knives" -- Logan Nine Fingers
JeroenDmt
Premium Member
Premium Member
Posts: 107
Joined: Wed Oct 26, 2005 7:36 am

Post by JeroenDmt »

Great! Thanks :D
sbass1
Premium Member
Premium Member
Posts: 211
Joined: Wed Jan 28, 2009 9:00 pm
Location: Sydney, Australia

Post by sbass1 »

(May as well just add to this thread rather than starting a new one)

So I read this thread, and also
viewtopic.php?t=82586, and
viewtopic.php?t=106690

See also
viewtopic.php?t=128396&highlight=

Plagiarizing from viewtopic.php?t=82586 above, I've written this simple routine:

Code: Select all

TCL = "CLEAR.FILE RT_LOG" : pJobNumber
Call DSExecute("TCL", TCL, ScreenOutput, SystemReturnCode) 
Ans = ScreenOutput : @VM : SystemReturnCode
Using the same approach as in viewtopic.php?t=128396&highlight= to loop over the jobs in the project, I can clear the desired logs in the project. Further enhancements are parsing the Ans text to write to the log or sequential file, etc.

However, I read this also deletes auto purge settings, etc.

Is there a better way, or is this best practice to, as the subject says, "clear logs files in one shot"?

Thanks,
Scott
Some people are the Michael Jordan's of Datastage. I'm more like Muggsy Bogues :-)
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I just spent weeks writing a program which manages log files - you can choose whether by date, or runs or number of log entries and it cleans up broken multi-instance and job run data plus it reorganizes remaining data and performs other housekeeping. Entries removed are archived to an Oracle database. All this work because this site doesn't want to lose log entries. The CLEAR.FILE approach works quite well and is fast and efficient. If you wanted to be clean, you could read or copy the //PURGE.SETTINGS record prior to clearing the file and then writing it back to the new and pristine log file. The other control records in the log file, "//SEQUENCE.NO" and "//JOB.STARTED.NO" don't need to be kept if all of the log entries that they refer to are cleared.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Scott wrote:Is there a better way, or is this best practice to, as the subject says, "clear logs files in one shot"?
Use the auto-purge settings. Maybe with tighter rules than you currently have in place. That's what I'd regard as best practice.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sbass1
Premium Member
Premium Member
Posts: 211
Joined: Wed Jan 28, 2009 9:00 pm
Location: Sydney, Australia

Post by sbass1 »

ray.wurlod wrote:
Scott wrote:Is there a better way, or is this best practice to, as the subject says, "clear logs files in one shot"?
Use the auto-purge settings. Maybe with tighter rules than you currently have in place. That's what I'd regard as best practice.
Thanks Ray. I'm currently just using this utility in our DEV environment, where job creation is very dynamic, and the large logs (usually due to thousands of warnings) make reading the logs slow.

I'll ensure we set proper auto-purge settings for our PRD environment.
Some people are the Michael Jordan's of Datastage. I'm more like Muggsy Bogues :-)
Post Reply