I have created a report which includes a legend. The legend is fairly stable but the users can add to the legend code and descriptions as needed. How can I code it so I will not have to go in and change the program every time there is an addition/change? The legend is coming from a DB2 table.
TAX CODES AND THEIR MEANING
----------------------------
CIG = Cigarettes CTL = Cigarette & Tobacco License # EGG = Egg License #
FEN = FederalEmployerIdentification# PAC = Perishable Ag Commod Act # PDL = Plant Dealer License #
PTL = Privilege Tax Lic # SBL = State Business License # STI = State Tax Id #
STP = Sales Tax Permit # TOB = Tobacco License #
01 WS-VVD-TABLES.
05 WS-VVD-ENTRIES OCCURS 15 TIMES.
10 WS-VVD-CODE PIC X(03).
10 WS-VVD-DESC PIC X(30).
Legend print line.
05 LEGEND-LINE2.
10 LEGEND-CODE1 PIC X(3).
10 FILLER PIC X(3)
VALUE ' = '.
10 LEGEND-DESC1 PIC X(30).
10 FILLER PIC X(3)
VALUE ' '.
10 LEGEND-CODE2 PIC X(3).
10 FILLER PIC X(3)
VALUE ' = '.
10 LEGEND-DESC2 PIC X(30).
10 FILLER PIC X(3)
VALUE ' '.
10 LEGEND-CODE3 PIC X(3).
10 FILLER PIC X(3)
VALUE ' = '.
10 LEGEND-DESC3 PIC X(30).
10 FILLER PIC X(3)
Moving the table to the output before printing.
PERFORM TEST AFTER VARYING WS-VVD-SUB FROM 1 BY 1
UNTIL WS-VVD-CODE (WS-VVD-SUB) = '999'
MOVE WS-VVD-CODE(WS-VVD-SUB) TO LEGEND-CODE1
MOVE WS-VVD-DESC(WS-VVD-SUB) TO LEGEND-DESC1
ADD +1 TO WS-VVD-SUB
MOVE WS-VVD-CODE(WS-VVD-SUB) TO LEGEND-CODE2
MOVE WS-VVD-DESC(WS-VVD-SUB) TO LEGEND-DESC2
ADD +1 TO WS-VVD-SUB
MOVE WS-VVD-CODE(WS-VVD-SUB) TO LEGEND-CODE3
MOVE WS-VVD-DESC(WS-VVD-SUB) TO LEGEND-DESC3
ADD +1 TO WS-VVD-SUB
MOVE WS-VVD-CODE(WS-VVD-SUB) TO LEGEND-CODE4
MOVE WS-VVD-DESC(WS-VVD-SUB) TO LEGEND-DESC4
ADD +1 TO WS-VVD-SUB