SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Memory Usage and Job Logging

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Memory Usage and Job Logging
Author Message
Alan Johns



Joined: 07 Feb 2002
Posts: 2

Post Memory Usage and Job Logging Reply with quote

I run this job every 20 minutes. It's sole purpose is just to monitor when there are Invoice Batches open and write that information to the 24x7 job log. This thing (see code below) eats up memory resources like crazy and I have to restart the 24x7 process at least once every day or so. Sometimes 24x7 just hangs when I try to shut it down. I know what your going to say, "Run the job detached". However, when I run it detached, it will not update the 24x7 job log with start/stop times or anything. So that defeats the purpose. I have many SQL jobs running written in VB and this problem makes the automation very unreliable.

Two questions:
1. Is there something wrong with my code causing it not to properly release the memory when it's complete?
2. How can I update the job log from a detached process?

Any other thoughts or suggestions?

Thanks,
-Alan

VB Code:
Sub Main( )
' declare variables
Dim db_conn
Dim rec_set
Dim query
Dim invstatus
Dim JalStr

' open database connection
Set db_conn = CreateObject("ADODB.Connection")
Set rec_set = CreateObject("ADODB.Recordset")
query = "SELECT * FROM PUB.ARInvoiceBatch WHERE " & Chr(34) & "Batch-Status" & Chr(34) & "='Open'"
db_conn.open "Progress", "userid", "password"

' execute query
rec_set.open query, db_conn, 0,1
If NOT rec_set.EOF then

invstatus = "Open Batch: " & rec_set("Created-By") & " " & rec_set("Batch-Number")
Else

invstatus = "No Open Batches"
End if

rec_set.close
db_conn.close

JalStr ="LogAddMessageEx ""INFO"", 119, ""Invoice Batch Status"", """ & invstatus & """ " & vbCrLf
JALScript.Execute(JalStr)

Set db_conn = Nothing
Set rec_set = Nothing
Set query = Nothing
Set invstatus = Nothing
Set JalStr = Nothing

End Sub

Fri Aug 16, 2002 1:26 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7949

Post Re: Memory Usage and Job Logging Reply with quote

Yeah, detached. But you can make it a lot easier if you don't do tricky JALScript.Execute(JalStr) but simply write directly to the schedule.log file without calling JALScript.

To update the job log simply append your message to "INFO" & vbTab & "119" & vbTab & "Invoice Batch Status" & vbTav & invstatus & vbCrLf

: I run this job every 20 minutes. It's sole purpose is just to monitor when
: there are Invoice Batches open and write that information to the 24x7 job
: log. This thing (see code below) eats up memory resources like crazy and I
: have to restart the 24x7 process at least once every day or so. Sometimes
: 24x7 just hangs when I try to shut it down. I know what your going to say,
: "Run the job detached". However, when I run it detached, it will
: not update the 24x7 job log with start/stop times or anything. So that
: defeats the purpose. I have many SQL jobs running written in VB and this
: problem makes the automation very unreliable.

: Two questions: 1. Is there something wrong with my code causing it not to
: properly release the memory when it's complete?
: 2. How can I update the job log from a detached process?

: Any other thoughts or suggestions?

: Thanks,
: -Alan

: VB Code: Sub Main( )
: ' declare variables
: Dim db_conn
: Dim rec_set
: Dim query
: Dim invstatus
: Dim JalStr

: ' open database connection
: Set db_conn = CreateObject("ADODB.Connection")
: Set rec_set = CreateObject("ADODB.Recordset")
: query = "SELECT * FROM PUB.ARInvoiceBatch WHERE " & Chr(34)
: & "Batch-Status" & Chr(34) & "='Open'"
: db_conn.open "Progress", "userid", "password"

: ' execute query
: rec_set.open query, db_conn, 0,1
: If NOT rec_set.EOF then

: invstatus = "Open Batch: " & rec_set("Created-By")
: & " " & rec_set("Batch-Number")
: Else

: invstatus = "No Open Batches"
: End if

: rec_set.close
: db_conn.close

: JalStr ="LogAddMessageEx ""INFO"", 119,
: ""Invoice Batch Status"", """ &
: invstatus & """ " & vbCrLf
: JALScript.Execute(JalStr)

: Set db_conn = Nothing
: Set rec_set = Nothing
: Set query = Nothing
: Set invstatus = Nothing
: Set JalStr = Nothing

: End Sub

Fri Aug 16, 2002 4:13 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.