Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Break rows into columns

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Break rows into columns
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: 2180
Location: @my desk

PostPosted: Fri Mar 13, 2009 3:24 pm    Post subject:
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    Post subject:
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: 2180
Location: @my desk

PostPosted: Fri Mar 13, 2009 5:36 pm    Post subject:
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    Post subject:
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: 2180
Location: @my desk

PostPosted: Sat Mar 14, 2009 11:01 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: Break rows into columns
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Can we use OPTIMIZE FOR 1 ROWS for fe... cvijay784 DB2 1 Fri Aug 05, 2016 11:56 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us