AS400 VBScript / memory question
Posted on 2005-03-07
I have a question about the vbscripts for AS400, specifically the memory they use.
I have a script that requests some files from the Real Vision Report Manager, sends them to an outq, copies them to PCDownload, then deletes them from the outq. It does this for 9 different RVI reports.
This is KILLING my memory. The swap file keeps getting increased, and I have to close all other applications. I watch the memory usage in the task manager just increase quickly while using it (when loading as400 it says the mem usage is 147000K / 631484K, within about 30 seconds its at 500000K.
I put in a few msgbox's into my code to see where the main memory killer is, and it seems to be in 2 portions of code that kill it the most, waitforinputready and searchtext.
The first is " auteclsession.autecloia.WaitForInputReady". I use this a lot, as I have to wait until the system can accept input before I move on to the next. Each time this is run, it looks like its using about 2mb of memory, and its not clearing out until the script is done running. Is there a better alternative for this?
The second is SearchText, which I use while the system is pulling the reports from RVI. This is the main memory hog, as each iteration through the following loop adds about 2mb of memory to the mem usage:
do until auteclsession.auteclps.searchtext("Image Inquiry Selection Screen")
I first had the waitforforintputready(1) line in there, but after I realized that it just increased the mem usage that much more, I REM'ed it out. Still uses the memory.
Is there a better alternative for this as well? I tried using waitforappavailable and just waitforinputready, but the loading screen for these reports doesnt make the application busy, so waitforappavailable and waitforinputready won't work.
As this loop can often take 1-2 minutes to load all the related reports, my virtual memory is just destroyed at the end, until I close out of the emulator. Then it resets the mem used back to normal.