Ticket #200 ( Closed )

Short Description Changing value of Step within TELOOP not working?
Entered By: Michael - Charleston When: 1998-10-30 15:02:36 Build: 1.03.07A
Categories Type: Question   Department: Product   Category: SurferScript Functions
I have defined a TELOOP with an initial Step value of 1. Within the loop there is a TEIF statement that changes the Step value to 4 so that when a certain line is encountered on the mainframe screen, the loop will skip 4 lines down the screen to evaluate that line next. However, it does not seem to be working. I did a TESHOW to find out what row number and what the value of Step is when the loop quits and discovered that what's happening is that after the line defined in the TEIF statement is encountered - say it's line 14 - the loop evaluates the next line (line 15) and since that does not have the data expected (since it's on line 18) the loop quits. TESHOW reveals that the row number on exit is 15 though the value of Step is in fact 4.

What's going on?

Append By: WindSurfer  When: 1998-10-30 18:09:11  New Status: Pending Customer
Comment The TELOOP statement will always increment the active variable by the step defined in the TELOOP.

You can change this variable at any time, but the next time the logic hits the TELOOP, it will apply the fixed step amount.

So, maybe you need a step amount of 1 and change the variable to itself + 3 to get what you are looking for?

Don't forget compile-with-trace and view trace as a means of debugging this, also! It will show you everything that is happening...

Append By: Michael - Charleston  When: 1998-11-03 08:56:55  New Status: Pending IE
Comment Not sure how this helps me. If you are saying that "you can change this variable at any time, but the next time the logic hits the TELOOP, it will apply the fixed step amount," then I take this to mean every iteration of the loop will always increment the amount you defined Step to be in the initial TELOOP statement no matter what. So if I understand you correctly, if I defined Step=1 in the TELOOP statement, I could put the line Step=Step+10000 in the loop and it would still only increment by one! So what's the point of changing the value? But more importantly how do I get the loop to skip lines without a GOTO or SKIP-type of mechanism? I suppose I'm going to have to use a web of nested loops and if statements?
Append By: WindSurfer  When: 1998-11-03 09:46:41  New Status: Pending Customer
Comment Step is not a variable, it is an attribute of the TELOOP. For example:
<TELOOP Name="AtRow" First=5 Last=22 Step=1>
<TEIF Screen(Atrow, 1, 2)==" ">
 <TESET AtRow=AtRow+4>
<TESHOW "The thing is "+Screen(AtRow, 2, 30)>
In the above example, AtRow is the variable that is created and used in the loop. There actually is no variable named step. Another way to handle this is to also simply cover the internal portion of the loop with a TEIF on the current line being blank; if it is, then don't do anything and just let the loop increment until you "hit" something.