usage of 88 level under FILLER field

Viewed 72

Does it make sense to have 88 level under FILLER declaration, like in this code:

 10   FILLER   PIC X(02).
      88  SOME-NAME  VALUE 'XX'.

Can this field SOME-NAME be used in the program?

2 Answers

Yes, that makes totally sense. You may use this for:

  • only (or mostly) set / check by field condition-name - SET SOME-NAME TO TRUE and IF SOME-NAME; as Scott Nelson pointed out this is a good way to prevent use of "magic values"
  • have the value stored and somewhere referenced by the group field, most likely the 01 above your 10.
 10   WS-SOME-NAME-AREA PIC X(02).
      88  SOME-NAME     VALUE 'XX'.

If you give that area a name, it will not be long before some other programmer decides to do this:

 Move 'ZZ' to WS-SOME-NAME-AREA

Or maybe this, almost well intentioned, but still wrong:

 Move 'xX' to WS-SOME-NAME-AREA

And then your program will behave in wildly unpredictable ways.

So if you don't name the storage, they really have to work to mess up your condition names. Which is why I never name storage for condition names if I can at all help it.

Related