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

Move unique files to another file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
antonyjoseph

New User


Joined: 11 Apr 2007
Posts: 28
Location: India

PostPosted: Sat Apr 21, 2007 7:00 pm
Reply with quote

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. icon_sad.gif


EG:

FILE1 FILE2 OUTPUT
------ ------ ---------
CAT AND AND
LOT CAT RAT
BAT RAT NOT
PAT PAT MET
SIT NOT
SIT
MET
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Sat Apr 21, 2007 7:32 pm
Reply with quote

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
View user's profile Send private message
vkphani

New User


Joined: 29 Oct 2003
Posts: 29

PostPosted: Mon Apr 23, 2007 3:33 pm
Reply with quote

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
View user's profile Send private message
antonyjoseph

New User


Joined: 11 Apr 2007
Posts: 28
Location: India

PostPosted: Mon Apr 23, 2007 4:21 pm
Reply with quote

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
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Mon Apr 23, 2007 7:45 pm
Reply with quote

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... icon_biggrin.gif
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Mon Apr 23, 2007 7:48 pm
Reply with quote

And one more thing..

In ur first post ur output is shown as

Quote:
AND
RAT
NOT
MET


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?? icon_lol.gif
Back to top
View user's profile Send private message
antonyjoseph

New User


Joined: 11 Apr 2007
Posts: 28
Location: India

PostPosted: Mon Apr 23, 2007 8:30 pm
Reply with quote

Yea tat was a typo icon_redface.gif
Back to top
View user's profile Send private message
antonyjoseph

New User


Joined: 11 Apr 2007
Posts: 28
Location: India

PostPosted: Mon Apr 23, 2007 9:41 pm
Reply with quote

William,
I got JOIN as invalid SORT keyword icon_cry.gif
Back to top
View user's profile Send private message
antonyjoseph

New User


Joined: 11 Apr 2007
Posts: 28
Location: India

PostPosted: Mon Apr 23, 2007 10:03 pm
Reply with quote

Hey,
Is
INREC OVERLAY a feature of SYNCSORT. Have never used this before
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Apr 23, 2007 10:06 pm
Reply with quote

antonyjoseph wrote:
I got JOIN as invalid SORT keyword icon_cry.gif
It is a statement all by itself, have you checked your manual?
Post your jcl and sysout.
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: Tue Apr 24, 2007 1:33 am
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Apr 24, 2007 1:42 am
Reply with quote

Heck, just emailing their tech-support from your (licensed) shop will get you a copy........
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: Tue Apr 24, 2007 3:48 am
Reply with quote

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
View user's profile Send private message
antonyjoseph

New User


Joined: 11 Apr 2007
Posts: 28
Location: India

PostPosted: Tue Apr 24, 2007 9:57 am
Reply with quote

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 icon_sad.gif
Back to top
View user's profile Send private message
antonyjoseph

New User


Joined: 11 Apr 2007
Posts: 28
Location: India

PostPosted: Tue Apr 24, 2007 10:04 am
Reply with quote

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
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 Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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