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

Selecting records using SYNCSORT


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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Mar 21, 2011 3:59 pm
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
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
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: 202
Location: Toronto, ON, Canada

PostPosted: Fri Mar 25, 2011 12:31 am
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: 1702
Location: Australia

PostPosted: Fri Mar 25, 2011 10:03 am
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: 202
Location: Toronto, ON, Canada

PostPosted: Fri Mar 25, 2011 7:02 pm
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: 1702
Location: Australia

PostPosted: Sat Mar 26, 2011 1:56 pm
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: 1702
Location: Australia

PostPosted: Sun Mar 27, 2011 7:44 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
No new posts JCL sortcard to print only the records DFSORT/ICETOOL 11
Search our Forums:

Back to Top