Joined: 05 Dec 2006 Posts: 177 Location: Seattle, WA
G'Day Gents and Ladies!
I've got a file that contains a field that repeats 10 times. The value for which I am searching can appear in any, several, or none of those 10 positions.
I'm trying to count the total number of records in which the value appears and have experienced some problems. I'd just do it in interactive mode, but with over 50 million records, I just don't want to sit here all day!
This code gives me an individual total for each position (edited for brevity's sake):
Then I manually add the 10 results together. Yeah, it works, but I know there has to be a better way.
I've tried all 10 IF's with a single ACCUM, but realized that it then requires all IF's to be true before accumulating. Seizing on that discovery, I tried ORIF's with just the first two columns:
This just gave me the total for the second column, not the first. Inserting a second ACCUM statement between the IF's just gave me the individual totals again.
F I L E - A I D V9.3.1 FEB - 12 - 2013 10.01.43 *ACCUM TOTALS LIST*
FOLLOWING TOTALS DEVELOPED FROM
AT.REW.#030.MAC60560.CMPOSITE.FUTR.G0001V00 VOL=TST002
RECORD COUNT B-636.3-B--------------------------------------------0
The problem is, totalling by each column and manually adding up the column totals gives me:
Code:
COL 01 B-636.3-B------------------------------------------------262
COL 02 B-636.3-B------------------------------------------------388
COL 03 B-636.3-B------------------------------------------------232
COL 04 B-636.3-B-------------------------------------------------71
COL 05 B-636.3-B-------------------------------------------------45
COL 06 B-636.3-B-------------------------------------------------13
COL 07 B-636.3-B--------------------------------------------------4
COL 08 B-636.3-B--------------------------------------------------0
COL 09 B-636.3-B--------------------------------------------------0
COL 10 B-636.3-B--------------------------------------------------0