IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to use to sort statement in SYSin cards


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 2481
Location: @my desk

PostPosted: Thu Mar 19, 2009 12:07 am
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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 19, 2009 12:10 am
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
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: 2481
Location: @my desk

PostPosted: Thu Mar 19, 2009 9:21 am
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
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: 2481
Location: @my desk

PostPosted: Thu Mar 19, 2009 2:25 pm
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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 19, 2009 8:24 pm
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
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: 2146
Location: At my coffee table

PostPosted: Thu Mar 19, 2009 9:50 pm
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: 2481
Location: @my desk

PostPosted: Fri Mar 20, 2009 12:20 am
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
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: 2146
Location: At my coffee table

PostPosted: Fri Mar 20, 2009 2:14 am
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
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
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
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: 2481
Location: @my desk

PostPosted: Fri Mar 20, 2009 3:35 am
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
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
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: 213
Location: Cochin/Kerala/India

PostPosted: Tue Mar 24, 2009 12:37 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
Search our Forums:

Back to Top