View previous topic :: View next topic |
Author |
Message |
yadav2005 Intermediate
Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Tue Nov 13, 2007 7:22 am Post subject: need help in an internal table |
|
|
I have a file with records as below and i want to read record by record and store unique combinations of first 1 -5 bytes
and 2 bytes from pos 31 - 32 in an internal array.
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
06111 AB
06111 AB
06111 BC
06112 EF
06112 EF
06112 GH
06113 PQ
06114 XY
**************************** Bottom of Data ****************************
|
I want to store in an internal array as follows:
Code: |
06111AB
06111BC
06112EF
06112GH
06113PQ
06114XY
|
And finally i want to write to a file in the same format as stored in the array.
Can anybody post the solution / do we have sample links for this kind of requirement and i want COBOL program
only to do it. |
|
Back to top |
|
|
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Tue Nov 13, 2007 8:20 am Post subject: Re: need help in an internal table |
|
|
yadav2005 wrote: | zCan anybody post the solution / do we have sample links for this kind of requirement and i want COBOL program
only to do it. |
1. How many possible key combinations are there going to be?
2. How much money in your development budget is available for this? |
|
Back to top |
|
|
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Tue Nov 13, 2007 9:43 am Post subject: Re: need help in an internal table |
|
|
yadav2005 wrote: | zCan anybody post the solution / do we have sample links for this kind of requirement and i want COBOL program
only to do it. | Seems like a lot of work for a simple sort solution....
Is the input sorted?
Do you expect the output to be sorted? |
|
Back to top |
|
|
yadav2005 Intermediate
Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Tue Nov 13, 2007 10:01 am Post subject: |
|
|
CICS Guy,
The input is sorted and it has to be done in COBOL only and the output obviously will be sorted as the input is sorted. |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Tue Nov 13, 2007 10:28 am Post subject: |
|
|
why bother to store in an internal cobol table? are you processing the data? simple read, reformat, output should solve the problem, unless you are doing some other processing.
SORT could also be a solution. yeah, yeah, I heard you. 'hast to be cobol'.
so what? _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
yadav2005 Intermediate
Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Tue Nov 13, 2007 10:46 am Post subject: |
|
|
Dick,
Thanks for your reply . I am also doing some other processing that is why i am storing them in internal table and doing some processing further and that is the reason i am going for a COBOL Program. |
|
Back to top |
|
|
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Tue Nov 13, 2007 11:44 am Post subject: |
|
|
You stated that the input is sorted, so any dups will be on consecutive records on the input file. Just compare the values in the last element added to the WS table to the values coming in from the input file. If the values are the same, don't add anything to the WS table. If the values are different, add the values to the WS table. Or did I miss something? |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Tue Nov 13, 2007 12:42 pm Post subject: |
|
|
or use SUM FIELDS=NONE in the sort which will drop records with duplicate keys. If there are more keys than the 2 mentioned then do another sort using just those keys. Saves a bit of logic in your Cobol program. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
yadav2005 Intermediate
Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Wed Nov 14, 2007 7:15 am Post subject: |
|
|
There is a small change in the requirement as i want the output to a file written as:
Code: |
061110611206113
ABBCEFGHPQXY
|
on two different lines in the output file. |
|
Back to top |
|
|
|
|