Hello all!
I realize this isn't strictly a scripting question, but maybe you could give me advice on a better way to do this than I am now with scripts.
We have about a decades worth of old spooled files I need to delete and while I know there are some tools/commands that can do this, I have not been able to get them to work.
An example would be the DLTOLDSPLF, it only let's me specify files up to 999 days old and on top of that won't recognize where my reports are stored in SPYGLASS.
For now, I have a script that goes through this huge list of files marking everything for a certain year for deletion.
While it is quick, it is slow in comparison to how many reports we actually have.
My script prompts for 2 digit year, and I have it look for anything below that to be marked for deletion.
I have to do this in batches of roughly 1-2 months worth of reports which translates to maybe 200-300 reports, because AS400 will error out if I let it run too lot marking these reports with a 4 for Delete.
These batches are only as big as I feel when I should stop the script so AS400 does not crash.
I am barely in the mid 2005's when I need to delete all reports before 2012.
Doing it this way will be quite tedious.
Here is the script i'm currently using so maybe someone can tell me a better way to script it or if there is some command I can use instead.
It's also worth noting that I am excluding any Reports with PRT064 and PRT065.
Sub Main
'*****************************************************************************************************
' Set Variables
'*****************************************************************************************************
Dim DT as String, MR as String, CF as String, RetC as Integer, NA as String, N as String
Dim User_Name as String, WWR as String, YR as String, EX as String, NP as String, ND as String
SysHide "Timer"
EMConnect "Z"
'*****************************************************************************************************
' Prompt For Year
'*****************************************************************************************************
Title$ = "Filter"
Prompt$ = "Please Type 2 Year For Query"
Default$ = ""
X% = 100
Y% = 100
N = InputBox(Prompt$, Title$, Default$, X%, Y%)
'*****************************************************************************************************
' Main
'*****************************************************************************************************
Do
For i = 9 to 19
EMReadScreen MR, 4, 20, 72
EMReadScreen DT, 2, i, 68
EMReadScreen EX, 7, i, 7
If UCase(MR) = "More" and UCase(DT) < N then
GoSub Check
EMSendkey "<PAGE_DOWN>"
Else
Exit Do
End if
Next i
Loop
Exit Sub
'*****************************************************************************************************
' Subroutine to Check for Expired Spooled Files
'*****************************************************************************************************
Check:
For i = 9 to 19
EMReadScreen DT, 2, i, 68
EMReadScreen NA, 6, i, 7
EMReadScreen EX, 6, i, 7
If UCase(DT) < N and UCase(EX) = "PRT064" or UCase(NA) = "PRT065" then
EMWaitX 1, RetC
Elseif UCase(DT) < N then
EMSetCursor i, 4
EMWaitX 1, RetC
EMSendkey "4"
EMWaitX 1, RetC
End if
Next i
Return
'*****************************************************************************************************
' End
'*****************************************************************************************************
End Sub
#Rumba