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

Create multiple rows from 2 rows


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

New User


Joined: 22 Nov 2007
Posts: 64
Location: Germany

PostPosted: Tue Nov 05, 2013 11:06 pm
Reply with quote

Hi folks,

may you can help me...?

I have an input csv-file FB 80 with two records :

Input:
0;5001;10001;15001;20001;
5000;10000;15000;20000;25000;

I need an output file FB 80 shown below :

Output:
00000 05000
05001 10000
10001 15000
15001 20000
20001 25000

Is it possible with DFSORT or ICETOOL ?

Thanks in advance for help !
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Nov 06, 2013 12:12 am
Reply with quote

oerdgie,

Is it just 2 records or do you have more ? You want transpose records treating them as rows into columns. Is that right?
Back to top
View user's profile Send private message
oerdgie

New User


Joined: 22 Nov 2007
Posts: 64
Location: Germany

PostPosted: Wed Nov 06, 2013 1:08 am
Reply with quote

Hello Skolusu,

yes, there are only two records and I want to transpose them as rows into columns, in pairs.

In words...

Output file:
Record 1 : value 1 from the first record, value 1 from the second record
Record 2 : value 2 from the first record, value 2 from the second record
Record 3 : value 3 form the first record, value 3 from the second record
....and so on
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Nov 06, 2013 1:28 am
Reply with quote

oerdgie wrote:
Hello Skolusu,

yes, there are only two records and I want to transpose them as rows into columns, in pairs.

In words...

Output file:
Record 1 : value 1 from the first record, value 1 from the second record
Record 2 : value 2 from the first record, value 2 from the second record
Record 3 : value 3 form the first record, value 3 from the second record
....and so on


Well you can use RESIZE operator to Merge the 2 records into a single record and then transpose them.

Since you show a 5 byte values you will have a maximum of 13 values to be parsed. I used the REPEAT on parse which is a new feature of DFSORT z/OS V2R1 . If your shop doesn't have it , then you can code 13 parse fields and get the same results.
Code:

//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//IN       DD *                                                   
0;5001;10001;15001;20001;                                         
5000;10000;15000;20000;25000;                                     
//OUT      DD SYSOUT=*                                             
//TOOLIN   DD *                                                   
  RESIZE FROM(IN) TO(OUT) TOLEN(160) USING(CTL1)                   
//*                                                               
//CTL1CNTL DD *                                                   
  OPTION COPY                                                     
  INREC PARSE=(%01=(ENDBEFR=C';',FIXLEN=05,REPEAT=13)),           
  BUILD=(%01,%02,%03,%04,%05,%06,%07,%08,%09,%10,%11,%12,%13,80:X)
  OUTFIL BUILD=(01,5,X,081,5,/,                                   
                06,5,X,086,5,/,                                   
                11,5,X,091,5,/,                                   
                16,5,X,096,5,/,                                   
                21,5,X,101,5,/,                                   
                26,5,X,106,5,/,                                   
                31,5,X,111,5,/,                                   
                36,5,X,116,5,/,                                   
                41,5,X,121,5,/,                                   
                46,5,X,126,5,/,                                   
                51,5,X,131,5,/,                                   
                56,5,X,136,5,/,                                   
                61,5,X,141,5,/,                                   
                66,5,X,146,5,/,                                   
                71,5,X,151,5,/,                                   
                76,5,X,156,5)                                     
//*                                                               
Back to top
View user's profile Send private message
oerdgie

New User


Joined: 22 Nov 2007
Posts: 64
Location: Germany

PostPosted: Wed Nov 06, 2013 2:44 pm
Reply with quote

Hi Skolusu,

thanks for your solution, it works fine ! icon_smile.gif
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts How to create a list of SAR jobs with... CA Products 3
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top