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
 

 

Need help: Sort file based on two variables using Syncsort.

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

New User


Joined: 12 Jun 2005
Posts: 44
Location: Boston

PostPosted: Thu Nov 19, 2009 10:04 pm    Post subject: Need help: Sort file based on two variables using Syncsort.
Reply with quote

Hi,

I need help in sorting a file based on two binary defined variables (postion 9 to 11 and postion 21 to 23). The position 9 to 11 needs to considered for A type record and 21 to 23 for B type records. The expected output should have 9 to 11 and 21 to 23 in ascending order.

I know there are ways to do this in DFSORT but i couldn't do it using Syncsort. We only have Syncsort at our office.

Input:
A xxxxx 111 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 119 ddddd
A xxxxx 114 xxxxx yyyyy ddddd
A xxxxx 118 xxxxx yyyyy ddddd
A xxxxx 111 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 111 ddddd
B xxxxx xxxxx xxxxx 118 ddddd
B xxxxx xxxxx xxxxx 114 ddddd

Expected output:
A xxxxx 111 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 111 ddddd
A xxxxx 111 xxxxx yyyyy ddddd
A xxxxx 114 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 114 ddddd
A xxxxx 118 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 118 ddddd
B xxxxx xxxxx xxxxx 119 ddddd

Thanks.
KKM.
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 Nov 19, 2009 10:21 pm    Post subject:
Reply with quote

Hello,

Quote:
I know there are ways to do this in DFSOR
How would you code this with DFSORT?

Until the recent PTF for DFSORT was released, Syncsort provided much of the same functionality. . .

Did you try the DFSORT "solution" on your system? If not, suggest you do so. If yes, what happened?
Back to top
View user's profile Send private message
kkxlnc

New User


Joined: 12 Jun 2005
Posts: 44
Location: Boston

PostPosted: Fri Nov 20, 2009 9:13 pm    Post subject:
Reply with quote

I tried writing a DFSORT control card for the same:
INCLUDE COND=(5,1,CH,EQ,C'A',OR,
5,1,CH,EQ,C'T')
INREC
IFTHEN=(WHEN=(730,4,BI,EQ,405),OVERLAY=(3794:405)),
IFTHEN=(WHEN=(730,4,BI,EQ,406),OVERLAY=(3794:406)),
IFTHEN=(WHEN=(730,4,BI,EQ,407),OVERLAY=(3794:407)),
IFTHEN=(WHEN=(730,4,BI,EQ,408),OVERLAY=(3794:408)),
IFTHEN=(WHEN=(730,4,BI,EQ,409),OVERLAY=(3794:409)),
IFTHEN=(WHEN=(730,4,BI,EQ,410),OVERLAY=(3794:410)),
IFTHEN=(WHEN=(730,4,BI,EQ,411),OVERLAY=(3794:411)),
IFTHEN=(WHEN=(730,4,BI,EQ,412),OVERLAY=(3794:412)),
IFTHEN=(WHEN=(730,4,BI,EQ,413),OVERLAY=(3794:413)),
IFTHEN=(WHEN=(730,4,BI,EQ,414),OVERLAY=(3794:414)),
IFTHEN=(WHEN=(112,4,BI,EQ,405),OVERLAY=(3794:405)),
IFTHEN=(WHEN=(112,4,BI,EQ,406),OVERLAY=(3794:406)),
IFTHEN=(WHEN=(112,4,BI,EQ,407),OVERLAY=(3794:407)),
IFTHEN=(WHEN=(112,4,BI,EQ,408),OVERLAY=(3794:408)),
IFTHEN=(WHEN=(112,4,BI,EQ,409),OVERLAY=(3794:409)),
IFTHEN=(WHEN=(112,4,BI,EQ,410),OVERLAY=(3794:410)),
IFTHEN=(WHEN=(112,4,BI,EQ,411),OVERLAY=(3794:411)),
IFTHEN=(WHEN=(112,4,BI,EQ,412),OVERLAY=(3794:412)),
IFTHEN=(WHEN=(112,4,BI,EQ,413),OVERLAY=(3794:413)),
IFTHEN=(WHEN=(112,4,BI,EQ,414),OVERLAY=(3794:414))

SORT FIELDS=(3794,3,CH,A)
REMOVECC,BUILD=(1,3793)

This control card doesn't exactly match the file mentioned above in my post, but for the real production file. I tried running it and then understood that IFTHEN and WHEN are not supported by SYNCSORT. Hence I turned to our forum to look out for help.

Thanks.
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: Fri Nov 20, 2009 9:19 pm    Post subject:
Reply with quote

Hello,

Quote:
I tried running it and then understood that IFTHEN and WHEN are not supported by SYNCSORT
Your understanding is incorrect. . .

Have your system support people install the current version of Syncsort.
Back to top
View user's profile Send private message
Vijayakumar Mani

New User


Joined: 24 Oct 2007
Posts: 11
Location: Salem

PostPosted: Fri Nov 20, 2009 11:40 pm    Post subject: Reply to: Need help: Sort file based on two variables using
Reply with quote

Hi kkxlnc,

Quote:
Expected output:
A xxxxx 111 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 111 ddddd
A xxxxx 111 xxxxx yyyyy ddddd

If my understanding on your requirement is correct, first 3 records of the expected output should be as below since B type record (with 111) in the input appears next to the 2 A type records (with 111).

A xxxxx 111 xxxxx yyyyy ddddd
A xxxxx 111 xxxxx yyyyy ddddd
B xxxxx xxxxx xxxxx 111 ddddd


As dick said your understanding on SYNCSORT is wrong. Did you refer the manual before concluding yourself?

Quote:
Hence I turned to our forum to look out for help

Did you search the forum to check whether IFTHEN and WHEN is supported by SYNCSORT? You can see many posts regarding IFTHEN and WHEN in the forum. Don't assume anything.


Thanks,
Vijay
Back to top
View user's profile Send private message
Vijayakumar Mani

New User


Joined: 24 Oct 2007
Posts: 11
Location: Salem

PostPosted: Fri Nov 20, 2009 11:53 pm    Post subject: Reply to: Need help: Sort file based on two variables using
Reply with quote

Hello,

Quote:
I tried running it and then understood that IFTHEN and WHEN are not supported by SYNCSORT

What error you got and why did you conclude that SYNCSORT does not support this? If you can post your error people can come up with some points (may be you have used it wrongly).

Check the below sort card in case if you have the cuurent version of Syncsort installed.
Code:
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),OVERLAY=(81:9,3)),
      IFTHEN=(WHEN=(1,1,CH,EQ,C'B'),OVERLAY=(81:21,3))
SORT FIELDS=(81,3,CH,A)                               
OUTREC FIELDS=(1,80)                                 

I have assumed the record length as 80 and there are only A and B type records. This code is tested. Check this and let us know whether this works for your requirement.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Wed Dec 02, 2009 10:22 pm    Post subject:
Reply with quote

K2,

IFTHEN and OVERLAY have been supported since SyncSort for z/OS 1.2.1. Which release of SyncSort are you currently running? And as previously requested, what error did you receive when you attempted to submit the job?

Regards,
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 Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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