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 base upon differnt position

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

New User


Joined: 28 Oct 2008
Posts: 98
Location: Cubicle

PostPosted: Thu Mar 19, 2009 7:12 pm    Post subject: Sort base upon differnt position
Reply with quote

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
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Mar 19, 2009 7:21 pm    Post subject:
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Mar 19, 2009 7:22 pm    Post subject:
Reply with quote

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
View user's profile Send private message
DB2 Guy

New User


Joined: 28 Oct 2008
Posts: 98
Location: Cubicle

PostPosted: Thu Mar 19, 2009 7:36 pm    Post subject:
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Mar 19, 2009 7:42 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2275
Location: @my desk

PostPosted: Thu Mar 19, 2009 7:46 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Thu Mar 19, 2009 7:55 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2275
Location: @my desk

PostPosted: Thu Mar 19, 2009 7:58 pm    Post subject:
Reply with quote

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. icon_rolleyes.gif
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
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Thu Mar 19, 2009 8:17 pm    Post subject: Reply to: Sort base upon differnt position
Reply with quote

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
View user's profile Send private message
DB2 Guy

New User


Joined: 28 Oct 2008
Posts: 98
Location: Cubicle

PostPosted: Fri Mar 20, 2009 9:53 pm    Post subject:
Reply with quote

Hi Arun,

Thanks for your time - Your observation is right; I tried to simulate some sample input and output - and goofed up . . . icon_redface.gif
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Fri Mar 20, 2009 9:58 pm    Post subject:
Reply with quote

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 . . . icon_redface.gif

So which was the actual requirement - the sample data or the description you later provided?
Back to top
View user's profile Send private message
DB2 Guy

New User


Joined: 28 Oct 2008
Posts: 98
Location: Cubicle

PostPosted: Fri Mar 20, 2009 10:24 pm    Post subject:
Reply with quote

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
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 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
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
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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