Page 1 of 1

How can you sort using TALLY?

Posted: Wed Jul 27, 2011 1:13 am
by mfgurumlk
I want to read a file containing item codes and create a report containing a row for each unique item code along with the number of times it appears in the file, displayed in descending count sequence. Can I do this using TALLY? If so, how? If not, any ideas? Thanks.

Posted: Wed Jul 27, 2011 6:45 am
by DikDude
This does not sound like somethng that TALLY might be used for. . .

How many unique item codes exist?

Posted: Wed Jul 27, 2011 9:58 pm
by mfgurumlk
There are over 3000 unique items.

Posted: Wed Jul 27, 2011 10:13 pm
by DikDude
With only 3k items, you could create an array within the code that contains all of the item codes (to be populated by code, not keying<g>) and a count field (initialized to zero and incremented by 1 each tme this item code is detected in the input data).

Once the input data has all been read, sort the array by count descending and generate the report you want.

Posted: Wed Jul 27, 2011 11:31 pm
by mfgurumlk
Thanks, but too much trouble. Not my area of expertise. I will make a file out the existing report and use TSO to sort it. Thanks for confirming my initial suspicions that TALLY could not be used.

Posted: Wed Jul 27, 2011 11:37 pm
by DikDude
I will make a file out the existing report and use TSO to sort it.
I agree if this is a one-time requirement. If this needs to be run regularly, i'd go ahead and implement the entire needed output in the code so i didn't have to do extra editing each time it is run . . .

fwiw