Hi,
In my easytrieve report, 6 lines are printed out of which LINE2 to LINE6 print the details from an array.
------------------------------------------------------------------------------------------------------------------------------------------------------------
REPORT VENSUP-LST PAGESIZE 55 NOADJUST NODATE NOHEADING TALLYSIZE 2
SUMSPACE 2 PRINTER REPT1
SEQUENCE WS-VENDOR-NAME WS-VENDOR-ID
CONTROL FINAL NOPRINT WS-VENDOR-ID NOPRINT
TITLE 1 COL 1 'PO500-1' COL 10 SYSDATE COL 55 'VENDOR LIST '
TITLE 2 COL 1 'VEND-ID S'
COL 60 'TAX ID SETUP' COL 75 '----DISC--- --NET-- PS DISC'
COL 113 ' ----SHIP--- -INV-'
TITLE 3 COL 2 'CORP-ID'
COL 12 'VENDOR A/P NAME-ADDR NAME AND PO ADDRESS'
COL 55 'UPC SSN DATE PCT DYS CLC DYS CLC DL'
COL 99 'BD OR DIV BYR MTH FOB PM PR M PCT'
TITLE 4 COL 3 'BROKER'
LINE 1 COL 1 WS-VENDOR-ID COL 9 WS-VEN-SERV COL 12 WS-VEN-AP-NAME
COL 33 WS-VENDOR-NAME COL 54 WS-VEN-UPC
COL 65 WS-VEN-SETUP-YYMMDD COL 71 WS-VEN-DISC-PCT
COL 80 WS-VEN-DISC-DAYS COL 84 WS-VEN-DISC-CALC
COL 88 WS-VEN-NET-DAYS COL 92 WS-VEN-NET-CALC
COL 96 WS-VEN-POSTAL-DELAY COL 100 WS-VEN-DISC-DEALS
COL 103 WS-VEN-DISC-OVRD
COL 128 TALLY
LINE 2 COL 2 WS-FIN-CORP-ID
COL 12 WS-VEN-ADDR1 COL 33 WS-VEN-PO-ADDR1
COL 58 WS-VEN-SSN
COL 106 WS-DIV (1)
COL 110 WS-BUYER (1) COL 114 WS-SHIP-MTH (1)
COL 117 WS-SHIP-FOB (1) COL 121 WS-SHIP-PMT (1)
COL 124 WS-SHIP-PAR (1) COL 124 WS-MTCH-PCT (1)
LINE 3 COL 3 WS-BROK-ID
COL 12 WS-VEN-ADDR2 COL 33 WS-VEN-PO-ADDR2
COL 58 WS-VEN-TAX-ID
COL 106 WS-DIV (2)
COL 110 WS-BUYER (2) COL 114 WS-SHIP-MTH (2)
COL 117 WS-SHIP-FOB (2) COL 121 WS-SHIP-PMT (2)
COL 124 WS-SHIP-PAR (2) COL 124 WS-MTCH-PCT (2)
LINE 4 COL 12 WS-VEN-CITY COL 30 WS-VEN-ST
COL 33 WS-VEN-PO-CITY COL 51 WS-VEN-PO-ST
COL 106 WS-DIV (3)
COL 110 WS-BUYER (3) COL 114 WS-SHIP-MTH (3)
COL 117 WS-SHIP-FOB (3) COL 121 WS-SHIP-PMT (3)
COL 124 WS-SHIP-PAR (3) COL 124 WS-MTCH-PCT (3)
LINE 5 COL 22 WS-VNZ-5-4 COL 43 WS-VNP-5-4
COL 106 WS-DIV (4)
COL 110 WS-BUYER (4) COL 114 WS-SHIP-MTH (4)
COL 117 WS-SHIP-FOB (4) COL 121 WS-SHIP-PMT (4)
COL 124 WS-SHIP-PAR (4) COL 124 WS-MTCH-PCT (4)
LINE 6 COL 1 ' '
COL 106 WS-DIV (5)
COL 110 WS-BUYER (5) COL 114 WS-SHIP-MTH (5)
COL 117 WS-SHIP-FOB (5) COL 121 WS-SHIP-PMT (5)
COL 124 WS-SHIP-PAR (5) COL 124 WS-MTCH-PCT (5)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
As per my requirement i need to print the next lines only if there are more than 5 elements in the array. For this i wrote an AFTER-LINE procedure, wherein i m displayin the remaining report lines using display statement as shown below. When the report is printed then it always displays the value of the first element of the array. It loops for correct number of times with correct value of subscript but while printing the report it always print the value of the first element of the array. I added display stmnts and checked the subscript values. N e idea why is this happening ? How to get the correct values displayed ?
AFTER-LINE. PROC
IF WS-CUR-PRINT-LINE LT 6
WS-CUR-PRINT-LINE = WS-CUR-PRINT-LINE + 1
ELSE
DO WHILE WS-CUR-PRINT-LINE <= WS-INDEX
DISPLAY COL 1 ' ' +
COL 106 WS-DIV(WS-CUR-PRINT-LINE) +
COL 110 WS-BUYER(WS-CUR-PRINT-LINE) +
COL 114 WS-SHIP-MTH (WS-CUR-PRINT-LINE) +
COL 117 WS-SHIP-FOB (WS-CUR-PRINT-LINE) +
COL 121 WS-SHIP-PMT (WS-CUR-PRINT-LINE) +
COL 124 WS-SHIP-PAR (WS-CUR-PRINT-LINE) +
COL 124 WS-MTCH-PCT (WS-CUR-PRINT-LINE)
WS-CUR-PRINT-LINE = WS-CUR-PRINT-LINE + 1
END-DO
END-IF
END-PROC