View previous topic :: View next topic
|
Author |
Message |
rafaelantunes
New User
Joined: 10 May 2007 Posts: 32 Location: Portugal
|
|
|
|
Hi,
I need your help to find a solution for the folowing problem:
Input file:
Code: |
AAAAAXXXXX1111122222333334444455555
AAAAAYYYYY333331111122222
BBBBBXXXXX1111122222333334444455555
BBBBBZZZZZ44444000009999977777 |
I need to generate the following file:
Output file
Code: |
AAAAAXXXXX11111
AAAAAXXXXX22222
AAAAAXXXXX33333
AAAAAXXXXX44444
AAAAAXXXXX55555
AAAAAYYYYY33333
AAAAAYYYYY11111
AAAAAYYYYY22222
BBBBBXXXXX11111
BBBBBXXXXX22222
BBBBBXXXXX33333
BBBBBXXXXX44444
BBBBBXXXXX55555
BBBBBZZZZZ44444
BBBBBZZZZZ00000
BBBBBZZZZZ99999
BBBBBZZZZZ77777 |
Is this possible? If it is anyone could give me the solution?
Best regards, |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
rafaelantunes,
What is the upper limit on the occurrences of the third field in your input? |
|
Back to top |
|
|
rafaelantunes
New User
Joined: 10 May 2007 Posts: 32 Location: Portugal
|
|
|
|
I think I didn't quite understand your question...
Let me describe the meaning of each "column" in the first row:
AAAAA (Pos: 1-5) - Client number
XXXXX (Pos: 6-10) - Number of Document Type
111111 (Pos: 11-15... repeating each 5bytes): Section code
I need to generate a file that "puts" each section code in a distinct row,
prefixed with the client number and the number of the document type.
Input:
Code: |
AAAAAXXXXX1111122222333334444455555 |
Output:
Code: |
AAAAAXXXXX11111
AAAAAXXXXX22222
AAAAAXXXXX33333
AAAAAXXXXX44444
AAAAAXXXXX55555 |
Notes: There are 6 document types and each of them has a number of sections although some of them could have the same number of sections (in the input file I give you type XXXXX with 5 sections, YYYYY with 3 sections and ZZZZZ with 4 sections)
Did this explanation helped?
Many thanks |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
rafaelantunes,
Now that you have named your fields, let me ask you this - How many "Section Codes" can occur in a single record? |
|
Back to top |
|
|
rafaelantunes
New User
Joined: 10 May 2007 Posts: 32 Location: Portugal
|
|
|
|
Hi,
My current estimation is that there will be around 2500 to 3500 sections per record.
thanks |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Is n't this a quite huge number? I think it's better to do a little bit of coding for this. |
|
Back to top |
|
|
rafaelantunes
New User
Joined: 10 May 2007 Posts: 32 Location: Portugal
|
|
|
|
I see...
If I reduce de number of sections about 90% (with only 250-350 sections per record) could it be done with DFSORT/ICETOOL?
Best regards, |
|
Back to top |
|
|
rafaelantunes
New User
Joined: 10 May 2007 Posts: 32 Location: Portugal
|
|
|
|
Any ideias?
I need to know if it is possible (and how). If it is not possible I have to consider doing it in COBOL, although I nay have a limit for the size of the input file...
With DFSORT/ICETOOL I can have more files with more size.
Best regards, |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
rafaelantunes,
It is Possible but involves multiple passes of data and a lot of IFTHEN statements. I think a Simple COBOL program is best for this as it would have to read the records just once and write out the records. COBOL can handle any size input file. |
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
The posting from a couple weeks ago "COBOL program for unknown Input file length" may be of use to you. |
|
Back to top |
|
|
|