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
 

 

Selecting records using SYNCSORT

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

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Mon Mar 21, 2011 2:35 pm    Post subject: Selecting records using SYNCSORT
Reply with quote

INPUT FILE:
ORIG-CODE1 FIRM1
ORIG-CODE1 FIRM1
ORIG-CODE1 FIRM2
ORIG-CODE2 FIRM1
ORIG-CODE2 FIRM1
ORIG-CODE3 FIRM1


OUTPUT:
ORIG-CODE1 FIRM1
ORIG-CODE1 FIRM1
ORIG-CODE1 FIRM2


The requirement is to select records which will more than one firm-id for a orig-code. In the above input, ORIG-CODE3 had only one record with FIRM1 and ORIG-CODE2 had 2 records but with the same FIRM1. So both of the ORIG-CODEs have to be omitted. Only ORIG-CODE1 which had different FIRMs have to be selected.

I am trying to do it in a single step. I tried the following.

Code:
SELECT FROM(INPUT) TO(DUPS) ON(1,10,CH) ALLDUPS         
SELECT FROM(DUPS) TO(OUT)  ON(1,10,CH) ON(12,5,CH) NODUPS


DUPS-Temp file

and got the following output

ORIG-CODE1 FIRM1
ORIG-CODE1 FIRM2


Can someone please suggest how to arrive at the correct output. I am also looking to do it in a single operation instead of writing to the temporary file DUPS and then doing another operation on it.
Back to top
View user's profile Send private message

Mariraj

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Mon Mar 21, 2011 2:42 pm    Post subject: Reply to: Selecting records using SYNCSORT
Reply with quote

The input and output files are of length 80 and FB format. Sorry I missed the info in my prevous post.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Mar 21, 2011 3:59 pm    Post subject: Reply to: Selecting records using SYNCSORT
Reply with quote

what is necessary to know is what sort product You are using!
dfsort or syncsort

You did not provide enough info

DFSORT questions get better reply on the DFSORT/ICETOOL section where the answers are provided by DFSORT developers

SYCNSORT question are handled in the JCL section

Run the code below and post the JES SYSOUT element so that we can see the sort product and release level that you have installed.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY


the topic unrelated to Your sort product will be deleted!
Back to top
View user's profile Send private message
Mariraj

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Mon Mar 21, 2011 4:05 pm    Post subject:
Reply with quote

I am looking for a solution with SYNCSORT only though my shop supports both products.
Back to top
View user's profile Send private message
Mariraj

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Mon Mar 21, 2011 4:12 pm    Post subject:
Reply with quote

Sorry missed the version. It is SYNCTOOL RELEASE 1.6.2
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 183
Location: Toronto, ON, Canada

PostPosted: Fri Mar 25, 2011 12:31 am    Post subject:
Reply with quote

Try doing it with just one sort control card with just one field.

Code:
SELECT FROM(INPUT) TO(OUT) ON(1,16,CH) ALLDUPS
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Mar 25, 2011 10:03 am    Post subject:
Reply with quote

Hi jerryte,

have you tested your code ?


Gerry
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 183
Location: Toronto, ON, Canada

PostPosted: Fri Mar 25, 2011 7:02 pm    Post subject:
Reply with quote

No. That is why I said to try it.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Sat Mar 26, 2011 1:56 pm    Post subject:
Reply with quote

Hi Mariraj,

are you sure you are getting this result with your code ?

Code:
ORIG-CODE1 FIRM1
ORIG-CODE1 FIRM2



When I run it, the result is this
Code:
ORIG-CODE1 FIRM2



Gerry
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Sun Mar 27, 2011 7:44 am    Post subject:
Reply with quote

Hi Mariraj,

Quote:
Can someone please suggest how to arrive at the correct output. I am also looking to do it in a single operation instead of writing to the temporary file DUPS and then doing another operation on it.

For someone who has not even worked out a solution, you are placing a lot of restrictions.

Personally I would be happy with a working solution full stop.

Anyway, you can try this if it takes your fancy
Code:
//STEP0001 EXEC PGM=SYNCTOOL                                       
//INPUT    DD *                                                     
ORIG-CODE1 FIRM1                                                   
ORIG-CODE1 FIRM1                                                   
ORIG-CODE1 FIRM2                                                   
ORIG-CODE2 FIRM1                                                   
ORIG-CODE2 FIRM1                                                   
ORIG-CODE3 FIRM1                                                   
//FIRST    DD DSN=&&FIRST,DISP=(,PASS,DELETE),UNIT=SYSDA,           
//            SPACE=(TRK,(10,5),RLSE)                               
//PULLOUT  DD DSN=&&PULLOUT,DISP=(,PASS,DELETE),UNIT=SYSDA,         
//            SPACE=(TRK,(10,5),RLSE)                               
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//TOOLIN   DD *                                                     
  SELECT FROM(INPUT) TO(FIRST) ON(1,16,CH) FIRST                   
  COPY FROM(FIRST) TO(PULLOUT) USING(CTL1)                         
/*                                                                 
//CTL1CNTL DD *   
   INREC OVERLAY=(73:SEQNUM,8,ZD,RESTART=(1,10))               
   OUTFILE FNAMES=PULLOUT,INCLUDE=(73,8,ZD,EQ,+2)               
/*                                                             
//STEP0002 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTJNF1 DD DSN=&&PULLOUT,DISP=SHR                           
//SORTJNF2 DD *                                                 
ORIG-CODE1 FIRM1                                               
ORIG-CODE1 FIRM1                                               
ORIG-CODE1 FIRM2                                               
ORIG-CODE2 FIRM1                                               
ORIG-CODE2 FIRM1                                               
ORIG-CODE3 FIRM1                                               
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  JOINKEYS FILE=F1,FIELDS=(1,10,A)                             
  JOINKEYS FILE=F2,FIELDS=(1,10,A)                             
  REFORMAT FIELDS=(F2:1,80)                                     
  SORT FIELDS=COPY                                             
/*                                                             
                                               



Gerry
Back to top
View user's profile Send private message
Mariraj

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Mon Mar 28, 2011 11:39 am    Post subject:
Reply with quote

Thanks Gerry for the solution. It worked perfectly fine.
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: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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