View previous topic :: View next topic
|
Author |
Message |
Mariraj
New User
Joined: 09 Jul 2007 Posts: 59 Location: Chennai
|
|
|
|
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 |
|
|
Mariraj
New User
Joined: 09 Jul 2007 Posts: 59 Location: Chennai
|
|
|
|
The input and output files are of length 80 and FB format. Sorry I missed the info in my prevous post. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Mariraj
New User
Joined: 09 Jul 2007 Posts: 59 Location: Chennai
|
|
|
|
I am looking for a solution with SYNCSORT only though my shop supports both products. |
|
Back to top |
|
|
Mariraj
New User
Joined: 09 Jul 2007 Posts: 59 Location: Chennai
|
|
|
|
Sorry missed the version. It is SYNCTOOL RELEASE 1.6.2 |
|
Back to top |
|
|
jerryte
Active User
Joined: 29 Oct 2010 Posts: 202 Location: Toronto, ON, Canada
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi jerryte,
have you tested your code ?
Gerry |
|
Back to top |
|
|
jerryte
Active User
Joined: 29 Oct 2010 Posts: 202 Location: Toronto, ON, Canada
|
|
|
|
No. That is why I said to try it. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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
Gerry |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
Mariraj
New User
Joined: 09 Jul 2007 Posts: 59 Location: Chennai
|
|
|
|
Thanks Gerry for the solution. It worked perfectly fine. |
|
Back to top |
|
|
|