I understand that HIGH-VALUES correspond to the highest in the collating sequence, however I do not understand why it may be a preferred method when using conditionals.
Example:
01 StudentRecord.
88 EndOfStudentFile VALUE HIGH-VALUES.
02 StudentID PIC X(7).
02 FILLER PIC X(23).
...
AT END SET EndOfStudentFile TO TRUE
Why not simply use VALUE 0 and SET EndOfStudentFile to 1 ?
Whats the advantage of using HIGH-VALUES in these cases?
Appreciate any input on this matter...
The conditional 88 in your example is for the StudentRecord
, so it sets/queries that. I think that it may be more appropriate to use VALUE ALL HIGH-VALUES
- as it stands it will set the first byte to HIGH-VALUE
and then pad the record (with spaces).
VALUE 0
/1
would not be possible for that as the record - because it is a group - is alphanumeric, and should not be assigned a numeric value.
... the question "is xyz preferred" is often more a question of style and only rarely "best practice". The commonly good thing is to ensure a consistent use/style so that others reading the code can understand it better.
In this specific case it could be used to "store" the information "all students were processed" which then can be queried later via IF EndOfStudentFile
and if for some reason there is another START >= StudentID
(I assume that is an ORGANIZATION INDEXED
file here) on the file it likely will not found "another" record (still possible here, a student with an id containing ALL HIGH-VALUE
would be found).