Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Compare 2 files write results to a 3rd file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Compare 2 files write results to a 3rd file
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jan 29, 2009 10:16 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Compare 2 files write results to a 3rd file
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    Post subject: Reply to: Compare 2 files write results to a 3rd file
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: 456
Location: Belgium

PostPosted: Fri Jan 30, 2009 12:25 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: Compare 2 files write results to a 3rd file
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: 8593
Location: Back in jolly old England

PostPosted: Tue Feb 03, 2009 2:33 pm    Post subject:
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    Post subject: Reply to: Compare 2 files write results to a 3rd file
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    Post subject: Reply to: Compare 2 files write results to a 3rd file
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    Post subject: Reply to: Compare 2 files write results to a 3rd file
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Vision results (also known as DYL-280) CaptBill CA Products 1 Tue Dec 20, 2016 3:35 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us