Legend Report



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Legend Report

Postby fbryant2010 » Wed Oct 13, 2010 8:51 pm

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
fbryant2010
 
Posts: 20
Joined: Fri Oct 08, 2010 9:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Legend Report

Postby NicC » Wed Oct 13, 2010 10:25 pm

Loop through the results returned from DB2 assigning them to your print line. This should be a table rather than loads of individual variables. Write your print line after every 4 assignments or when you run out of data to assign.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Legend Report

Postby dick scherrer » Wed Oct 13, 2010 11:24 pm

Hello,

Why would you not use the same solution used for your other "legend" question. . . :?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Legend Report

Postby fbryant2010 » Thu Oct 14, 2010 12:42 am

Would the other legend solution handle if the table had more entries without having to change the program? If the table has more entries, I am trying not to change the program in order to update the legend.
fbryant2010
 
Posts: 20
Joined: Fri Oct 08, 2010 9:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Legend Report

Postby NicC » Thu Oct 14, 2010 1:07 am

If you designed it right it will handle any number of entries and not a pre-determined number of entries.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Legend Report

Postby dick scherrer » Thu Oct 14, 2010 2:07 am

Hello,

How often does the legend info receive new entries?

If the current usage is 15 entries, allow for up to 100. When 90 are used begin showing a warning that the legend array has reached 90% filled. Then add another 100 entries to the array.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Legend Report

Postby fbryant2010 » Thu Oct 14, 2010 2:12 am

What would the print legend look like?

Legend print line now. Up to 15 legend-code15

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)
fbryant2010
 
Posts: 20
Joined: Fri Oct 08, 2010 9:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Legend Report

Postby dick scherrer » Thu Oct 14, 2010 2:21 am

Hello,

In another loop. . . The individual 15 lines will no longer be used.

Move 1 array entry to the "print line" and write it.
Increment the array until the last item has been processed.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Legend Report

Postby fbryant2010 » Thu Oct 14, 2010 6:26 pm

I am not following you. I don't need the legend print lines?
fbryant2010
 
Posts: 20
Joined: Fri Oct 08, 2010 9:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Legend Report

Postby fbryant2010 » Thu Oct 14, 2010 6:29 pm

I have this so far.

01 WS-LEGEND-TABLES.
05 WS-LEGEND-ENTRIES OCCURS 15 TIMES.
10 WS-LEGEND-CODE PIC X(03).
10 FILLER PIC X(03) VALUE ' = '.
10 WS-LEGEND-DESC PIC X(30).
10 FILLER PIC X(03) VALUE ' '.

1 01 WS-LEGEND-TABLES
02 WS-LEGEND-ENTRIES
03 WS-LEGEND-CODE
SUB(1) 'CIG'
SUB(2) 'CTL'
SUB(3) 'EGG'
SUB(4) 'FEN'
SUB(5) 'PAC'
SUB(6) 'PDL'
SUB(7) 'PTL'
SUB(8) 'SBL'
SUB(9) 'STI'
SUB(10) 'STP'
SUB(11) 'TOB'

03 WS-LEGEND-DESC
SUB(1) 'Cigarettes '
SUB(2) 'Cigarette & Tobacco License # '
SUB(3) 'Egg License # '
SUB(4) 'FederalEmployerIdentification#'
SUB(5) 'Perishable Ag Commod Act # '
SUB(6) 'Plant Dealer License # '
SUB(7) 'Privilege Tax Lic # '
SUB(8) 'State Business License # '
SUB(9) 'State Tax Id # '
SUB(10) 'Sales Tax Permit # '
SUB(11) 'Tobacco License # '
fbryant2010
 
Posts: 20
Joined: Fri Oct 08, 2010 9:52 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post