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

Syncsort Help to group fields


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sudhakarraju

New User


Joined: 05 May 2005
Posts: 31

PostPosted: Thu Dec 29, 2016 1:38 am
Reply with quote

Input

ABC001 12345
ABC002 12345
ABC003 12345
ABC004 12345
ABC001 23456
ABC002 23456
ABC003 23456
ABC004 23456

Output needed

ABC001 12345
ABC002 12345
ABC001 23456
ABC002 23456
ABC003 12345
ABC004 12345
ABC003 23456
ABC004 23456
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Dec 29, 2016 2:31 am
Reply with quote

Is this supposed to be a puzzle that we figure out and provide a working code?

If you don't even care to explain, how do you expect people to spend their time and do your work for you?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Dec 29, 2016 2:34 am
Reply with quote

sudhakarraju,

I believe you have been here long enough to know guesswork is not entertained here. You have posted little information for others to help you.
Back to top
View user's profile Send private message
sudhakarraju

New User


Joined: 05 May 2005
Posts: 31

PostPosted: Thu Dec 29, 2016 3:05 am
Reply with quote

Hi,

Sorry about that.
I have two fields, group no and group id in the dataset.
I can have multiple group numbers but have to keep the group numbers ABC001 & ABC002 together for the same group id and ABC003 & ABC004 together for the same group id. I don't need to worry about the order of the other group numbers.

Thanks.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Dec 29, 2016 4:17 am
Reply with quote

sudhakarraju wrote:
have to keep the group numbers ABC001 & ABC002 together for the same group id and ABC003 & ABC004 together for the same group id
If I am not mistaken, your input has it grouped already. It is not clear what is the logic behind this re-grouping.

It might help if you can show a better example, with "other" groups so the difference is visible.
Back to top
View user's profile Send private message
sudhakarraju

New User


Joined: 05 May 2005
Posts: 31

PostPosted: Thu Dec 29, 2016 8:51 pm
Reply with quote

I was able to achieve this using ICETOOL but was just wondering if there is a shorter way.

//SETP01 EXEC PGM=ICETOOL
//TOOLIN DD *
MODE CONTINUE
SORT FROM(DDO1) TO(DDO2) USING(DDC1)
SORT FROM(DDO2) TO(DDO3) USING(DDC2)
COPY FROM(DDO3) TO(DDO4) USING(DDC3)
//DDO1 DD DSN=TEST.INPUT,
// DISP=SHR
//DDO2 DD DSN=&&TEMP2,DISP=(NEW,PASS),
// UNIT=SYSDA,SPACE=(CYL,(50,50),RLSE)
//DDO3 DD DSN=&&TEMP3,DISP=(NEW,PASS),
// UNIT=SYSDA,SPACE=(CYL,(50,50),RLSE)
//DDO4 DD SYSOUT=*
//DDC1CNTL DD *
SORT FIELDS=COPY
OUTFIL IFTHEN=(WHEN=(2,6,CH,EQ,C'MSC001',OR,2,6,CH,EQ,C'MSC002'),
BUILD=(1,1800,C'A')),
IFTHEN=(WHEN=(2,6,CH,EQ,C'MSC003',OR,2,6,CH,EQ,C'MSC004'),
BUILD=(1,1800,C'B')),
IFTHEN=(WHEN=NONE,
BUILD=(1,1800,C'X '))
//DDC2CNTL DD *
SORT FIELDS=(1801,1,A,52,17,A,2,6,A),FORMAT=CH
//DDC3CNTL DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,1800)
//*
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Dec 29, 2016 9:03 pm
Reply with quote

Plain SORT, do the DC1 processing in INREC, the SORT from DC2 in SORT and the DC3 in OUTREC.

User OVERLAY instead of the BUILD in the DC1 replacement.
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Splitting group records based on deta... DFSORT/ICETOOL 8
Search our Forums:

Back to Top