mschedule.exe takes up all CPU
Moderators: JRL, Dorian (MJT support)
mschedule.exe takes up all CPU
I have a few scripts that run on a daily basis 24/7. There is one that I am having problems with. This script chews up all the CPU and after a few minutes the program quits (MS). Any help will be greatly appreciated.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
HEre is the script
Label>Begin
'Begins process by first checking for a log file. Shows information, last update, version etc.
IfFileExists>%Path_Log_File%,MoveLog
Goto>StartLog
Label>MoveLog
'If Log Files are found it copies logs to ARCH directory and
'deletes source log.
MoveFile>%Path_Log_File%,%Path_Log_File_Arch%
Message>Previous ecom.log moved to archive
Wait>2
Label>StartLog
WriteLn>%Path_Log_File%,%StartDate% %StartTime% The ECOMMOVE program is running. Version %Version%
Label>BeginMove
'Gets the sleeptime from the Ini file
ReadIniFile>%EcomIni%,Settings,CycleTime,SleepTime
IfFileExists>%PathFrom%file.ref,Connected
Goto>DisConnect
Label>Connected
IfFileExists>%PathFrom%*.TXT,EcomCopy
GetTime>Time
GetDate>Date
WriteLn>%Path_Log_File%,%Date% %Time% No new Wholesale E-Commerce Files Found
Message>No new Wholesale E-Commerce Files Found
Wait>1
Goto>EcomCred
Label>EcomCopy
'This copies the Ecommerce files from T:\SQL70DEV to K:\APPS\WSL_TEST, writes to the log
GetFileList>%PathFrom%*.txt,files
Separate>files,;,file_names
Message>Num of Loan Application Files:%file_names_count%
WriteLn>%Path_Log_File%,%Date% %Time% Now Moving %file_names_count% Wholesale E-Commerce loan applications
wait>1
Let>k=0
Repeat>k
Let>k=k+1
Message>file_names_%k%
Wait>1
DateStamp>%Path_Log_File%,file_names_%k%
MoveFile>file_names_%k%,%PathDestination%
IfFileExists>file_names_%k%,NoMove
Goto>FileMoved
Label>NoMove
GetTime>Time
GetDate>Date
WriteLn>%Path_Log_File%,%Date% %Time% File Not Successfully Moved
Message>File Not Successfully Moved
SMTPSendMail>%Recipients%,%MailIP%,[email protected],Ecommerce Process,%Subject1%,%Body1%,
Goto>Done
Label>FileMoved
GetTime>Time
GetDate>Date
WriteLn>%Path_Log_File%,%Date% %Time% Loan Application File Successfully Moved
Message>Loan Application File Successfully Moved
Wait>1
Let>MoveCounter=MoveCounter+1
Label>Done
Until>k,file_names_count
'This will begin the moving credit files from E-Commerce to K:\apps\uniform\credit.
Label>EcomCred
IfFileExists>%Credit_From%*.nci,MoveCred
GetTime>Time
GetDate>Date
WriteLn>%Path_Log_File%,%Date% %Time% No new E-Commerce Credit Files Found
Message>No new Wholesale E-Commerce Credit Files Found
Wait>1
IfFileExists>%PathDestination%*.txt,EcomImport
Goto>EndMove
Label>MoveCred
GetTime>Time
GetDate>Date
GetFileList>%Credit_From%*.NCI,files
Separate>files,;,file_names
Message>Number of Credit Files: %file_names_count%
WriteLn>%Path_Log_File%,%Date% %Time% Moving %file_names_count% wholesale E-Commerce credit files.
wait>1
Let>z=0
Repeat>z
Let>z=z+1
Message>file_names_%z%
Wait>1
DateStamp>Log_File,file_names_%z%
MoveFile>file_names_%z%,%Credit_Destination%
IfFileExists>file_names_%z%,CredNoMove
Goto>CredFileMoved
Label>CredNoMove
GetTime>Time
GetDate>Date
WriteLn>%Path_Log_File%,%Date% %Time% Credit File Not Successfully Moved
Message>Credit File Not Successfully Moved
SMTPSendMail>%Recipients%,%MailIP%,[email protected],Ecommerce Process,%Subject1%,%Body2%,
Goto>Done
Label>CredFileMoved
GetTime>Time
GetDate>Date
DateStamp>%Path_Log_File%,file_names_%z%
WriteLn>%Path_Log_File%,%Date% %Time% Credit File Successfully Moved
Message>Credit File Successfully Moved
Wait>1
Let>CredCounter=CredCounter+1
Label>Done
Until>z,file_names_count
IfFileExists>%PathDestination%*.txt,EcomImport
Goto>EndMove
Label>EcomImport
'This handles the actual import into Uniform
Let>EcomCounter=EcomCounter+1
WriteLn>%Path_Log_File%,%Date% %Time% Checked For Files and Files were found.
WriteLn>%Path_Log_File%,%Date% %Time% Preparing to Run Uniform Import...
Run Program>L:\apps\uniform\rtiwin32.exe wsl_ecom /d=18
'MessageModal>Uniform is Running
wait>15
WaitWindowClosed>UNI-FORM Loan Processing
WriteLn>%Path_Log_File%,%Date% %Time% Uniform Import is complete.
Wait>1
Goto>EndMove
Label>EndMove
GetTime>TIME
MidStr>TIME,1,2,HH
MidStr>TIME,10,11,AMPM
ConCat>TIME_MIN,AMPM
If>AMPM=AM,SleepChk
IF>HH=12,SleepChk
If>HH>08,END
Label>SleepChk
If>SleepTime=0,BeginMove
Let>SleepTime=SleepTime-1
Message>Countdown Until Next Import %SleepTime% Imported %EcomCounter% Times Moved %MoveCounter% Import Files Moved %CredCounter% Credit Files Since %StartDate% %StartTime%
Wait>1
Goto>SleepChk
Goto>BeginMove
'Begins process by first checking for a log file. Shows information, last update, version etc.
IfFileExists>%Path_Log_File%,MoveLog
Goto>StartLog
Label>MoveLog
'If Log Files are found it copies logs to ARCH directory and
'deletes source log.
MoveFile>%Path_Log_File%,%Path_Log_File_Arch%
Message>Previous ecom.log moved to archive
Wait>2
Label>StartLog
WriteLn>%Path_Log_File%,%StartDate% %StartTime% The ECOMMOVE program is running. Version %Version%
Label>BeginMove
'Gets the sleeptime from the Ini file
ReadIniFile>%EcomIni%,Settings,CycleTime,SleepTime
IfFileExists>%PathFrom%file.ref,Connected
Goto>DisConnect
Label>Connected
IfFileExists>%PathFrom%*.TXT,EcomCopy
GetTime>Time
GetDate>Date
WriteLn>%Path_Log_File%,%Date% %Time% No new Wholesale E-Commerce Files Found
Message>No new Wholesale E-Commerce Files Found
Wait>1
Goto>EcomCred
Label>EcomCopy
'This copies the Ecommerce files from T:\SQL70DEV to K:\APPS\WSL_TEST, writes to the log
GetFileList>%PathFrom%*.txt,files
Separate>files,;,file_names
Message>Num of Loan Application Files:%file_names_count%
WriteLn>%Path_Log_File%,%Date% %Time% Now Moving %file_names_count% Wholesale E-Commerce loan applications
wait>1
Let>k=0
Repeat>k
Let>k=k+1
Message>file_names_%k%
Wait>1
DateStamp>%Path_Log_File%,file_names_%k%
MoveFile>file_names_%k%,%PathDestination%
IfFileExists>file_names_%k%,NoMove
Goto>FileMoved
Label>NoMove
GetTime>Time
GetDate>Date
WriteLn>%Path_Log_File%,%Date% %Time% File Not Successfully Moved
Message>File Not Successfully Moved
SMTPSendMail>%Recipients%,%MailIP%,[email protected],Ecommerce Process,%Subject1%,%Body1%,
Goto>Done
Label>FileMoved
GetTime>Time
GetDate>Date
WriteLn>%Path_Log_File%,%Date% %Time% Loan Application File Successfully Moved
Message>Loan Application File Successfully Moved
Wait>1
Let>MoveCounter=MoveCounter+1
Label>Done
Until>k,file_names_count
'This will begin the moving credit files from E-Commerce to K:\apps\uniform\credit.
Label>EcomCred
IfFileExists>%Credit_From%*.nci,MoveCred
GetTime>Time
GetDate>Date
WriteLn>%Path_Log_File%,%Date% %Time% No new E-Commerce Credit Files Found
Message>No new Wholesale E-Commerce Credit Files Found
Wait>1
IfFileExists>%PathDestination%*.txt,EcomImport
Goto>EndMove
Label>MoveCred
GetTime>Time
GetDate>Date
GetFileList>%Credit_From%*.NCI,files
Separate>files,;,file_names
Message>Number of Credit Files: %file_names_count%
WriteLn>%Path_Log_File%,%Date% %Time% Moving %file_names_count% wholesale E-Commerce credit files.
wait>1
Let>z=0
Repeat>z
Let>z=z+1
Message>file_names_%z%
Wait>1
DateStamp>Log_File,file_names_%z%
MoveFile>file_names_%z%,%Credit_Destination%
IfFileExists>file_names_%z%,CredNoMove
Goto>CredFileMoved
Label>CredNoMove
GetTime>Time
GetDate>Date
WriteLn>%Path_Log_File%,%Date% %Time% Credit File Not Successfully Moved
Message>Credit File Not Successfully Moved
SMTPSendMail>%Recipients%,%MailIP%,[email protected],Ecommerce Process,%Subject1%,%Body2%,
Goto>Done
Label>CredFileMoved
GetTime>Time
GetDate>Date
DateStamp>%Path_Log_File%,file_names_%z%
WriteLn>%Path_Log_File%,%Date% %Time% Credit File Successfully Moved
Message>Credit File Successfully Moved
Wait>1
Let>CredCounter=CredCounter+1
Label>Done
Until>z,file_names_count
IfFileExists>%PathDestination%*.txt,EcomImport
Goto>EndMove
Label>EcomImport
'This handles the actual import into Uniform
Let>EcomCounter=EcomCounter+1
WriteLn>%Path_Log_File%,%Date% %Time% Checked For Files and Files were found.
WriteLn>%Path_Log_File%,%Date% %Time% Preparing to Run Uniform Import...
Run Program>L:\apps\uniform\rtiwin32.exe wsl_ecom /d=18
'MessageModal>Uniform is Running
wait>15
WaitWindowClosed>UNI-FORM Loan Processing
WriteLn>%Path_Log_File%,%Date% %Time% Uniform Import is complete.
Wait>1
Goto>EndMove
Label>EndMove
GetTime>TIME
MidStr>TIME,1,2,HH
MidStr>TIME,10,11,AMPM
ConCat>TIME_MIN,AMPM
If>AMPM=AM,SleepChk
IF>HH=12,SleepChk
If>HH>08,END
Label>SleepChk
If>SleepTime=0,BeginMove
Let>SleepTime=SleepTime-1
Message>Countdown Until Next Import %SleepTime% Imported %EcomCounter% Times Moved %MoveCounter% Import Files Moved %CredCounter% Credit Files Since %StartDate% %StartTime%
Wait>1
Goto>SleepChk
Goto>BeginMove
Last edited by ncentech on Mon Oct 18, 2004 3:03 pm, edited 1 time in total.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Haven't looked at all of script yet, but you need to add "\" to PathFrom
The RED line will fail every time.
Change From:
I usually do not include "\" in my Path variables. I prefer to include the "\" each time needed in the following scripts, because it makes it visually easier to read with the "\" there as a separator. But this is personal work habit. You should always "use your favorite method" when there are multiple "correct" solutions.
The RED line will fail every time.
And looking at Label>DisConnect it appears that you may be in a loop for %MaxTry% attempts.Label>BeginMove
'Gets the sleeptime from the Ini file
ReadIniFile>%EcomIni%,Settings,CycleTime,SleepTime
IfFileExists>%PathFrom%file.ref,Connected
Goto>DisConnect
Change From:
Change To:Let>PathFrom=t:
=============================Let>PathFrom=t:\
I usually do not include "\" in my Path variables. I prefer to include the "\" each time needed in the following scripts, because it makes it visually easier to read with the "\" there as a separator. But this is personal work habit. You should always "use your favorite method" when there are multiple "correct" solutions.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Yes I have but it still fails
It looks like after it has nothing to move or process it starts looking for more files to move or process and if there is nothing in the directories ms keeps looking and it locks up and quits after a while. I then have to start ms again.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Just a few questions.
1. Did you make the change(s) to add the missing "\" characters as I pointed out a few days ago?
If Yes, do you now get different symptoms? If YES, what are they? If NO, go to step 2.
If NO, you did not add the backslashes, please do that first. Then return to step 1 again.
2. Since making those changes results in no difference in symptoms, I would ask if you have looked at a log to see where it is getting hung up? If no log exists, then create one using the macro's properties. Provide copy of log here for last time it ran if you cannot make sense of what is happening. While waiting for forum response, go to Step 3.
3. If you cannot see the problem from the log, then, have you tried to single step through the macro, looking at the values of the variables in the Watch List?
Doing steps 1,2,3 in that sequence should help to focus in on the actual code that is causing your problem, IF in fact it is a coding problem.
1. Did you make the change(s) to add the missing "\" characters as I pointed out a few days ago?
If Yes, do you now get different symptoms? If YES, what are they? If NO, go to step 2.
If NO, you did not add the backslashes, please do that first. Then return to step 1 again.
2. Since making those changes results in no difference in symptoms, I would ask if you have looked at a log to see where it is getting hung up? If no log exists, then create one using the macro's properties. Provide copy of log here for last time it ran if you cannot make sense of what is happening. While waiting for forum response, go to Step 3.
3. If you cannot see the problem from the log, then, have you tried to single step through the macro, looking at the values of the variables in the Watch List?
Doing steps 1,2,3 in that sequence should help to focus in on the actual code that is causing your problem, IF in fact it is a coding problem.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
A few observations:
No where in your script (looking at earlier submission) do you calculate TIME_MIN.
So this line will give wrong results:
ConCat>TIME_MIN,AMPM
Don't know if that is a problem. Script should not hang here because of that, it will just stuff in %TIME_MIN% and continue.
------------------------------------------
Also did not see a label for END
------------------------------------------
Can you provide that section of the log where you say it is failing?
No where in your script (looking at earlier submission) do you calculate TIME_MIN.
So this line will give wrong results:
ConCat>TIME_MIN,AMPM
Don't know if that is a problem. Script should not hang here because of that, it will just stuff in %TIME_MIN% and continue.
------------------------------------------
Also did not see a label for END
------------------------------------------
Can you provide that section of the log where you say it is failing?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!