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

Icetool to comapre two files


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

New User


Joined: 10 Feb 2008
Posts: 19
Location: bhuneswar

PostPosted: Thu Nov 12, 2009 12:20 am
Reply with quote

Hi

I need to comapre the two files from which

First file is like

021234555555
003448999999
223456777777
021234555555
345905111111
021234556755
023324443337

Requirement from above file is to
1) include records that start with 02 only
2) if there are duplicate record that starts with 02 then keep the single
(can be either first or last) record only.

I am using below control card (CTL1) for the above requiremnt but not getting result
P

//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,7,CH) NODUPS USING(CTL3) DISCARD(OUT1)
/*
//CTL1CNTL DD *
INCLUDE COND=(1,2,CH,EQ,C'02')
SORT FIELDS=(1,12,CH,A)
SUM FIELDS=NONE

kindly help

Thanks in advance
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Nov 12, 2009 12:36 am
Reply with quote

You've only shown/explained part of your requirement.

Please show an example of the records in each input file and what you expect for output. Explain the complete rules for comparing the two files. Give the RECFM and LRECL of each input file. Give the starting position, length and format of each relevant field in each input file.
Back to top
View user's profile Send private message
sumitmalik29
Warnings : 1

New User


Joined: 10 Feb 2008
Posts: 19
Location: bhuneswar

PostPosted: Thu Nov 12, 2009 11:28 am
Reply with quote

Hi Frank,

Below is my full requirement

Two files that are required to compare are

Fille 1
020001111111111AAA
120002222222222BBB
130003333333333CCC
020004444444444DDD
020004444444444EEE
340006666666666FFF
020004444444444GGG
020005555555555HHH
020005555555555III


File1 - contains policy numbers from columns 6 to 15
I have to include policy number for those records that start with '02' in cols 1 to 2

File 2
001111111111777
009999999999777
008888888888777
005555555555777
003333333333777
006666666666777
004444444444777
003333333333777
009999999999777
009999999999777

File2 - contains policy numbers from columns 3 to 12


Output Expected

009999999999777
008888888888777
006666666666777
003333333333777

file1 -> LRECL =18
file2 -> LRECL =15

I have to compare File1 and File2 on the basis of policy number,

If the policy number present in File2 is not matched with policy number in File1(for records that start with 02)
then policy number from file2 , needs to written to a third file.

If the file2 contains duplicate policy numbers that are not matching with file1 policy number,
then only one instance of policy number from file2 is to be written in third file,

Thanks in advance for your help.

Sumit
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Nov 13, 2009 1:47 am
Reply with quote

sumitmalik29,

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//FB18     DD DSN=your FB 18 byte file,DISP=SHR
//FB15     DD DSN=your FB 15 byte file,DISP=SHR                         
//TEMP     DD DSN=&&TEMP,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)     
//OUT      DD SYSOUT=*                                             
//TOOLIN   DD *                                                     
  COPY FROM(FB18) USING(CTL1)                                       
  COPY FROM(FB15) USING(CTL2)                                       
  SORT FROM(TEMP) USING(CTL3)                                       
//CTL1CNTL DD *                                                     
  INCLUDE COND=(1,2,CH,EQ,C'02')                                   
  OUTFIL FNAMES=TEMP,BUILD=(3:6,10,3X,C'1')                         
//CTL2CNTL DD *                                                     
  OUTFIL FNAMES=TEMP,OVERLAY=(16:C'2')                             
//CTL3CNTL DD *                                                     
  SORT FIELDS=(3,10,CH,A),EQUALS                                   
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(18:SEQNUM,8,ZD,RESTART=(3,10))),
  IFTHEN=(WHEN=GROUP,BEGIN=(18,8,ZD,EQ,1),PUSH=(17:16,1))           
  OUTFIL FNAMES=OUT,INCLUDE=(16,2,ZD,EQ,22,AND,18,8,ZD,EQ,1),       
  BUILD=(1,15)                                                     
//*
Back to top
View user's profile Send private message
sumitmalik29
Warnings : 1

New User


Joined: 10 Feb 2008
Posts: 19
Location: bhuneswar

PostPosted: Fri Nov 13, 2009 4:24 pm
Reply with quote

Hi Skolusu I am getting below syntax error,



SORT FIELDS=(3,10,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(18:SEQNUM,8,ZD,RESTART=(3,10))),
IFTHEN=(WHEN=GROUP,BEGIN=(18,8,ZD,EQ,1),PUSH=(17:16,1))
*
OUTFIL FNAMES=OUT,INCLUDE=(16,2,ZD,EQ,22,AND,18,8,ZD,EQ,1),
BUILD=(1,15)
WER428I CALLER-PROVIDED IDENTIFIER IS "0003"
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

It seems that my system don't support, Group, Push Function.

Anyways, thanks for your time and help
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Nov 13, 2009 4:41 pm
Reply with quote

Why do you NOT check which sort product you are using before posting, or at least state which one it is icon_evil.gif

This is yet another case of people not doing their work before asking others to do it for them.

Your product is SYNCSORT NOT DFSORT

So someone has wasted time and effort on a solution that DOES NOT work because you could not be bothered to check which product is in use at your site.
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: Fri Nov 13, 2009 8:36 pm
Reply with quote

Hello,

Quote:
It seems that my system don't support, Group, Push Function.
If your system was running the current release of Syncsort, WHEN=GROUP is available. Have your product upgraded. . .
Back to top
View user's profile Send private message
sumitmalik29
Warnings : 1

New User


Joined: 10 Feb 2008
Posts: 19
Location: bhuneswar

PostPosted: Sat Nov 14, 2009 1:03 am
Reply with quote

I do apologize for this and will take care that it won't happen in future

I am really thankful to Skolusu for his time and help.

Again sorry for inconvience caused

Regards
Sumit
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: Sat Nov 14, 2009 2:10 am
Reply with quote

Hello,

Quote:
Again sorry for inconvience caused
You weren't the first and surely won't be the last - it is one of our most re-curring themes icon_smile.gif
Now you know. . . icon_wink.gif

You might use the forum search and find some similar requests that have a pre-WHEN=GROUP solution.

Suggest that your system be upgraded as the current release has been available for quite a while now. . .
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 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
Search our Forums:

Back to Top