0

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...

2 Answers2

3

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).

Simon Sobisch
  • 6,263
  • 1
  • 18
  • 38
  • I understand now why I cannot use numerals (88 = only alphanumeric), thank you. Ok regarding style, but seems a lot easier just using VALUE "Y" then ALL HIGH VALUES (takes more space). Ok, so you mean I could do: 88 EndOfStudentFile VALUE "All students were processed" ? – Cult of Tranquility Dec 17 '20 at 11:14
  • 1
    That would work if `StudentRecord is long enough` (as long as you don't access the numeric fields possibly contained in the record). But both `Y` and `All students...` would not serve the _possible_ "`START key >= student-id` should not result in more data" purpose. – Simon Sobisch Dec 17 '20 at 11:23
0

Just to clarify '88' levels do not represent real storeage. They are conditionals which refer to the immediately preceding variable definition.

So:

If EndOfStudentFile..

is just as shortcut for

If StudentRecord is equal to High-Values...
James Anderson
  • 27,109
  • 7
  • 50
  • 78