Help.. report to count rows based on criteria..
Help.. report to count rows based on criteria..
(OP)
I have a table like:
Table 1
POL-ID
EFF-DATE
TYP-IND
I need to generate a report like :
Week-Ending Type1 Type2 Type3 Type4
06Jul07 20 10 5 7
13Jul07 15 17 12 4
20Jul07 18 19 1 12
27Jul07 5 10 11 20
Total 58 56 29 43
How can I do that?
Table 1
POL-ID
EFF-DATE
TYP-IND
I need to generate a report like :
Week-Ending Type1 Type2 Type3 Type4
06Jul07 20 10 5 7
13Jul07 15 17 12 4
20Jul07 18 19 1 12
27Jul07 5 10 11 20
Total 58 56 29 43
How can I do that?
RE: Help.. report to count rows based on criteria..
DEFINE FILE TABLE1
TYPE1/I5 = IF TYP-IND EQ '1' THEN 1 ELSE 0;
TYPE2/I5 = IF TYP-IND EQ '2' THEN 1 ELSE 0;
TYPE3/I5 = IF TYP-IND EQ '3' THEN 1 ELSE 0;
TYPE4/I5 = IF TYP-IND EQ '4' THEN 1 ELSE 0;
END
TABLE FILE TABLE1
SUM TYPE1 TYPE2 TYPE3 TYPE4
BY EFF-DATE AS "WEEK ENDING"
etc
You may have to do some DEFINE with the EFF-DATE to control the SORT.
HTH
RE: Help.. report to count rows based on criteria..
TABLE FILE TABLE1
SUM CNT.POLL_ID
ACROSS TYPE_IND
BY EFF_DATE
END
RE: Help.. report to count rows based on criteria..
How to joint more than two hold files together to get a report?
Use the above sample, I need to generate another report like:
Week-Ending Type1 Type2 Type3 Type4 Received
06Jul07 20 10 5 7 56
13Jul07 15 17 12 4 65
20Jul07 18 19 1 12 45
27Jul07 5 10 11 20 20
Total 58 56 29 43 181
For the column of Received, I can get from another hold file, it has same rows as the first hold file...
RE: Help.. report to count rows based on criteria..
If recieved could be before the across columns then you would just need to join the tables together.
The syntax for the join command is
JOIN keyfld [AND keyfld2 ...] IN hosttable TO [ALL] keyfld [AND keyfld2] IN childtable [AS joinname]
END
The "ALL" keyword would be used if you need a 1-n relationship.