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

Comparing 2 files and write out only the unmatched records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gragha

New User


Joined: 25 Jul 2006
Posts: 23

PostPosted: Thu Feb 26, 2009 3:23 am
Reply with quote

Hi,

I have file A and file B of 4000 bytes each.

I need to compare file A and file B and write out only the unmatched records from file B into file C (which is also 4000 bytes). Can this be accomplished by sort.

Example:

File A:

1234A
1234B
1234C
1234D

File B:

1234C
1234D
1234E
1234F

Output in File C should be:

1234E
1234F

Please let me know. 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 Feb 26, 2009 3:47 am
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input fileA (FB/4000)
//IN2 DD DSN=...  input fileB (FB/4000)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/4000)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,5,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(4001:C'1')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(4001:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(4001,1,CH,EQ,C'2'),
    BUILD=(1,4000)
/*
Back to top
View user's profile Send private message
gragha

New User


Joined: 25 Jul 2006
Posts: 23

PostPosted: Thu Feb 26, 2009 8:29 pm
Reply with quote

Thanks, Much appreciated.
Back to top
View user's profile Send private message
pushpagiri

New User


Joined: 07 Jul 2005
Posts: 51

PostPosted: Thu Mar 19, 2009 10:20 pm
Reply with quote

Hi Frank Yaeger,

Please help me in this. I have same requirement, but the input files are of VB type.
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 Mar 19, 2009 11:04 pm
Reply with quote

Here's an equivalent DFSORT/ICETOOL job for VB files:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input fileA (VB)
//IN2 DD DSN=...  input fileB (VB)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (VB)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(6,5,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,4,5:C'1',6:5)
/*
//CTL2CNTL DD *
  INREC BUILD=(1,4,5:C'2',6:5)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(5,1,CH,EQ,C'2'),
    BUILD=(1,4,5:6)
/*
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Fri Feb 26, 2010 10:21 pm
Reply with quote

Hi Frank,

I have a similar kind of problem, Please see below:-

File 1 :-
----+----1----+----2----+----3----
*********************************
BRS4WVG27 S47127
BRS8UJ438 S60426
BRS8UJC47 S61297
BRS8UL466 SB0P6L
228227104US22822710462285991
BRS4WUP03 SB07YZ
SB09BYK17ZAE000030920B09BYK1
SB66FWT34US17313X1789B66FWT3S62767
BRS8LWG28 S65726
SB28T2K67BRAMILACNOR0B28T2K6
BRS8VG953 SB58MY
91030T109US91030R1032B29T0B2
S62496369KR70004300096249636


File 2:-
----+----1----+----2----+----3----+----4----
2010-02-24MYL4243OO001Y9649X108MYL4243OO001C
2010-02-24HK2827039002Y96541100HK2827039002E
2010-02-24TW0003036000Y9657B105TW0003036000C
2010-02-24TW0002384005Y9664Q103TW0002384005C
2010-02-24INE075A01022Y96659142INE075A01022C
2010-02-24TW0003231007Y96738102TW0003231007C
2010-02-24TW0006285000Y96739100TW0006285000C
2010-02-24KR7082850009Y9692V108KR7082850009C


File 1 description--
LRECL=550 , RECFM=FB, Field1 = start from 1 having length 9

File 2 description--
LRECL= 204, RECFM=FB, Field2 = start from 23 having length 9

File 3 description--
same as File-1.

There should be 1 output file file-3 which contain mismatch records from file1 only. Comparison will be done between field1 and Field2.

Please let me know if you need further info. Can we do this using sort.
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: Fri Feb 26, 2010 10:48 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what I think you're asking for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input fileA (FB/550)
//IN2 DD DSN=...  input fileB (FB/204)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/550)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,9,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(551:C'1')
/*
//CTL2CNTL DD *
  INREC BUILD=(23,9,551:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(551,1,CH,EQ,C'1'),
    BUILD=(1,550)
/*
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Fri Feb 26, 2010 11:45 pm
Reply with quote

Thanks!!
But this code is giving me an error-


SORTOUT LRECL OF 550 IS DIFFERENT FROM SORTIN(NN) LRECL OF 204 -,RC=0
END OF OUT FIELD BEYOND MAXIMUM RECORD LENGTH

Please check...
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: Sat Feb 27, 2010 12:15 am
Reply with quote

Code:
SORTOUT LRECL OF 550 IS DIFFERENT FROM SORTIN(NN) LRECL OF 204 -,RC=0
END OF OUT FIELD BEYOND MAXIMUM RECORD LENGTH


That message does NOT match the job I gave you. You must have changed something.

Please show your complete job source and the //DFSMSG messages you received.
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Sat Feb 27, 2010 12:26 am
Reply with quote

JCL used=>

//SBDEEMU2 JOB (1,50370),'SORT',CLASS=H,MSGCLASS=Y,
// MSGLEVEL=(1,1),NOTIFY=&SYSUID
//STEP10R EXEC PGM=ICETOOL
//STEPLIB DD DSN=SYSE.TE.MERP.ALL.LOADB,DISP=SHR
//*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=MLB9173.UPLD.CPX021XA.ALADSECF.FEB24101,DISP=SHR
//IN2 DD DSN=MLB9173.OTHR.CPX020PA.SECLOAD1.FEB24101,DISP=SHR
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(2200,500),RLSE),
// DISP=(MOD,PASS)
//OUT DD DSN=MLB9173.UPLD.CPX021XA.ALADSECF.FEB24102,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(2200,500),RLSE),
// DCB=(RECFM=FB,LRECL=550,BLKSIZE=0)
//*
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,9,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(551:C'1')
/*
//CTL2CNTL DD *
INREC BUILD=(23,9,551:C'2')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(551,1,CH,EQ,C'1'),
BUILD=(1,550)
/*


//DFSMSG =>

,ICE090I,0 OUTPUT LRECL = 550, BLKSIZE = 27500, TYPE = FB
ICE171I 0 SORTOUT LRECL OF 550 IS DIFFERENT FROM SORTIN(NN) LRECL OF 204 - RC=0
ICE055I 0 INSERT 0, DELETE 0
ICE054I 0 RECORDS - IN: 15602, OUT: 15602
ICE052I 0 END OF DFSORT
1ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0003
ICE143I 0 BLOCKSET SORT TECHNIQUE SELECTED
ICE250I 0 VISIT www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
ICE000I 0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 13:27 ON FRI F
0 OUTFIL FNAMES=OUT,INCLUDE=(551,1,CH,EQ,C'1'),
BUILD=(1,550)
ICE146I 0 END OF STATEMENTS FROM CTL3CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL3,SORTIN=T1,S
TOUT=OUT,DYNALLOC,SZERO,EQUALS,NOVLSHRT,LOCALE=NONE,NO
ECK
SORT FIELDS=(1,9,CH,A)
MODS E35=(ICE35DU,12288)
ICE201I F RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE027A 9 END OF OUT FIELD BEYOND MAXIMUM RECORD LENGTH
ICE751I 0 C5-K48846 C6-K90014 C7-K45047 C8-K46331 E4-BASE E7-K48846
ICE052I 3 END OF DFSORT
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Sat Feb 27, 2010 1:13 am
Reply with quote

Anyone get that!!
Please reply me asap..

Thanks,
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: Sat Feb 27, 2010 1:59 am
Reply with quote

Well, it would have helped if you'd shown ALL of the //DFSMSG messages, but I think I can take an educated guess as to what's wrong.

My guess is that your site has changed the shipped installation default of SOLRF=YES to SOLRF=NO. This is NOT recommended! You can look up these options in "z/OS DFSORT Installation and Customization" to see what they do.

To override your site's bad choice, you would have to add this to your job (and probably to other jobs):

Code:

//DFSPARM DD *
   OPTION SOLRF
/*


You might want to ask your System Programmers why they changed the default from SOLRF=YES to SOLRF=NO and if they realize what problems that can cause.

Quote:
Please reply me asap.


Sorry I didn't respond sooner, but I had the bad manners to go to lunch because I was hungry.
icon_rolleyes.gif
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
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 Pulling a fixed number of records fro... DB2 2
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
Search our Forums:

Back to Top