IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Break rows into columns


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rafaelantunes

New User


Joined: 10 May 2007
Posts: 32
Location: Portugal

PostPosted: Fri Mar 13, 2009 3:16 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Mar 13, 2009 3:24 pm
Reply with quote

rafaelantunes,

What is the upper limit on the occurrences of the third field in your input?
Back to top
View user's profile Send private message
rafaelantunes

New User


Joined: 10 May 2007
Posts: 32
Location: Portugal

PostPosted: Fri Mar 13, 2009 3:51 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Mar 13, 2009 5:36 pm
Reply with quote

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
View user's profile Send private message
rafaelantunes

New User


Joined: 10 May 2007
Posts: 32
Location: Portugal

PostPosted: Fri Mar 13, 2009 6:27 pm
Reply with quote

Hi,

My current estimation is that there will be around 2500 to 3500 sections per record.

thanks
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Mar 14, 2009 11:01 am
Reply with quote

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
View user's profile Send private message
rafaelantunes

New User


Joined: 10 May 2007
Posts: 32
Location: Portugal

PostPosted: Mon Mar 16, 2009 4:30 pm
Reply with quote

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
View user's profile Send private message
rafaelantunes

New User


Joined: 10 May 2007
Posts: 32
Location: Portugal

PostPosted: Thu Mar 19, 2009 10:36 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Mar 19, 2009 11:12 pm
Reply with quote

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
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Thu Mar 19, 2009 11:53 pm
Reply with quote

The posting from a couple weeks ago "COBOL program for unknown Input file length" may be of use to you.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
Search our Forums:

Back to Top