View previous topic :: View next topic
|
Author |
Message |
DB2 Guy
New User
Joined: 28 Oct 2008 Posts: 98 Location: Cubicle
|
|
|
|
Hi,
In input if at a particular position "D" is present, I need to sort some other position if it's "D" I need to sort on other position. Say, I've this input
Code: |
----+----1----+----2--
//SORTIN DD *
6316383017 9059 9094 D
9316383017 9059 9094 M
9316383017 9059 9064 M
9316383017 9059 9064 M
6316383018 9062 9094 D
6316383018 9050 9092 D
8316383017 9059 9064 M
8316383017 9059 9064 M
6316383019 9061 9064 D
6316383019 9040 9064 D
7316383017 9059 9094 M
7316383017 9059 9094 M
6316383020 9070 9094 D
6316383020 9061 9094 D
5316383017 9094 9094 M
6316383021 9094 9094 D
4316383017 9094 9094 M |
then teh expected output is:
Code: |
----+----1----+----2--
4316383017 9094 9094 M
5316383017 9064 9065 M
5316383017 9094 9094 M
6316383017 9059 9094 D
6316383018 9050 9094 D
6316383018 9062 9092 D
6316383019 9040 9064 D
6316383019 9061 9064 D
6316383020 9061 9094 D
6316383020 9072 9094 D
7316383017 9059 9094 M
7316383017 9059 9094 M
8316383017 9059 9064 M
8316383017 9059 9064 M
9316383017 9059 9094 M
9316383017 9059 9064 M
9316383017 9059 9064 M |
how to proceed, not getting any idea..stuck up. Please guide. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
INREC with the IFTHEN clause to set the different keys in a common area, sort on that common area and OUTREC to remove the added key location. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
You have not explained on what fields the sort needs to be performed if the D is present.
You have not explained what happens if D is not present. Is the data to be sorted, and if so on what fields.
What is the RECFM and LRECL of the input file.
By posting in the JCL forum is the product being used SYNCSORT, and if so, what level / release is being used. |
|
Back to top |
|
|
DB2 Guy
New User
Joined: 28 Oct 2008 Posts: 98 Location: Cubicle
|
|
|
|
Hi Expat,
expat wrote: |
You have not explained on what fields the sort needs to be performed if the D is present. |
My mistake - if D, I need to sort on (17,4) if M, on (12,4)
Quote: |
You have not explained what happens if D is not present. Is the data to be sorted, and if so on what fields. |
If D and M both are not present (say SPACES) are there, don't sort.
Quote: |
What is the RECFM and LRECL of the input file. |
FB,80 - for exapmle. I would try to extend to my actual file, in case I failed I'll get back to you guys.
Quote: |
By posting in the JCL forum is the product being used SYNCSORT, and if so, what level / release is being used. |
Yes SyncSort -SYNCSORT FOR Z/OS 1.2.3.0R . |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
DB2 Guy wrote: |
Yes SyncSort -SYNCSORT FOR Z/OS 1.2.3.0R . |
That could cause a problem, does 1.2.3 have the IFTHEN? |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
That could cause a problem, does 1.2.3 have the IFTHEN? |
Yes. Even my version has - 1.2.1.0 |
|
Back to top |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
DB2 Guy wrote: |
If D and M both are not present (say SPACES) are there, don't sort.
|
Does this mean you do not want this record included in the output? |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
DB2 Guy,
The sort order you mentioned does nt seem to match the expected results.
Quote: |
if D, I need to sort on (17,4) |
The 'D' records in output are NOT sorted on 17,4. And it seems to be sorted on (1,10) instead.
Quote: |
4316383017 9094 9094 M
5316383017 9064 9065 M
5316383017 9094 9094 M
6316383017 9059 9094 D
6316383018 9050 9094 D
6316383018 9062 9092 D
6316383019 9040 9064 D
6316383019 9061 9064 D
6316383020 9061 9094 D
6316383020 9072 9094 D
7316383017 9059 9094 M
7316383017 9059 9094 M
8316383017 9059 9064 M
8316383017 9059 9064 M
9316383017 9059 9094 M
9316383017 9059 9064 M
9316383017 9059 9064 M |
|
|
Back to top |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Here is a SyncSort for z/OS job that will produce the output as shown in the first post (not based on the written description):
Code: |
//SORT1 EXEC PGM=SORT
//SORTIN DD DSN=input.dataset,...
//SORTOUT DD DSN=output.dataset,...
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=(22,1,CH,EQ,C'D'),OVERLAY=(24:17,4)),
IFTHEN=(WHEN=(22,1,CH,EQ,C'M'),OVERLAY=(24:12,4))
SORT FIELDS=(1,10,CH,A,24,4,CH,A)
OUTREC FIELDS=(1,22)
/*
|
If there are records present in the input data set that do not have a D or M in position 22 and you want them removed from the output, then simply add the following statement to SYSIN:
Code: |
INCLUDE COND=(22,1,CH,EQ,C'D',OR,22,1,CH,EQ,C'M') |
|
|
Back to top |
|
|
DB2 Guy
New User
Joined: 28 Oct 2008 Posts: 98 Location: Cubicle
|
|
|
|
Hi Arun,
Thanks for your time - Your observation is right; I tried to simulate some sample input and output - and goofed up . . . |
|
Back to top |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
DB2 Guy wrote: |
Hi Arun,
Thanks for your time - Your observation is right; I tried to simulate some sample input and output - and goofed up . . . |
So which was the actual requirement - the sample data or the description you later provided? |
|
Back to top |
|
|
DB2 Guy
New User
Joined: 28 Oct 2008 Posts: 98 Location: Cubicle
|
|
|
|
Hi Alissa,
Your Sort give me an idea to start with - Thanks. My file is VB & of length 10978 - will try to "imposr" this sort on that. Hopefully I would be able to it; in case I stuck up some where I'll get back you. . . |
|
Back to top |
|
|
|