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

Compare 2 files write results to a 3rd file


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

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Thu Jan 29, 2009 7:49 pm
Reply with quote

Requirement - compare FileA & FileB, any matches found in FileB write to an output file.
FileA FB 237 bytes Key=2,7(alphanumeric)
FileB FB 1000 bytes Key=61,7(alphanumeric).

You provided me with the following JCL which works fine when FileB FB 100 bytes Key=55,7(alphanumeric). I have tried tweaking your jcl but cannot get it to work. Thanks for your help.

Code:
//* STEP0100 WILL ELIMINATE THE DUPLICATES FROM 237 BYTE FILE           
//* AND CREATE A 100 BYTE FILE POPULATING THE KEY FROM POS 2 FOR 7 BYTES
//* ONTO POS 55.                                                       
//*                                                                     
//*                                                                     
//**********************************************************************
//STEP0100 EXEC PGM=ICEMAN                                             
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=DTSX018.C1000.MASTFILE.REFRESH.SORTED,DISP=SHR       
//SORTOUT  DD DSN=&&I2,DISP=(,PASS),SPACE=(CYL,(5,5),RLSE)             
//SYSIN    DD *                                                         
  INREC BUILD=(2,7)                                                     
  SORT FIELDS=(1,7,CH,A)                                               
  SUM FIELDS=NONE                                                       
  OUTREC BUILD=(55:1,7,100:X)
//**********************************************************************
//*                                                                     
//* STEP0200 WILL CONCATENATE 100 ORGINAL FILE AND THE FILE CREATED     
//* IN STEP ABOVE AND PICK ALL THE DUPLICATES AS ANY MATCHING KEY       
//* WILL BE A DUPLICATE. USING OMIT ON OUTFIL DROP THE RECORDS CREATED 
//* IN STEP0100 THERE BY RESULTING IN THE DESIRED OUTPUT               
//*                                                                     
//**********************************************************************
//STEP0200 EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN       DD DSN=TCSRGA.C1000.ASSET.ADASTRIP.TESTAF.B,DISP=SHR         
//         DD DSN=&&I2,DISP=SHR                                         
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
  SELECT FROM(IN) ON(55,7,CH) TO(OUT) ALLDUPS USING(CTL1)               
//CTL1CNTL DD *                                                         
  OMIT COND=(55,7,CH,EQ,C' ')                                           
  OUTFIL FNAMES=OUT,OMIT=(1,54,CH,EQ,C' ',AND,62,39,CH,EQ,C' ')         
/*                                                                                                               


FileA -

Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
1AA187  SALLMAMC36A218646   1129122005B2358                    02926J 2062097610
1AA279  303                 0023081994G9000DELAUGERE ETCLAYETTE06000C 103202   
1AA2938 753                 0012021921G9000         THORNYCROFT04624C 112L483   
1AA54   VF3231A3216164131   1129092001L1362                    01905N 222CULD303
1AA55   WDB2110412B345921   0116052008MD771                    01796H 1022719563
1AA58   0011                0002021921G9000       PHOENIX TRIMO00490W 10911000 


FileB -

Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
0632537776860DVL0506R0630007369682VE7936                    AA2609             
0633832039118DVL0807R0630007369682VE303                     AA279               
0632714760459DVL0801R0630007369682VEG3                      AA286               
0630914276053STCOPCP 0630007369682VE52418                   AA2951             
0630913757726STCOPCP 0630007369682VE892THLCMK02051          AA3333             
0632537776861DVL0506R0630007369682VE172                     AA360               
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: Thu Jan 29, 2009 10:16 pm
Reply with quote

Hello,

What did you try? What happened?

Posting "i did something that didn't work" is useless. . .

You need to mention what you tried and post the error(s) or undesired results so someone can better help.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Jan 29, 2009 10:27 pm
Reply with quote

Richard Galley,

The following JCL will give you the desired results

Code:

//**********************************************************************
//STEP0100 EXEC PGM=ICEMAN                                           
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN=Your 237byte dups file,
//            DISP=SHR
//SORTOUT  DD DSN=&&FILEA,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)       
//SYSIN    DD *                                                     
 INREC BUILD=(2,7)                                                   
 SORT FIELDS=(1,7,CH,A)                                             
 SUM FIELDS=NONE                                                     
 OUTREC BUILD=(61:1,7,1000:X)                                       
//*                                                   
//**********************************************************************
//*                                                                     
//* STEP0200 WILL CONCATENATE THE ABOVE CREATED TEMP FILE TO THE 1000 BYTE
//* ORGINAL FILE. ie. THE TEMPFILE WILL BE FIRST IN THE CONCATENATION LIST
//* WE PICK THE LASTDUP AS ANY MATCHING KEY WILL BE A DUPLICATE AND WE       
//* ARE PICKING THE LASTDUP AS ORIGINAL FILE IS CONCATENATED LAST
//* THERE BY RESULTING IN THE DESIRED OUTPUT               
//*
//**********************************************************************
//STEP0200 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD DSN=&&FILEA,
//            DISP=SHR                           
//         DD DSN=Your 1000 byte fileb,
//            DISP=SHR                           
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                             
  SELECT FROM(IN) TO(OUT) ON(61,7,CH) LASTDUP USING(CTL1)   
//CTL1CNTL DD *                                             
  OMIT COND=(61,7,CH,EQ,C' ')                               
//*                                               
Back to top
View user's profile Send private message
Richard Galley

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Thu Jan 29, 2009 10:44 pm
Reply with quote

Thanks Skolusu

I have run this but the key field is now in pos 62(should be 61). This is what happened when I amended your original code and ran it.

Code:
---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8-
********************************* TOP OF DATA **********************************
0633832039118DVL0807R0630007369682VE303                     AA279               
0633832039116DVL0807R0630007369682VE0011                    AA58               
0633826069135STCOPCP 0630007369898VE61217124                AB4088             
0633832039139DVL0807R0630007369898VE11699                   AB9028             
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Jan 29, 2009 10:50 pm
Reply with quote

richard galley,

*sigh* where exactly does your key in fileb start? 61 or 62?


If it is 62

change #1
Quote:

OUTREC BUILD=(62 :1,7,1000:X)

change # 2
Quote:

SELECT FROM(IN) TO(OUT) ON(62,7,CH) LASTDUP USING(CTL1)
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Fri Jan 30, 2009 12:25 am
Reply with quote

If it is 62

change #3 ?
Quote:
OMIT COND=(62,7,CH,EQ,C' ')


quick view.

Cheers
Pierre
Back to top
View user's profile Send private message
Richard Galley

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Fri Jan 30, 2009 2:07 pm
Reply with quote

Hi Guys

The key in fileB is 61 as previously stated but it looks like when the output file is written it starts in pos 2 instead of pos 1. Therefore the key ends up being at pos 62 instead of 61. Thanks.

Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* TOP OF DATA **********************************
 0633832039118DVL0807R0630007369682VE303                     AA279             
 0633832039116DVL0807R0630007369682VE0011                    AA58               
 0633826069135STCOPCP 0630007369898VE61217124                AB4088             
 0633832039139DVL0807R0630007369898VE11699                   AB9028             
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Sat Jan 31, 2009 3:05 am
Reply with quote

Richard Galley,

I am guessing that you are using reporting features. Unless you show me the control cards you used I canNOT help you as to why your positions are off by a byte.

ped thanks, I overlooked it.
Back to top
View user's profile Send private message
Richard Galley

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Tue Feb 03, 2009 2:22 pm
Reply with quote

Sorry I am not sure what you mean in your previous comment. This is the code I am using -

Code:
//**********************************************************************
//STEP0100 EXEC PGM=ICEMAN                                           
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN=Your 237byte dups file,
//            DISP=SHR
//SORTOUT  DD DSN=&&FILEA,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)       
//SYSIN    DD *                                                     
 INREC BUILD=(2,7)                                                   
 SORT FIELDS=(1,7,CH,A)                                             
 SUM FIELDS=NONE                                                     
 OUTREC BUILD=(61:1,7,1000:X)                                       
//*                                                   
//**********************************************************************
//*                                                                     
//* STEP0200 WILL CONCATENATE THE ABOVE CREATED TEMP FILE TO THE 1000 BYTE
//* ORGINAL FILE. ie. THE TEMPFILE WILL BE FIRST IN THE CONCATENATION LIST
//* WE PICK THE LASTDUP AS ANY MATCHING KEY WILL BE A DUPLICATE AND WE       
//* ARE PICKING THE LASTDUP AS ORIGINAL FILE IS CONCATENATED LAST
//* THERE BY RESULTING IN THE DESIRED OUTPUT               
//*
//**********************************************************************
//STEP0200 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD DSN=&&FILEA,
//            DISP=SHR                           
//         DD DSN=Your 1000 byte fileb,
//            DISP=SHR                           
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                             
  SELECT FROM(IN) TO(OUT) ON(61,7,CH) LASTDUP USING(CTL1)   
//CTL1CNTL DD *                                             
  OMIT COND=(61,7,CH,EQ,C' ')                               
//*                                       
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Feb 03, 2009 2:33 pm
Reply with quote

What are the file characteristics of the input(s)

FBA, VBA, FBM, VBM which would put the position out by one byte.
Back to top
View user's profile Send private message
Richard Galley

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Tue Feb 03, 2009 2:38 pm
Reply with quote

They are both FB.
Back to top
View user's profile Send private message
Richard Galley

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Wed Feb 04, 2009 4:19 pm
Reply with quote

Guys

I have this sorted now. It looks like the problem was caused by the output being written to SYSOUT=*. When it is written to a dataset it is fine. Thanks
Back to top
View user's profile Send private message
Richard Galley

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Mon Feb 09, 2009 2:07 pm
Reply with quote

By default the following is used -

Code:
//STEP0200 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*     
//DFSMSG   DD SYSOUT=*     


The above gives information on job completion. Is there anything I can use during processing to show progress eg. How many records processed?
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
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
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top