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

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


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Thu Nov 19, 2009 10:21 pm
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
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

Moderator Emeritus


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

PostPosted: Fri Nov 20, 2009 9:19 pm
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
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
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: 496
Location: USA

PostPosted: Wed Dec 02, 2009 10:22 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top