Tuesday, November 28, 2006

Break Logic: New concept to me

We were going over some pretty simple code today. It was basically setting up a point in the program to "break" and clean up sort of. I decided to post some of the code to better explain.

F#A // value

F@ // index

F@MAX const(20)// max for F@ index

P#A // value

P@ //index

P@MAX const(10)// max for P@ index

FOR F@ = 1 BY 1 TO F@MAX

IF F#N(F@) > *BLANK

EVAL P@ = P@ + 1

(Some processing code)

IF P@ = P@MAX

EXSR WriteToRecord_SR

EXSR ClrParams_SR

END

END

ENDSR

The program breaks here, however there may be some more parameters to write to record so.....

IF P@ > *ZERO

EXSR WriteToRecord_SR

END

So that is kind of the gist of it. This can be a fairly effective way of processing. In the past I might have just written after every process. This kind of incorporates a "batch" sort of processing. Like I said this is a new concept which I may not totally have a grasp of. I understand this is fairly standard practice. One of my previous instructors had mentioned how he had placed code to process like 10 records at a time instead of 1. This enabled an hour job to be cut to 5 minutes! I would be willing to bet he placed some sort of similar code to account for the remaining pieces to get processed.