Until statement fixed loop count

This question was posted on an unrelated topic, so I am reposting it as a new topic.

Fileglobal GS300
GS300 = 3
Field «DateRef»
FirstRecord
Loop
    Loop
        DownRecord
    Until 12
    If «DateRef» ≠ zeroblank(0)
        InsertRecord
    Endif
Until GS300

If this code worked in Panorama 6, that was a bug. The documentation states that the parameter to the until statement can be either 1) an integer, or 2) a formula. If a formula is given, the result of that formula is interpreted as a true/false value. In your example the value of GS300 will always be true, so the loop will always stop.

If you need to loop for a specific number of times based on a value in a variable, I suggest you use the new for statement.

Fileglobal GS300
GS300 = 3
Field «DateRef»
FirstRecord
for n,1,GS300
    Loop
        DownRecord
    Until 12
    If «DateRef» ≠ zeroblank(0)
        InsertRecord
    Endif
endloop

You can learn more about the for statement here: