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

SORT JCL to merge multiple tow into single row for same key.


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

New User


Joined: 16 May 2023
Posts: 8
Location: India

PostPosted: Fri Aug 02, 2024 1:42 pm
Reply with quote

Hi All,

Thanks in advance for giving your valuable time.

I have a requirement where for a key I will have multiple rows. I won’t be knowing in advance that for which key how many rows will be. It could be one , 3, 10, my need is to create a single row for a key in output along with other details from the other rows.

For example
This is how Input would be

KEY NAME ID
KEY1 ABCD 102
KEY1 EFGH 201
KEY2 XYZA 301
KEY3 SSSS 111
KEY3 ABCD 545
KEY3 FDGH 345

And so on

Expected output in this case would be
KEY1 ABCD 102 EFGH 201
KEY2 XYZA 301
KEY3 SSSS 111 ABCD 545 FDGH 345
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2115
Location: USA

PostPosted: Fri Aug 02, 2024 6:52 pm
Reply with quote

1. Try to be polite to possible readers of your post:
Deep S wrote:
Hi All,

Thanks in advance for giving your valuable time.

I have a requirement where for a key I will have multiple rows. I won’t be knowing in advance that for which key how many rows will be. It could be one , 3, 10, my need is to create a single row for a key in output along with other details from the other rows.

For example
This is how Input would be
Code:
KEY    NAME     ID
KEY1   ABCD    102
KEY1   EFGH     201
KEY2   XYZA     301
KEY3   SSSS      111
KEY3   ABCD      545
KEY3   FDGH     345

And so on

Expected output in this case would be
Code:
KEY1 ABCD 102 EFGH 201
KEY2 XYZA  301
KEY3 SSSS  111 ABCD 545 FDGH 345


2. Do you know the maximum limit of expected equal keys?
If not, there is no (reasonable) solution for this problem.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Aug 02, 2024 7:22 pm
Reply with quote

Also to add, there are some samples in this forum covering this.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2115
Location: USA

PostPosted: Fri Aug 02, 2024 7:52 pm
Reply with quote

Hint:

Search for examples of using SPLICE statement of ICETOOL/SYNCTOOL (both programs use the same syntax; you can borrow one example from another)
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2115
Location: USA

PostPosted: Fri Aug 02, 2024 8:00 pm
Reply with quote

P.S.

It is a very bad idea to give the topic name like
Quote:
"SORT JCL ... "

This issue has nothing to do with JCL language.
It is completely SORT utility control statements discussion.
Back to top
View user's profile Send private message
Deep S

New User


Joined: 16 May 2023
Posts: 8
Location: India

PostPosted: Fri Aug 02, 2024 10:11 pm
Reply with quote

Thanks for advise.
Maximum limit for a key would be 10.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2115
Location: USA

PostPosted: Fri Aug 02, 2024 10:30 pm
Reply with quote

Hint #2.

In case you do not have any manual on the tool you are going to use (very strange situation!), you can try to check this online copy of DFSORT/ICETOOL manual:

DFSORT Application Programming Guide

Please, refer to Example 4 on page 648. This covers 95% of your particular task.
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 Add condition to a FINDREP SORT card DFSORT/ICETOOL 4
No new posts Sort based on the record type DFSORT/ICETOOL 1
No new posts To Omit records based n SORT condition DFSORT/ICETOOL 6
No new posts Using Multiple IFTHEN and WHEN condit... SYNCSORT 12
No new posts Looking for help with SORT JCL/SYNC sort DFSORT/ICETOOL 6
Search our Forums:

Back to Top