Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 7315

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: 1542
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: 10327
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: 10327
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: 1542
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: 7315

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: 684
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us