How can you sort using TALLY?

Ask/Clarify the questions on EASYTRIEVE

Moderators: DikDude, Moderator Group

Post Reply
mfgurumlk
Member
Posts: 3
Joined: Wed Jul 27, 2011 12:51 am

How can you sort using TALLY?

Post by mfgurumlk » Wed Jul 27, 2011 1:13 am

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.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Jul 27, 2011 6:45 am

This does not sound like somethng that TALLY might be used for. . .

How many unique item codes exist?
Have a good one

mfgurumlk
Member
Posts: 3
Joined: Wed Jul 27, 2011 12:51 am

Post by mfgurumlk » Wed Jul 27, 2011 9:58 pm

There are over 3000 unique items.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Jul 27, 2011 10:13 pm

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.
Have a good one

mfgurumlk
Member
Posts: 3
Joined: Wed Jul 27, 2011 12:51 am

Post by mfgurumlk » Wed Jul 27, 2011 11:31 pm

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.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Jul 27, 2011 11:37 pm

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
Have a good one

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others