Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

sort var2 in ESDS without changing var1 positions

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Dec 04, 2006 4:21 pm    Post subject: sort var2 in ESDS without changing var1 positions
Reply with quote

Hi,

I have a ESDS like this -

VAR1 VAR2
----------------
005 a
005 b
001 b
001 a

004 a
004 b
002 a
002 b

VAR1 has duplicate records. whereas VAR2 has unique value for the corresponding VAR1. Also note that VAR1 is stored in random order.

Now my requirement is to sort var2 without effecting the var1 positions (like internal sorting for VAR1 records). I had highlighted records in RED above which needs to be sorted.


Resultant file should look like -

VAR1 VAR2
----------------
005 a
005 b
001 a
001 b

004 a
004 b
002 a
002 b



Regards & Thanks,
Mohan
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Dec 04, 2006 4:26 pm    Post subject:
Reply with quote

Sort on var2 while telling sort to keep the original sequence for equals.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Dec 04, 2006 10:32 pm    Post subject:
Reply with quote

Mohan,

Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but you can change the job appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
005     a
005     b
001     b
001     a
004     a
004     b
002     a
002     b
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,
                   97:SEQNUM,8,ZD,RESTART=(1,3))),
        IFTHEN=(WHEN=(97,8,ZD,EQ,+1),
                OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(89:SEQNUM,8,ZD,
                         81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))
  SORT FIELDS=(81,8,ZD,A,9,1,CH,A)
  OUTREC BUILD=(1,80)
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Dec 04, 2006 10:34 pm    Post subject:
Reply with quote

Quote:
Sort on var2 while telling sort to keep the original sequence for equals.


William,

This is NOT a solution to the stated problem (I'm not even sure what you mean by this). Please test your "solutions" to make sure they are valid before posting them to avoid confusing people.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Dec 05, 2006 8:07 am    Post subject:
Reply with quote

Thanks for the quick solution, Frank.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us