View previous topic :: View next topic
|
Author |
Message |
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
I would like to know how to sort a file in different sequence - example below:
Input:-
I would like to have 02 as first record followed by 01,03 and 04.
Expected Output:
Please help. Thanks. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Have a look at the suggestions here, there is more than one. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
What is the expected output if your input is like
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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
|
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Search for ALTSEQ |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Something like this..
Code: |
//SYSIN DD *
SORT FIELDS=(1,2,AQ,A)
ALTSEQ CODE=(F2F1,F1F2)
/*
|
|
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Thank you Escapa ! |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
see here and adjust accordingly ...
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ramsri,
How could we know that other values could contain "2" if you don't show them in your sample data? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 . . .
d |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Thank you Bill and Pandora-Box..... |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Quote: |
Thank you Bill and Pandora-Box.....
|
But no thank you to Escapa. Enrico, and especially not to Dick. |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Thank you all |
|
Back to top |
|
|
|