PDA

View Full Version : Can this be streamplined to execute faster?



austenr
10-26-2006, 12:13 PM
I have passed this along to a couple of you but Zack suggested I post this and see what response I get.

This code reads against our mainframe and what it looks like it does is read a screen for data. There are 4 distinct loops. I am sure that the mainframe pulls the data from tables but cannot figure what tables they are getting them from. Worst case scenario, can this code be made to run cleaner and faster? Presently it takes over 5 hours to "scrape" the data. Does it have something to do as well with the server speed and traffic? Thanks in advance for any help.

XLGibbs
10-29-2006, 07:45 AM
Austen, as we discussed and after further reviews of the code, it is hard to say what can be done faster, since the code is pretty effective as is. It would seem the issue of time is more related to the host session response from the mainframe. Since none of us can actually execute the code to test anything, it would be fairly difficult to try and speed it up.

Nothing I saw in the code indicated a reason for slow execution, so it seems the mainframe response is the main issue.

XLGibbs
10-29-2006, 07:46 AM
PS, since the mainframe has tables of data, it would make more sense to get your hands on the actual tables then trying to screen scrape. Obviously this fellow who wrote this was trying to do it the hard way, even though it might have seemed the more direct route in his mind.

SamT
11-07-2006, 08:12 AM
I only went thru about 10% of the code, but here is a partial list of subs that contain loops that use a 1/2 second delay in EACH ITERATION of the loop.



HostSettleTime = 500 milisecondsEnd Sub

Sub Send_ENTER_Key()
CurSession.Screen.WaitHostQuiet(HostSettleTime)
End Sub

Sub Send_PF3_Key()
CurSession.Screen.WaitHostQuiet(HostSettleTime)
End Sub

Sub INITIALIZE()
msgbox "initialize"
End Sub

Sub DEINITIALIZE()
End Sub

Sub LOGON()
Do Until Mid(CurScreenTXT1, 1, Len("EMSP00")) = "EMSP00"
CurSession.Screen.Sendkeys("n003035<Tab>CMProd0")
Do Until Mid(CurScreenTXT1, 1, Len("EMSP01")) = "EMSP01"
Do Until Mid(CurScreenTXT1, 1, Len("IKJ56455I")) = "IKJ56455I"
Do Until Mid(CurScreenTXT1, 1, Len("USER MASTER APPLICATION MENU")) = "USER MASTER APPLICATION MENU" 'TSO MAIN SCREEN MENU
End Sub

Sub LOGOFF()
Do Until Mid(CurScreenTXT1, 1, Len("READY")) = "READY"
Do Until Mid(CurScreenTXT1, 1, Len("EMSP01")) = "EMSP01"
End Sub

Sub DELETE_DATASET()
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Confirm Dataset Delete")) = "File-AID Confirm Dataset Delete" 'File-AID Allocate, Delete Menu
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Dataset Utility")) = "File-AID Dataset Utility"
End Sub

Sub ALLOCATE_DATASET()
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Dataset Utility DUPLICATE DATASET NAME")) = "File-AID Dataset Utility DUPLICATE DATASET NAME" 'File-AID Allocate, Delete Menu
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Allocate New Seq/PDS Dataset")) = "File-AID Allocate New Seq/PDS Dataset" 'File-AID Allocate, Delete Menu
End Sub

Sub DELETE_COPYBOOK_DATASETS()
Do Until Mid(CurScreenTXT1, 1, Len("USER MASTER APPLICATION MENU")) = "USER MASTER APPLICATION MENU" 'TSO MAIN MENU
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Primary Option Menu")) = "File-AID Primary Option Menu" 'File-AID MAIN MENU
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Dataset Utility")) = "File-AID Dataset Utility" Do Until Mid(CurScreenTXT1, 1, Len("File-AID Primary Option Menu")) = "File-AID Primary Option Menu" 'File-AID MAIN MENU
Do Until Mid(CurScreenTXT1, 1, Len("USER MASTER APPLICATION MENU")) = "USER MASTER APPLICATION MENU" 'TSO MAIN SCREEN MENU
End Sub

Sub ALLOCATE_COPYBOOK_DATASETS()
Do Until Mid(CurScreenTXT1, 1, Len("USER MASTER APPLICATION MENU")) = "USER MASTER APPLICATION MENU" 'TSO MAIN SCREEN MENU
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Primary Option Menu")) = "File-AID Primary Option Menu" 'File-AID MAIN MENU
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Dataset Utility")) = "File-AID Dataset Utility"
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Primary Option Menu")) = "File-AID Primary Option Menu" 'File-AID MAIN MENU
Do Until Mid(CurScreenTXT1, 1, Len("USER MASTER APPLICATION MENU")) = "USER MASTER APPLICATION MENU" 'TSO MAIN SCREEN MENU
End Sub

Sub UPLOAD_A_DATASET()
Do Until Mid(CurScreenTXT1, 1, Len("USER MASTER APPLICATION MENU")) = "USER MASTER APPLICATION MENU" 'TSO MAIN MENU
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Primary Option Menu")) = "File-AID Primary Option Menu" 'File-AID MAIN MENU
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Dataset Utility")) = "File-AID Dataset Utility" 'File-AID Allocate, Delete Menu
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Primary Option Menu")) = "File-AID Primary Option Menu" 'File-AID MAIN MENU
CurScreenTXT1 = TxtStrEMPTY
Do Until Mid(CurScreenTXT1, 1, Len("USER MASTER APPLICATION MENU")) = "USER MASTER APPLICATION MENU" 'TSO MAIN SCREEN MENU
Do Until Mid(CurScreenTXT1, 1, Len("File-AID Primary Option Menu")) = "File-AID Primary Option Menu" 'File-AID MAIN MENU
End Sub


Sorry 'bout the staggering.

austenr
11-07-2006, 08:16 AM
Thanks.