Вопрос

I'm looking at some legacy programs, where code like the following is found:

C/free
    Dow 1=1;
        SubRoutine();
    EndDo;
    *INLR = *On;
/end-free

The program in question is a server-like program, where the sub routine handles incoming requests over the network. To me, it seems that the *INLR = *On statement will have no effect, but then again, my knowledge of RPG is severely limited, and this pattern repeats itself in several programs I'm looking at.

My question is thus: is the last line before /end-free unreachable and thus redundant?

Это было полезно?

Решение

You are correct, that in the example, as shown, there is no normal way to exit this loop. It appears tat this program will only end from an error or job cancellation. It is sometimes better to check %shutdown() in the main DOW, to allow a never ending job to close gracefully, but that was either not chosen, or not thought of, in this case.

I might speculate that the program was written by copying another, and that the *INLR line may have been left in the code as a conventional way of marking the end. So someone might argue that the line is harmless and could make it easier to understand that is the end.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top