Posted: Thu Dec 26, 2002 7:26 pm Post subject: How to sum and order items read from a TS
Hi,
I have to do an online Cics-Cobol/Mvs program where I link a program which gives me a TS; then I read this TS and write another TS, with the total values for each product, like this:
Input TS:
Product..... Value
pic x(3).....pic 9(6)
The number of items in input TS is between 1 and 3000, and output TS can contain from 1 to 20 items.
Any ideas/suggestions how could it be done in an efficient way?
Thanks,
mly
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Thu Dec 26, 2002 9:00 pm Post subject:
Mly,
Well sorting in CICS program is not advisable, but it can be done.check if your system has a product CICS/QSORT from Mackinney Systems, that imnplements the Shell sort using TS queues.
If you don't have it then you can read TSQ into a working storage table, and write your own procedure division logic to sort them.However I haven't tried this option, but I think it can be done.
Since TSQ'S are flatfiles,you can sort the file using sort products ( DFSORT ,SYNCSORT). you can submit the job to the INTRDR.check this link for CICS interface to JES
Hope this helps...
cheers
kolusu
Ps: I am moving this topic to CICS AND MIDDLEWARE forum as it is the approriate forum for this question.
MLY,
Since the number of OUTPUT items is so small ( you say from 1 to 20 items ), I would not bother sorting the INPUT TSQ, or READING it into an internal array ( of some 3000 entries ) and then sorting it - instead I would build the internal array to resemble the OUTPUT TSQ by adding new item entries only when needed. For example, in your example I would add items ABC, XYZ, KLM, CDX, and PQR, in that order. Of course, I would keep the item array in sorted order and 'bubble sort' it as each new item is added - that is as each input TSQ record is read, do a SEARCH ALL on the item array, and if found, add its value to the existing item total; if not found, add the new item with its initial value, and re-sort the array. At end of input, write the output TSQ from the array. I would probably allow for twice as many entries as the maximum expected, and initialize it to high-values to insure that the SEARCH ALL functions properly.
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
Posted: Sat Dec 28, 2002 1:36 am Post subject:
Kolusu,
I had always wanted to ask this.
Quote:
you can submit the job to the INTRDR.check this link for CICS interface to JES
After, the EXEC CICS statement to write SPOOLFILE, the job gets submitted. Now, won't this job be independent of the CICS program? For example, the input TSQ is sent for sorting via DFSORT via a batch job. To process the output TSQ, do I have to wait until the batch job is over? If yes, then how does one "wait"? _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
Posted: Mon Dec 30, 2002 3:02 pm Post subject:
Hi Kolusu,
The DELAY command will only suspend the task for a specified interval or until a specified time. How do we know that the batch job has ended sorting the records? Is there a way (through an input extra partitioned TDQ perhaps) by which the batch job can interact with the CICS application program?. Have never tried anything like this. Just wondering if it can be done.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum