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 in different sequence

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Dec 31, 2013 5:45 pm    Post subject: SORT in different sequence
Reply with quote

Hi,

I would like to know how to sort a file in different sequence - example below:

Input:-
Code:

01
02
03
04


I would like to have 02 as first record followed by 01,03 and 04.

Expected Output:
Code:

02
01
03
04


Please help. Thanks.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Dec 31, 2013 6:00 pm    Post subject: Reply to: SORT in different sequence
Reply with quote

Have a look at the suggestions here, there is more than one.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Dec 31, 2013 8:35 pm    Post subject:
Reply with quote

What is the expected output if your input is like

Code:
03
01
02
04
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue Dec 31, 2013 10:50 pm    Post subject: Reply to: SORT in different sequence
Reply with quote

the info provided by the TS is inadequate ...
from the scarce set of data seems that TS just wants the collating sequence of 01 and 02 reversed.

I will try to answer again tomorrow
the occurrence of wednesday on the first day of a new year
will certainly make everybody' s psychic powers much stronger
icon_wink.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Jan 01, 2014 12:33 pm    Post subject:
Reply with quote

Search for ALTSEQ
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Jan 01, 2014 2:57 pm    Post subject:
Reply with quote

Something like this..
Code:

//SYSIN    DD  *
 SORT FIELDS=(1,2,AQ,A)
 ALTSEQ CODE=(F2F1,F1F2)
/*
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Jan 02, 2014 2:29 pm    Post subject: Reply to: SORT in different sequence
Reply with quote

Thank you Escapa !
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Jan 02, 2014 5:10 pm    Post subject: Reply to: SORT in different sequence
Reply with quote

Bill, Escapa and co, I am facing problems when tried this ALTSEQ solution on below input -

Code:

03
01
02
11
04
12
99
22
21


Output with Escapa's code:-
Code:

02
01
03
04
22
21
12
11
99


Expected Output:-
Code:

02
01
03
04
11
12
21
22
99


Please help.

Thanks.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Thu Jan 02, 2014 5:20 pm    Post subject: Reply to: SORT in different sequence
Reply with quote

see here and adjust accordingly ...
http://www.ibmmainframes.com/viewtopic.php?t=60008&highlight=overlay

probably something like

Code:
   INREC  IFTHEN=(WHEN=(1,2,CH,EQ,C'01'),OVERLAY=(somewhere:C'02')),
         IFTHEN=(WHEN=(1,2,CH,EQ,C'02'),OVERLAY=(somewhere:C'01')),
         IFTHEN=(WHEN=NONE,OVERLAY=(somewhere:1,2)


sort on somewhere
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Jan 02, 2014 5:31 pm    Post subject:
Reply with quote

Or you could do something like

Code:
  INREC  IFTHEN=(WHEN=(1,2,CH,EQ,C'02'),OVERLAY=(81:C'01')),
         IFTHEN=(WHEN=NONE,OVERLAY=(81:C'99')
  SORT FIELDS=(81,2,CH,A,1,2,CH,A)
  OUTREC FIELDS=(1,80)
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Jan 02, 2014 6:21 pm    Post subject: Reply to: SORT in different sequence
Reply with quote

Ramsri,

How could we know that other values could contain "2" if you don't show them in your sample data?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jan 02, 2014 7:04 pm    Post subject:
Reply with quote

Ramsri,

You realize that you have a Long history of not providing proper information.

This wastes a lot of your time as well as the time of those who would help . . . If you look back over some of your topics, you will see that they drag on because the requirement was not properly presented in the first place.

If you will not take the time to properly ask your questions, why should someone "jump in" early - knowing you will probably change the requirement . . . icon_sad.gif

d
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Jan 03, 2014 4:21 pm    Post subject: Reply to: SORT in different sequence
Reply with quote

Thank you Bill and Pandora-Box.....
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Fri Jan 03, 2014 8:54 pm    Post subject:
Reply with quote

Quote:
Thank you Bill and Pandora-Box.....


But no thank you to Escapa. Enrico, and especially not to Dick.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Sat Jan 04, 2014 10:21 am    Post subject: Reply to: SORT in different sequence
Reply with quote

Thank you all icon_surprised.gif
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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