Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

88 Level Entry

Status
Not open for further replies.

krimhild

Technical User
Jul 25, 2001
7
US
If I have this defined:
05 DAY-OF-WEEK PIC 9.
88 DAY-RANGE VALUES 1 THRU 7.
88 SUNDAY VALUE 1.
88 MONDAY VALUE 2.
88 TUESDAY VALUE 3.
88 WEDNESDAY VALUE 4.
88 THURSDAY VALUE 5.
88 FRIDAY VALUE 6.
88 SATURDAY VALUE 7.

Is it possible to move the day of the week to another field?
Ex. If the day-of-week is equal to 7 how do I move the word 'Saturday' to another field?
 
I would set up a table containing the names of the days and use DAY-OF-WEEK as a subscript into the table.

01 WEEK-TABLE-SETUP.
05 DAY-1 PIC X(09) VALUE 'SUNDAY '.
05 DAY-2 PIC X(09) VALUE 'MONDAY '.
05 DAY-3 PIC X(09) VALUE 'TUESDAY '.
05 DAY-4 PIC X(09) VALUE 'WEDNESDAY'.
05 DAY-5 PIC X(09) VALUE 'THURSDAY '.
05 DAY-6 PIC X(09) VALUE 'FRIDAY '.
05 DAY-7 PIC X(09) VALUE 'SATURDAY '.

01 WEEK-TABLE REDEFINES WEEK-TABLE-SETUP.
05 NAME-OF-DAY OCCURS 7 TIMES.
10 DAY-NAME PIC X(09).

IN PROC DIVISION

MOVE NAME-OF-DAY (DAY-OF-WEEK) TO I-WANT-NAME-HERE.


The 88 level setup allows you to test for a day by name,
ie IF SATURDAY ...

 
So you would use the table along with the 88 entries?
 
It depends on what you are trying to do. If you want to be able to test a condition by coding
IF SATURDAY
PERFORM something
then you could use the 88 levels to do that.

If you really only want to be able to take a number 1-7 and use it to plug in the name of the day, then you wouldn't need the 88 levels.
ie: MOVE NAME-OF-DAY (DAY-OF-WEEK) TO PRINT-LINE-FIELD
where you want to print the name of the day on a
report for example.
You would still use the field to hold the number, but you wouldn't need the 88 levels.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top