I am building a sequencer, which is controlled by the appearance of two files: PROCESSFILE.TXT indicates that the loop in the sequencer should invoke a batch job. ENDFILE.TXT indicates that the loop should end, and the sequencer also should end in a normal mode.
I doubt that it's possible using StartLoop and EndLoop activities, which is what you seem to be asking. The StartLoop activity only effects a counted loop or a "list of things" loop; it does not effect an uncounted loop, and this is where your proposed algorithm fails. I'm surmising that you also propose a Wait For File activity, with a small timeout, for ENDFILE.TXT. You may be able to design this as a loop with a large number of iterations, but you would then probably need a Terminator to get out of the loop.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
gpbarsky wrote: and the sequencer also should end in a normal mode.
What do you mean by normal mode?
Do you mean by just end and not continue processing ???
If you force abort the sequence job, it will abort. Not in a normal mode. You need to build your logic in such a way, so that it keeps checking for the arrival of ENDFILE.TXT after every piece of major processing, so that it braches away to stop further processing or continues.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Still doesnt make sense.
Say for example your job is inserting a few hunder thousand records into the database and your end file shows up, how do you want to handle that? You cannot just end the job without aborting it or sending an explicit stop request.
I dont think termiinating the job at the very instance is a good idea if you want a clean stop. My advice, wait for that piece of execution to finish and then stop the batch.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
He's not saying that my Guru friend. It is exactly what you are saying - process X files and in-between every iteration look for a file that says you should stop any further processing. Break out of the loop rather than going on to the next file...
-craig
"You can never have too many knives" -- Logan Nine Fingers
The DS process should be up from Monday to Friday, and it should be waiting for a file comming from SAP. The process of this file depends on the user decision. May be some days there's no file, and another days may be more than one file to process.
So, what I really need is to have the process waiting for the file to appear, from 8:00 AM to 8:00 PM.
I know that in BASIC code it very easy this, but I want to use a sequencer because it has good tools to achieve this.
The million question is how to stop the process al 8:00 PM, without having to press the "stop" button, and without having to use the "Terminator Activity".
So now, either the arrival of END file or arrival of 8 pm will terminate the sequence job.
Well i hate to break it to you but you will have to use some sort of Basic coding to achieve that.
Here's what i would do.
Within start loop and end loop have a wait for file activity that waits for the trigger file, once its found it braches over to the job you want to run, after its successful have a small routine that checks for either the presence of END file or time to cross 8pm. Either one of them is true your routine will return 1 else 0.
Depending upon return value you could start all over or terminate your sequence.
Terminating is not difficult, just branch it out to do something like , say for eg, branch it out to a routine activity to run UtilityMessageToLog(), or maybe a notification activity.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
I'll try what you are saying, but I'm not understanding why I cannot use the DSWaitForFile activity of the sequencer to check the existence of a file within a loop activity.
As Craig pointed out you can. But thats only part of your test, the second part is the time 8:00pm
I wrote a quick little routine for you. It checks for existence of end file and checks for time. If file exists or time equals or exceeds 8:00pm, it will return 1 else 0. Depending upon that you can branch your execution to continue forward or terminate gracefully.
Equate RoutineName to "isFileOrTimeOut"
EndFilePath = Arg1
FilePresnt = @FALSE
TimeOut = @FALSE
*Internal Time for 8:00pm
TimeLimit=72000
*Check for presence of End file
OpenSeq EndFilePath to endFile
On Error
Stop "Cannot open file:":EndFilePath
End Locked
FilePresent = @FALSE
End Then
CloseSeq endFile
FilePresent = @TRUE
End Else
FilePresent = @FALSE
End
*Check for 8:00pm
If (Time() => TimeLimit)
Then
TimeOut = @TRUE
END
*Return 1 if either end file is found or present time is equal
*or greater than 8:00pm
If (FilePresent OR TimeOut)
Then
Ans = @TRUE
END
Else
Ans = @FALSE
END
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.