View previous topic :: View next topic
|
Author |
Message |
tuxama
New User
Joined: 25 Jan 2007 Posts: 42 Location: france
|
|
|
|
Hello,
As input, a single file which contains for example :
Code: |
A1 ; SERVICE1 ; MAIL1
A1 ; SERVICE2 ; MAIL2
A1 ; SERVICE3 ; MAIL1
A2 ; ;
A3 ; SERVICE1 ; MAIL1
A4 ; SERVICE3 ; MAIL25
A4 ; SERVICE6 ; MAIL12
etc.
|
Expected output :
Code: |
A1 ; SERVICE1 ; MAIL1 ; SERVICE2 ; MAIL2 ; SERVICE3 ; MAIL1
A2 ; ;
A3 ; SERVICE1 ; MAIL1
A4 ; SERVICE3 ; MAIL25 ; SERVICE6 ; MAIL12
|
The key is on the first two characters
The number of record is variable
The only way I can imagine is a Rexx script.
But I am interested in a DFSORT solution if it exists. because it is a tool that I use when I can.
Does anyone have a lead to explore ?
Thanks by advance
best regards
Alan. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1244 Location: Bamberg, Germany
|
|
|
|
You can try for example PARSE and a couple of IFTHEN to reformat, but it won't look pretty nor may it be efficient using a SORT product I afraid. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2018 Location: USA
|
|
|
|
With SORT, the maximum number of elements to be combined into one string is limited to a reasonable value. Usually about 10 elements, theoretically - up to 100. Each new element requires its own reformatting parameter in SORT statements. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
Back to top |
|
|
tuxama
New User
Joined: 25 Jan 2007 Posts: 42 Location: france
|
|
|
|
Hello,
Thank you for your time and your answers.
I thought there was no easy fix.
I will do a little rexx it will be simple and easily maintainable.
tuxama. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2018 Location: USA
|
|
|
|
REXX approach should be OK unless you need to handle millions, or hundreds of millions records. Otherwise you might be faced performance issues.
P.S.
The total number of code needed for REXX solution is not seriously different from SORT solution. |
|
Back to top |
|
|
|