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
 

 

How to use to sort statement in SYSin cards

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

New User


Joined: 31 Oct 2008
Posts: 9
Location: bangalore

PostPosted: Wed Mar 18, 2009 11:02 pm    Post subject: How to use to sort statement in SYSin cards
Reply with quote

I need to copy the contents from a concatenated file to 2 different file
where I 'll extract only some particular fields. Along with this I need to
extract some other fields and remove the duplicates into file3

My Question
So how to give give 2 sort statements in syncsort. Basically I want to combine the below steps in one syncsort stepitself.step2 out put should be
written to files=3

Step1
SORT FIELDS=COPY
OUTFIL FILES=1,INCLUDE=(21,4,CH,EQ,C'MQF1')
OUTFIL FILES=2,INCLUDE=(21,4,CH,EQ,C'MQL1')

Step2
Sort fields=(21,4,CH,A,29,2,PD,A)
SUM FIELDS=NONE


Thanks a Lot
Back to top
View user's profile Send private message

Arun Raj

Moderator


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

PostPosted: Thu Mar 19, 2009 12:07 am    Post subject:
Reply with quote

huttesh,

Welcome to the forums. icon_smile.gif

AFAIK, you cant give multiple SORT statements in a SYSIN card. You can either do a COPY or a SORT/MERGE operation.

BTW, do you really need unsorted records written into FILES=1 and FILES=2 ? Is it still ok if you extract the records after the SORT operation mentioned above?
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 Mar 19, 2009 12:10 am    Post subject:
Reply with quote

Hello and welcome to the forum,

Suggest you post some sample input records and the outputs you want from those sample input records explaining the rules for creating the outputs. These do not need to be full-length records - only the fields that are needed to show your requirement.

Also, mention the recfm and lrecl of all files.
Back to top
View user's profile Send private message
huttesh

New User


Joined: 31 Oct 2008
Posts: 9
Location: bangalore

PostPosted: Thu Mar 19, 2009 2:18 am    Post subject: Reply to: How to use to sort statement in SYSin cards
Reply with quote

input records

Code:
123456789--column position
ADKJBJBBJ---1ST RECORD
ANNMNBMK---2 ND RECORD
HDHBCBBBB--3 RD RECORD


OUT PUT

FIRST FILE SHOULD HAVE RECORDS WHICH HAS 'A' IN POITION 1
SECOUND FILE SHOUL HAVE RECORDS WHICH HAS B IN POSITION 7
THIRD FILE SHOULD HAVE DEDUPED RECORDS AND SHOULD BE SORTED
ON POSITION 8.

The challenge I have is, I need to do all these in single syncsort step.!!!!

Thanks a lot
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Mar 19, 2009 9:21 am    Post subject:
Reply with quote

Quote:
The challenge I have is, I need to do all these in single syncsort step
huttesh,

Is that a business need? I think the focus here should be on what you're trying to achieve and NOT on whether you do in a single step or multiple steps.
Please try to respond to the questions raised here if you're expecting help from a forum.
Back to top
View user's profile Send private message
huttesh

New User


Joined: 31 Oct 2008
Posts: 9
Location: bangalore

PostPosted: Thu Mar 19, 2009 10:35 am    Post subject:
Reply with quote

I want improve the performence, hence want to do everything in one step.
I think the only way we achieve this is by giving multiple sort cards...

If your answer is you cant give multiple SORT statements in a SYSIN card.
Then I need to drop this approach.

Thanks Very much.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Mar 19, 2009 2:25 pm    Post subject:
Reply with quote

Quote:
If your answer is you cant give multiple SORT statements in a SYSIN card.
Then I need to drop this approach.
Not necessarily. There may be alternatives. But you are not helping yourself by not responding to any of the questions asked here.
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 Mar 19, 2009 8:24 pm    Post subject:
Reply with quote

Hello,

Quote:
I want improve the performence, hence want to do everything in one step.
Why would you believe that having only 1 step yields better performance?

The way to better performance is to reduce i/o - i mention this as there are multiple topics in the forum where the solution is "one step" but the data is passed 3 or 4 times - which can be horrible for performance.

As Arun mentioned - you need to provide the requested info for anyone to be able to help. The "Helpee" needs to humor the "Helpers" icon_smile.gif

Multiple SORT statements in a step is not an option.
Back to top
View user's profile Send private message
huttesh

New User


Joined: 31 Oct 2008
Posts: 9
Location: bangalore

PostPosted: Thu Mar 19, 2009 9:41 pm    Post subject: Reply to: How to use to sort statement in SYSin cards
Reply with quote

Code:
123456789--column position
ADKJBJBBJ---1ST RECORD
ANNMNBMK---2 ND RECORD
HDHBCBBBB--3 RD RECORD

OUT PUT
FIRST FILE SHOULD HAVE RECORDS WHICH HAS 'A' IN POITION 1
SECOND FILE SHOULD HAVE RECORDS WHICH HAS B IN POSITION 7
THIRD FILE SHOULD HAVE DEDUPED RECORDS AND SHOULD BE SORTED ON POSITION 8.

We can Achive this by giving in first step

SORT FIELDS=COPY
OUTFIL FILES=1,INCLUDE=(1,1,CH,EQ,C'A')
OUTFIL FILES=2,INCLUDE=(7,1,CH,EQ,C'B')

Second Step

SORT FIELDS =(8,1,CH,A)
SUM FIELDS=NONE


My question
I don't want to read the same file in two steps as the file could have million of records
and cause performence issue? Any idea of achieving this by reading the
file only once by using syncsort in only one step?

Thank you!
icon_biggrin.gif
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 9:50 pm    Post subject: Re: Reply to: How to use to sort statement in SYSin cards
Reply with quote

huttesh wrote:
Any idea of achieving this by reading the
file only once by using syncsort in only one step?
If you allow files 1 & 2 to be sorted on position 8 and have dups dropped, I'd think it can be done.....
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Mar 20, 2009 12:20 am    Post subject:
Reply with quote

huttesh,

Unfortunately, your latest post just repeats what you have already told in your previous posts leaving the questions still unanswered. icon_smile.gif
Quote:
do you really need unsorted records written into FILES=1 and FILES=2 ?
Quote:
Is it still ok if you extract the records into FILES=1 and FILES=2 after the SORT operation mentioned above?

Quote:
post some sample input records and the outputs you want from those sample input records explaining the rules for creating the outputs. These do not need to be full-length records - only the fields that are needed to show your requirement.
Also, mention the recfm and lrecl of all files.
Back to top
View user's profile Send private message
huttesh

New User


Joined: 31 Oct 2008
Posts: 9
Location: bangalore

PostPosted: Fri Mar 20, 2009 1:47 am    Post subject: Reply to: How to use to sort statement in SYSin cards
Reply with quote

do you really need unsorted records written into FILES=1 and FILES=2 ?

SORT FIELDS=COPY
OUTFIL FILES=1,INCLUDE=(1,1,CH,EQ,C'A')
OUTFIL FILES=2,INCLUDE=(7,1,CH,EQ,C'B')

This will take care of sorting. if it's not sorted also its fine


Is it still ok if you extract the records into FILES=1 and FILES=2 after the SORT operation mentioned above?

No. In the same sort operation I want to extract


post some sample input records and the outputs you want from those sample input records explaining the rules for creating the outputs. These do not need to be full-length records - only the fields that are needed to show your requirement.
Also, mention the recfm and lrecl of all files.


Answer

Code: (Input records from a file)
123456789--column position
ADKJBJBBJ---1ST RECORD
ANNMNBMK---2 ND RECORD
HDHBCBBBB--3 RD RECORD

OUT PUT Record expected to 3 files
FIRST FILE SHOULD HAVE RECORDS WHICH HAS 'A' IN POITION 1
SECOND FILE SHOULD HAVE RECORDS WHICH HAS B IN POSITION 7
THIRD FILE SHOULD HAVE DEDUPED RECORDS AND SHOULD BE SORTED ON POSITION 8.

We can Achive this by giving in first step

SORT FIELDS=COPY
OUTFIL FILES=1,INCLUDE=(1,1,CH,EQ,C'A')
OUTFIL FILES=2,INCLUDE=(7,1,CH,EQ,C'B')

Second Step

SORT FIELDS =(8,1,CH,A)
SUM FIELDS=NONE


My question
I don't want to read the same file in two steps as the file could have million of records
and cause performence issue? Any idea of achieving this by reading the
file only once by using syncsort in only one step?
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: Fri Mar 20, 2009 2:14 am    Post subject:
Reply with quote

I supposed that if you INREC IFTHEN and create two records for each input.
The first with the A or B and a large seqnum added to the end of the record.
The second with a C and the sort/sum field where the seqnum is in the first.
After sort/summing, OUTFIL to strip off the additional fileds.
Something like this
SORT FIELDS =(21,10,CH,A) (large seqnum)
SUM FIELDS=NONE
OUTFIL FILES=1,INCLUDE=(20,1,CH,EQ,C'A')
OUTFIL FILES=2,INCLUDE=(20,1,CH,EQ,C'B')
OUTFIL FILES=3,INCLUDE=(20,1,CH,EQ,C'C')
might work.....
Good: one pass....
Bad: more records to sort and a longer sort key....
Back to top
View user's profile Send private message
huttesh

New User


Joined: 31 Oct 2008
Posts: 9
Location: bangalore

PostPosted: Fri Mar 20, 2009 2:25 am    Post subject: Reply to: How to use to sort statement in SYSin cards
Reply with quote

My Requirement is dif

Code: (Input records from a file)
123456789--column position
ADKJBJBBJ---1ST RECORD
ANNMNBMK---2 ND RECORD
HDHBCBBBB--3 RD RECORD


OUT PUT Record expected to 3 files
FIRST FILE SHOULD HAVE RECORDS WHICH HAS 'A' IN POITION 1
Ex
ADKJBJBBJ
ANNMNBMK
SECOND FILE SHOULD HAVE RECORDS WHICH HAS B IN POSITION 7
ex:
ADKJBJBBJ
ANNMNBMK
HDHBCBBBB
THIRD FILE SHOULD HAVE DEDUPED RECORDS AND SHOULD BE SORTED ON POSITION 8.
EX:
ADKJBJBBJ
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Fri Mar 20, 2009 3:14 am    Post subject:
Reply with quote

Why would the third file not have the 2 nd record in it?
Code:
ANNMNBMK---2 ND RECORD
Back to top
View user's profile Send private message
huttesh

New User


Joined: 31 Oct 2008
Posts: 9
Location: bangalore

PostPosted: Fri Mar 20, 2009 3:19 am    Post subject: Reply to: How to use to sort statement in SYSin cards
Reply with quote

Oh I missed it Sorry, Yes it will have the second record.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Mar 20, 2009 3:35 am    Post subject:
Reply with quote

Why would the second file have the 2nd record?
Quote:
SECOND FILE SHOULD HAVE RECORDS WHICH HAS B IN POSITION 7
ex:
Code:

----+----+
ADKJBJBBJ
ANNMNBMK ---> no B in pos-7, still in file-2
HDHBCBBBB
Back to top
View user's profile Send private message
huttesh

New User


Joined: 31 Oct 2008
Posts: 9
Location: bangalore

PostPosted: Fri Mar 20, 2009 8:06 am    Post subject: Reply to: How to use to sort statement in SYSin cards
Reply with quote

icon_surprised.gif

I have corrected my inputs and outputs I am expecting. Can this be
done through a single syncsort step??

Code: (Input records from a file)
123456789--column position
ADKJBJBBJ---1ST RECORD
ANNMNBMK---2 ND RECORD
HDHBCBBBB--3 RD RECORD


OUT PUT Record expected to 3 files
FIRST FILE SHOULD HAVE RECORDS WHICH HAS 'A' IN POITION 1
Ex
ADKJBJBBJ
ANNMNBMK
SECOND FILE SHOULD HAVE RECORDS WHICH HAS B IN POSITION 7
ex:
ADKJBJBBJ
HDHBCBBBB
THIRD FILE SHOULD HAVE DEDUPED RECORDS AND SHOULD BE SORTED ON POSITION 8.
EX:
ADKJBJBBJ
ANNMNBMK
Back to top
View user's profile Send private message
huttesh

New User


Joined: 31 Oct 2008
Posts: 9
Location: bangalore

PostPosted: Tue Mar 24, 2009 10:28 am    Post subject: Can this be done with SYNCSORT
Reply with quote

Code: (Input records from a file)
123456789--column position
ADKJBJBBJ---1ST RECORD
ANNMNBMK---2 ND RECORD
HDHBCBBBB--3 RD RECORD


OUT PUT
FIRST FILE SHOULD HAVE RECORDS WHICH HAS 'A' IN POITION 1
SECOND FILE SHOULD HAVE RECORDS WHICH HAS B IN POSITION 7
THIRD FILE SHOULD HAVE DEDUPED RECORDS AND SHOULD BE SORTED ON POSITION 8.

OUT PUT Record expected to 3 files
FIRST FILE SHOULD HAVE RECORDS WHICH HAS 'A' IN POITION 1
Ex
ADKJBJBBJ
ANNMNBMK
SECOND FILE SHOULD HAVE RECORDS WHICH HAS B IN POSITION 7
ex:
ADKJBJBBJ
HDHBCBBBB
THIRD FILE SHOULD HAVE DEDUPED RECORDS AND SHOULD BE SORTED ON POSITION 8.
EX:
ADKJBJBBJ
ANNMNBMK


We can Achive this by giving below aort condition in first step

SORT FIELDS=COPY
OUTFIL FILES=1,INCLUDE=(1,1,CH,EQ,C'A')
OUTFIL FILES=2,INCLUDE=(7,1,CH,EQ,C'B')

Second Step

SORT FIELDS =(8,1,CH,A)
SUM FIELDS=NONE

My question
I don't want to read the same file in two steps as the file could have million of records and cause performence issue? Any idea of achieving this by reading the file only once by using syncsort in only one step?
Back to top
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 208
Location: Cochin/Kerala/India

PostPosted: Tue Mar 24, 2009 12:37 pm    Post subject:
Reply with quote

Hi huttesh.
Try the below sort card,

SORT FIELDS=(8,1,CH,A)
OUTFIL FILES=1,INCLUDE=(1,1,CH,EQ,C'A'),
TRAILER1=(1:C'COUNT OF A RECORDS',15:COUNT),NODETAIL
OUTFIL FILES=2,INCLUDE=(7,1,CH,EQ,C'B'),
TRAILER1=(1:C'COUNT OF B RECORDS',15:COUNT),NODETAIL
SUM FIELDS=NONE,XSUM

I didnt tested this code just check it out.....

Regards,
Bipin Peter
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 -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
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


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