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

Merge a variable number of records from a single file


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

New User


Joined: 25 Jan 2007
Posts: 37
Location: france

PostPosted: Tue Aug 10, 2021 8:35 pm
Reply with quote

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

Active Member


Joined: 15 Aug 2015
Posts: 606
Location: Bamberg, Germany

PostPosted: Wed Aug 11, 2021 2:42 am
Reply with quote

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
View user's profile Send private message
sergeyken
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1189

PostPosted: Wed Aug 11, 2021 7:13 pm
Reply with quote

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

Global Moderator


Joined: 21 Sep 2010
Posts: 2771
Location: NYC,USA

PostPosted: Thu Aug 12, 2021 4:20 am
Reply with quote

little research could get you similar problems and solutions discussed in past.
Please see these posts to get an idea and give a try. If something doesn’t work then share us the results and someone may help further.
www.ibmmainframeforum.com/syncsort-synctool/topic9154.html
www.ibmmainframeforum.com/syncsort-synctool/topic4000.html
Back to top
View user's profile Send private message
tuxama

New User


Joined: 25 Jan 2007
Posts: 37
Location: france

PostPosted: Thu Aug 12, 2021 7:21 pm
Reply with quote

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
View user's profile Send private message
sergeyken
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1189

PostPosted: Thu Aug 12, 2021 8:12 pm
Reply with quote

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
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 how to convert and use 1 bit hex-numb... COBOL Programming 0
No new posts how to convert and use 1 bit hex-numb... DFSORT/ICETOOL 10
This topic is locked: you cannot edit posts or make replies. Sort to include records of file 2 int... Java & MQSeries 1
No new posts How to modify file content using REXX CLIST & REXX 3
No new posts VB file copy COBOL program gives erro... COBOL Programming 3
Search our Forums:

Back to Top