View previous topic :: View next topic
|
Author |
Message |
antonyjoseph
New User
Joined: 11 Apr 2007 Posts: 28 Location: India
|
|
|
|
I have two input files of the same length. I want to check if a record in FILE2 exist in FILE1 and if it deosnot i want to write this record into a new file.
BTW i have only SYNCSORT.
EG:
FILE1 FILE2 OUTPUT
------ ------ ---------
CAT AND AND
LOT CAT RAT
BAT RAT NOT
PAT PAT MET
SIT NOT
SIT
MET |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Syncsort has the capability you need:
Quote: |
Retaining Unpaired Records
When joining files, a record from one file may or may not have a match in the other file. A match occurs when the contents of the join keys in the record from the first file equal the contents of the join keys in the record from the second file.
By specifying the JOIN statement you can discard unpaired records from one or both files, or retain unpaired records from both files. |
Have you looked into your manual? |
|
Back to top |
|
|
vkphani
New User
Joined: 29 Oct 2003 Posts: 29
|
|
|
|
Try this:
Code: |
//S1 EXEC PGM=ICETOOL
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD DSN=FILE1,DISP=SHR
// DD DSN=FILE2,DISP=SHR
//TOOLIN DD *
SELECT FROM(CON) TO(OUT1) ON(1,4,CH) ALLDUPS USING(CTL3)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=(OUT1,OUT2),SPLIT
/* |
|
|
Back to top |
|
|
antonyjoseph
New User
Joined: 11 Apr 2007 Posts: 28 Location: India
|
|
|
|
The code dint work for me.
I want to get the list of records that are present only in SECOND file and is not present in FIRST record.
Thanks anyways |
|
Back to top |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
hey,
Use this code..
Code: |
//STEP1 EXEC PGM=ICETOOL
//IN1 DD DSN=XXXXXX.YYYY,DISP=SHR
//IN2 DD DSN=AAAAAA.BBBB,DISP=SHR
//TEMP1 DD DSN=TEMP1,DISP=(MOD,PASS)
//TEMP2 DD DSN=TEMP2,DISP=(MOD,PASS)
//OUT1 DD SYSOUT=*
//*
//TOOLIN DD *
COPY FROM(IN1) TO(TEMP1) USING(CTL1)
COPY FROM(IN2) TO(TEMP1) USING(CTL2)
SELECT FROM(TEMP1) TO(TEMP2) ON(1,4,CH) NODUPS
COPY FROM(TEMP2) TO(OUT1) USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'1')
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'2')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,80)
/*
//TOOLMSG DD SYSOUT=*
//SSMSG DD SYSOUT=* |
This wil give ur desired output.. assumed that i/p files are Lrecl 80.
tel me if u have any probs... |
|
Back to top |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
And one more thing..
In ur first post ur output is shown as
In the last post u said..
Quote: |
I want to get the list of records that are present only in SECOND file and is not present in FIRST record. |
But i couldn't see the value MET in the second file.
was that a typo?? |
|
Back to top |
|
|
antonyjoseph
New User
Joined: 11 Apr 2007 Posts: 28 Location: India
|
|
|
|
Yea tat was a typo |
|
Back to top |
|
|
antonyjoseph
New User
Joined: 11 Apr 2007 Posts: 28 Location: India
|
|
|
|
William,
I got JOIN as invalid SORT keyword |
|
Back to top |
|
|
antonyjoseph
New User
Joined: 11 Apr 2007 Posts: 28 Location: India
|
|
|
|
Hey,
Is
INREC OVERLAY a feature of SYNCSORT. Have never used this before |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
antonyjoseph wrote: |
I got JOIN as invalid SORT keyword |
It is a statement all by itself, have you checked your manual?
Post your jcl and sysout. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
If Syncsort is your sort product, i'd suggest that you be wary of solutions that use ICETOOL. They are most likely DFSORT solutions and may not work with Syncsort. Not all of the options from one product are available in the other.
Some sites also are setup to execute Syncsort if ICETOOL is specified in the jcl.
If you don't have the Syncsort manuals, i'd suggest you get them from the vendor. If your site is a licensed user, they are available for free - Syncsort support will tell you how to "download" them. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Heck, just emailing their tech-support from your (licensed) shop will get you a copy........ |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello antonyjoseph,
Do you have this working now?
If not, please post the jcl for this step including the sort control statements and all of the output messages from the sort step.
From that we can offer suggestions to correct the problem(s). |
|
Back to top |
|
|
antonyjoseph
New User
Joined: 11 Apr 2007 Posts: 28 Location: India
|
|
|
|
Well i dont think i will get JOIN to work for me. i have SYNCSORT 1.1 and i read JOIN is a feature of 1.2 for Zos.
I eventually had to write a COBOL pgm for it |
|
Back to top |
|
|
antonyjoseph
New User
Joined: 11 Apr 2007 Posts: 28 Location: India
|
|
|
|
Code: |
//TEST EXEC PGM=SORT
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD *
AA
BB
CC
AB
//SORTJNF2 DD *
BB
AD
DD
EE
//SORTOUT DD DSN=TEST.SORT,
// DISP=(,CATLG,DELETE),
// UNIT=TESTDA,
// SPACE=(CYL,(5,5),RLSE)
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,3,A)
JOINKEYS FILES=F2,FIELDS=(1,3,A)
JOIN UNPAIRED,F1,ONLY
REFORMAT FIELDS=(F1:1,3)
SORT FIELDS=COPY
//* |
|
|
Back to top |
|
|
|