COBOL level 88 data type

无人久伴 提交于 2019-12-06 07:30:11

Assuming I understand the question being asked.

It would help if you could give an example with a COBOL layout and data glossary entry one with and one without an 88 entry. However, I'll do my best to try to answer the question.

No, 88 level entries are not variables and they do not increase or decrease the length of the record. They simply allow you to create a conditional statement.

With that being said should your data glossary only include variables that contribute to the length of the record?

If yes then there shouldn't be a separate data glossary entry per 88 item. However, it might help to explain a given variable's value[s] (3 and maybe 5 or even an extra line for expected values).

01 record-store.
 02 location pic 9(4).
   88 dist-center value 100, 101, 102.
 02 value    pic 9(6).
 02 paid     pic X(1).
   88 yes value 'Y', 'y'.
   88  no value 'N', 'n'.

Your data glossary would/could be:

location

  • Name: location
  • Data Types: integer
  • Range of Value: 0-9999
  • Line Numbers: 20
  • Fuller name: location of the data
  • Expected Values:
    • 100, 101, 102 for distribution centers
    • 1-99 for customers
    • 103-9999 invalid

Now knowing your expected values you might go back and change your 88 values?

...
 02 location pic 9(4).
   88 dist-center value 100, 101, 102.
   88 customers   value 1 thru 99.
   88 invalid     value 0, 103 thru 9999.
...    

If no then:

You could have a separate data glossary entry pre 88 level entry.

Your data glossary would/could be:

location

  • Name: location
  • Data Types: integer
  • Range of Value: 0000-9999
  • Line Numbers: 20
  • Fuller Name: The location of the data

dist-center

  • Name: dist-center
  • Data Types: boolean
  • Range of Value: 100, 101, 102
  • Line Numbers: 5
  • Fuller Name: Is location is a distribution center

customer

  • Name: customer
  • Data Types: boolean
  • Range of Value: 1-99
  • Line Numbers: 5
  • Fuller Name: Is location a customer

invalid

  • Name: invalid
  • Data Types: boolean
  • Range of Value: 0001, 0010, 0100
  • Line Numbers: 5
  • Fuller Name: Is location an invalid value

As usual, it depends. :-)

The level 88 values seem to belong under part 3 "Range of values", especially if they document the only values allowed for some variable.

The FILLER fields are of course important if the documentation is used to reconstruct the records. If you just want to document the usage of the other fields, they are not very interesting.

The 'PIC X' FILLER variables are probably flags in working storage with 88 levels, and therefore quite important.

For instance, we use this type of construct a lot:

01 FILLER                     PIC X.
    88 OPTION-IS-ON        VALUE 'Y', FALSE 'N'.
    88 OPTION-IS-OFF       VALUE 'N'.

This defines a flag which we only reference using it's conditions. For example we might use it like this:

SET OPTION-IS-ON TO TRUE.     | This puts a 'Y' in the PIC X
   .
   .
   .
IF OPTION-IS-ON
   do something
END-IF

In this case we never need to refer to the actual flag value itself, and hence you do not need to give it a name.

The 'FALSE' in the 88 level just allows you to specify what is stored when you use the statement:

SET OPTION-IS-ON TO FALSE     | This puts an 'N' in the PIC X

which of course is the same as saying:

SET OPTION-IS-OFF TO TRUE     | This also puts an 'N' in the PIC X

It all depends what is more readable at the time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!