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

Compare 2 files and write matches 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: Mon Dec 15, 2008 8:37 pm
Reply with quote

We receive 2 files from different sources that contain car registration numbers. I want to compare these 2 files and if matches are found, write these matches to a 3rd file.

File information as follows -
I have 2 files - FileA 237bytes FB. FileB 100bytes FB.

FileA pos 2 for 7chars contains an alphnumeric(ABC1234).
FileB pos 55 for 7chars contains an alphanumeric(ABC1234). I do not know what these alphanumeric chars will be.

Can you explain how to do this, if it can be done? Thanks
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Dec 15, 2008 8:51 pm
Reply with quote

Do you want to merge the data from both files if a match exists, or only use one file as a key to select data from the other file.

use SPLICE as a keyword in the forum search utility to find quite a few examples.
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 Dec 15, 2008 8:58 pm
Reply with quote

When the 2 files are compared, if fileB contains a match with fileA write the fileB record to fileC.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Dec 15, 2008 10:42 pm
Reply with quote

Richard Gallery,

Check this smart DFSORT trick "Create files with matching and non-matching records" here

www.ibm.com/systems/support/storage/software/sort/mvs/tricks/
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 Dec 16, 2008 6:00 pm
Reply with quote

As mentioned previously I am trying to do the following -

When 2 files are compared, if fileB contains a match with fileA write the fileB record to fileC.


IN1 237 lrecl. Key is 2,8
IN2 100 lrecl. Key is 55,61


I have used the following DFSORT trick but cannot get it to work any ideas please? -

Code:
//S2 EXEC PGM=ICETOOL                                     
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG DD SYSOUT=*                                       
//IN1 DD DSN=fileA,DISP=SHR
//IN2 DD DSN=fileB,DISP=SHR   
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),             
//  DISP=(MOD,PASS)                                       
//OUT DD DSN=fileC,DISP=SHR                 
//TOOLIN DD *                                             
COPY FROM(IN2) TO(T1)                                     
COPY FROM(IN1) TO(T1) USING(CTL2)                         
SELECT FROM(T1) TO(OUT) ON(55,61,CH) FIRSTDUP             
/*                                                         
//CTL2CNTL DD *                                           
INREC BUILD=(1:7,61,100:X)                                 
/*                                                         
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 Dec 16, 2008 6:28 pm
Reply with quote

Should have mentioned the error I am getting -

Code:
ICE000I 0 - CONTROL STATEMENTS FOR 5740-SM1
          INREC BUILD=(1:7,61,100:X)       
                £                         
ICE005A 0 STATEMENT DEFINER ERROR         
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Dec 16, 2008 7:52 pm
Reply with quote

This test works for me - been quickly adapted, so in reality the last copy will not be required - just for me to see the output in sysout.
Code:

//STEP001  EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//IN1      DD *                                                 
AAAAAAAAAAAAAAAAAA RECORDS AAAAAAAAAAAAA ABC123                 
AAAAAAAAAAAAAAAAAA RECORDS AAAAAAAAAAAAA ABC125                 
//IN2      DD *                                                 
ABC ABC123 RECORD 2 ----------------------------------           
BCD ABC124 RECORD 2 ----------------------------------           
CDE ABC125 RECORD 2 ----------------------------------           
/*                                                               
//CONCAT   DD DSN=&&TEMP01,DISP=(MOD,PASS,DELETE),               
//            SPACE=(CYL,(10,10))                               
//T3       DD DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS),
//            RECFM=FB,LRECL=55                                 
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                 
*                                                               
  COPY FROM(IN2) TO(CONCAT)                                     
*                                               
  COPY FROM(IN1) TO(CONCAT) USING(SRT1)         
*                                               
  SELECT FROM(CONCAT) TO(T3) ON(5,6,CH) FIRSTDUP
*                                               
  COPY FROM(T3)  TO(OUT)                         
/*                                               
//SRT1CNTL DD *                                 
  OUTREC FIELDS=(4X,42,6,100:X)                 
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 Dec 16, 2008 8:46 pm
Reply with quote

Thanks for your help. It works fine when all fields are populated but I have since noticed that in my files not all are populated see my example below -


Code:
//STEP001  EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//IN1      DD *                                                 
AAAAAAAAAAAAAAAAAA RECORDS AAAAAAAAAAAAA                         
AAAAAAAAAAAAAAAAAA RECORDS AAAAAAAAAAAAA ABC123                 
AAAAAAAAAAAAAAAAAA RECORDS AAAAAAAAAAAAA ABC126                 
AAAAAAAAAAAAAAAAAA RECORDS AAAAAAAAAAAAA ABC125                 
AAAAAAAAAAAAAAAAAA RECORDS AAAAAAAAAAAAA ABC127                 
//IN2      DD *                                                 
ABC ABC128 RECORD 2 ----------------------------------           
ABC ABC128 RECORD 2 ----------------------------------           
ABC        RECORD 2 ----------------------------------           
BCD ABC124 RECORD 2 ----------------------------------           
CDE ABC125 RECORD 2 ----------------------------------           
/*                                                               
//CONCAT   DD DSN=&&TEMP01,DISP=(MOD,PASS,DELETE),               
//            SPACE=(CYL,(10,10))                               
//T3       DD DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS),
//            RECFM=FB,LRECL=55                                 
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                 
*                                                               
  COPY FROM(IN2) TO(CONCAT)                                     
*
*                                               
  COPY FROM(IN1) TO(CONCAT) USING(SRT1)         
*                                               
  SELECT FROM(CONCAT) TO(T3) ON(5,6,CH) FIRSTDUP
*                                               
  COPY FROM(T3)  TO(OUT)                       
/*                                             
//SRT1CNTL DD *                                 
  OUTREC FIELDS=(4X,42,6,100:X) 
                                                                               


When I run this the ouput generated is this -

Code:
ABC        RECORD 2 ----------------------------------
CDE ABC125 RECORD 2 ----------------------------------
ABC ABC128 RECORD 2 ----------------------------------


Any ideas?
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Dec 16, 2008 9:02 pm
Reply with quote

Because you have a file A record with blanks in the key field, and you also have a file B record with blanks in the key field, so as the keys match - the record gets selected.

Also - you have duplicates in file B which do not exist in file A, and these will also be selected. As you can see from your example. I guess that's my fault for not asking the right questions before coding icon_sad.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Dec 16, 2008 11:24 pm
Reply with quote

Richard Galley,

Please answer the following questions

1. What is the RECFM of the files? FB or VB?
2. What is the format of the key at pos 2 for 6 bytes in file 1 and at pos 55 in file2?
3. Which file has duplicates on the key? file 1 or file 2 or both?
4. Please show a sample input data (including duplicates if you have) and desired output
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 Dec 17, 2008 4:20 pm
Reply with quote

Hello Skolusu

My original post was slightly inaccurate as I had misunderstood my own information. I will start again....

We receive 2 files from different sources that contain car registration numbers. I want to compare FileB against FileA and if matches are found, write the full matched record to FileC.

File information as follows -
FileA 100bytes FB. FileB 237bytes FB.

FileA pos 55 for 7chars contains an alphnumeric(ABC1234).
FileB pos 2 for 7chars contains an alphanumeric(ABC1234).

FileA can contain blanks at pos 55.
FileB will not contain any blanks.

There will not be any duplicates in fileA but there may be duplicates in fileB. If any duplicates are found these need including in fileC. I have added examples of the files including fileC, what I would expect the end result to be -

FileA -
Code:
0629934151502DHPI003 ..l é&.MBKJL023030303                   
0629934151504DHPI003 ..l é&|MBJKDSD03030450                 
0629934151506DHPI003 ..l é&?MBKSLSLLS00000001               
0629951648869DHPI004 ..n.çf€MBGBEQI00001EN96                 
0629951651343DHPI004 ..n.é..MBGBEQI00001EN96                 
0629975927333DCRO051 ..d.Î..VESFABXXBAFBEK15628       ABC123
0629975872946DCRO051 ..°....VEJF1AK7BR0BF206078       ABS19 
0629975872946DCRO051 ../.h..VEYS3DC38J4S2018394       AGR1W 
0629975872946DCRO051 ..q.ç..VEZFA1700000300257B       AG1   
0629975872947DCRO051 ..o.-..VEW0L000029M1199502       AJ1   


FileB -
Code:
ABC123 VINF0RBB58AAA       1029062006LE712                    01149P 113F159333
ABS19  VINF0RBB58AAB       1029062007LE710                    01149M 114F154830
AGR1W  VINF0RBB58AAC       1029062006DC520                    01686L 21401506545
AG1    VINF0RBB58AAD       1029062006DA107                    01794M 1141ZZU7374
AJ1    VINF0RBB58AAE       1029062006R6191                    01061M 114F10DN 32
AGR1W  VINF0RBB58AAF       1029062006DA127                    01598J 1143ZZU7811
AJ1    VINF0RBB58AAG       1029062006LP130                    01360C 113FST65389
AKL102XVINF0RBB58AAH       1029062006MA236                    01753N 2226J78375
A929LDVVINF0RBB58AAJ       1029062006MA236                    01753N 2226J78371
A947KKCVINF0RBB58AAK       1029062006N1765                    01242J 1133322840


FileC -

Code:
ABC123 VINF0RBB58AAA       1029062006LE712                    01149P 113F159333
ABS19  VINF0RBB58AAB       1029062007LE710                    01149M 114F154830
AGR1W  VINF0RBB58AAC       1029062006DC520                    01686L 2140150654
AG1    VINF0RBB58AAD       1029062006DA107                    01794M 1141ZZU737
AJ1    VINF0RBB58AAE       1029062006R6191                    01061M 114F10DN 3
AGR1W  VINF0RBB58AAF       1029062006DA127                    01598J 1143ZZU781
AJ1    VINF0RBB58AAG       1029062006LP130                    01360C 113FST6538
AKL102XVINF0RBB58AAH       1029062006MA236                    01753N 2226J78375
A929LDVVINF0RBB58AAJ       1029062006MA236                    01753N 2226J78371
A947KKCVINF0RBB58AAK       1029062006N1765                    01242J 1133322840
A972RUGVINF0RBB58AAL       1029062006LE799                    01598P 114D007252
A973KKCVINF0RBB58AAM       1029062006M3732                    01986M 202BRE 054
A973LLKVINF0RBB58AAM       1029062006M3732                    01986M 202BRE 054
A973LLLVINF0RBB58AAM       1029062006M3732                    01986M 202BRE 054
A998DBBVINF0RBB58AAM       1029062006M3732                    01986M 202BRE 054


Think I have included all required information, if I have missed something or clarification is required please ask. Thanks again for help.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Dec 17, 2008 11:13 pm
Reply with quote

Richard Galley,

It doesn't look right . The only matching keys in both files are just
Code:

ABC123
ABS19
AGr1W
AG1
AJ1

but your output FILEC has all other keys ex:
Code:

AKL102X
A929LDV
A947KKC
A972RUG
A973KKC
A973LLK
A973LLL
A998DBB

If your intent is to match 2 files then the above keys do not have a matching key. So how did you get them in the output? or did you just show me a partial input?

Anywayz here is a DFSORT/ICETOOL job which will give you the matching records along with the duplicates if any in file2. Also the output is sorted on the key.

Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN1      DD DSN=your 100 byte file1,DISP=SHR                             
//IN2      DD DSN=your 237 bytes file2,DISP=SHR                             
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(5,5),RLSE)
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                             
  COPY FROM(IN1) USING(CTL1)                                 
  COPY FROM(IN2) USING(CTL2)                                 
  SPLICE FROM(T1) TO(OUT) ON(2,7,CH) -                       
  WITHALL WITH(01,237) KEEPBASE KEEPNODUPS USING(CTL3)       
//CTL1CNTL DD *                                             
  OMIT COND=(55,7,CH,EQ,C' ')                               
  OUTFIL FNAMES=T1,BUILD=(2:55,7,238:55,7)                   
//CTL2CNTL DD *                                             
  OUTFIL FNAMES=T1,OVERLAY=(238:7X)                         
//CTL3CNTL DD *                                             
  OUTFIL FNAMES=OUT,BUILD=(1,237),                           
  OMIT=(9,229,CH,EQ,C' ',OR,238,7,CH,EQ,C' ')               
/*

this will produce
Code:

ABC123 VINF0RBB58AAA       1029062006LE712 rest of data
ABS19  VINF0RBB58AAB       1029062007LE710 rest of data
AGR1W  VINF0RBB58AAC       1029062006DC520 rest of data
AGR1W  VINF0RBB58AAF       1029062006DA127 rest of data
AG1    VINF0RBB58AAD       1029062006DA107 rest of data
AJ1    VINF0RBB58AAE       1029062006R6191 rest of data
AJ1    VINF0RBB58AAG       1029062006LP130 rest of data


let me know if you want to preserve the original order of the file B
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 Dec 18, 2008 3:16 pm
Reply with quote

Hello Skolusu

What you provided me with in your last post worked great thanks with the info I had provided but I must appologise again as the information I had been given was still incorrect. This is definitely the correct spec now.

We receive 2 files from different sources that contain car registration numbers. I want to compare FileB against FileA and if matches are found, write the full matched record from FileB to FileC.

File information as follows -
FileA 237bytes FB. FileB 100bytes FB.

FileA pos 2 for 7chars contains an alphnumeric(ABC1234).
FileB pos 55 for 7chars contains an alphanumeric(ABC1234).

FileA will not contain any blanks.
FileB can contain blanks at pos 55.

There may be duplicates in fileA
There will not be any duplicates in fileB.

I have attached examples of FileA, FileB & what I would expect to find in FileC once the process has run.

FileA -

Code:
1ABC123 VINF0RBB58AAA       1029062006LE712
1ABS19  VINF0RBB58AAB       1029062007LE710
1AGR1W  VINF0RBB58AAC       1029062006DC520
1AG1    VINF0RBB58AAD       1029062006DA107
1AJ1    VINF0RBB58AAE       1029062006R6191
1AGR1W  VINF0RBB58AAF       1029062006DA127
1AJ1    VINF0RBB58AAG       1029062006LP130
1AKL102XVINF0RBB58AAH       1029062006MA236
1A929LDVVINF0RBB58AAJ       1029062006MA236
1A947KKCVINF0RBB58AAK       1029062006N1765
1A972RUGVINF0RBB58AAL       1029062006LE799
1A973KKCVINF0RBB58AAM       1029062006M3732
1A973LLKVINF0RBB58AAM       1029062006M3732
1A973LLLVINF0RBB58AAM       1029062006M3732
1A998DBBVINF0RBB58AAM       1029062006M3732


FileB -

Code:
0629934151502DHPI003 ..l é&.MBKJL023030303                   
0629934151504DHPI003 ..l é&|MBJKDSD03030450                 
0629934151506DHPI003 ..l é&?MBKSLSLLS00000001               
0629951648869DHPI004 ..n.çf€MBGBEQI00001EN96                 
0629951651343DHPI004 ..n.é..MBGBEQI00001EN96                 
0629975927333DCRO051 ..d.Î..VESFABXXBAFBEK15628       ABC123
0629975872946DCRO051 ..°....VEJF1AK7BR0BF206078       ABS19 
0629975872946DCRO051 ../.h..VEYS3DC38J4S2018394       AGR1W 
0629975872946DCRO051 ..q.ç..VEZFA1700000300257B       AG1   
0629975872947DCRO051 ..o.-..VEW0L000029M1199502       AJ1   
0629975872948DCRO051 ..o.-..VE259136                  AKL102X
0629975872948DCRO051 ..o.-..VE3Y5013625               AKL47X
0629975872949DCRO051 ...b...VEWDB1290632F100033       ALG1E 
0629975872949DCRO051 ....À..VEWDB1070472A063216       AMB1   
0629975872949DCRO051 ..Ëïà..VESAXXSSWSBAM218862       ARY61T


FileC -

Code:
0629975927333DCRO051 ..d.Î..VESFABXXBAFBEK15628       ABC123
0629975872946DCRO051 ..°....VEJF1AK7BR0BF206078       ABS19 
0629975872946DCRO051 ../.h..VEYS3DC38J4S2018394       AGR1W 
0629975872946DCRO051 ..q.ç..VEZFA1700000300257B       AG1   
0629975872947DCRO051 ..o.-..VEW0L000029M1199502       AJ1   
0629975872948DCRO051 ..o.-..VE259136                  AKL102X


Thanks once again for your assistance and apologies again for messing you about.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Dec 18, 2008 11:26 pm
Reply with quote

Richard Galley,

Ok now you went back to just getting the unique matching records from the unique record file. If that is what you want you don't even need SPLICE. The following DFSORT/ICETOOL JCL will give you the desired results. A brief explanation of the job.

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.

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 we drop the records we created in step0100 there by resulting in the desired output

Code:

//STEP0100 EXEC PGM=ICEMAN                                 
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=your 237 bytes file with dups,DISP=SHR
//SORTOUT  DD DSN=&&I2,DISP=(,PASS),SPACE=(CYL,(x,y),RLSE)
//SYSIN    DD *                 
  INREC BUILD=(2,7)             
  SORT FIELDS=(1,7,CH,A)         
  SUM FIELDS=NONE               
  OUTREC BUILD=(55:1,7,100:X)   
/*                               
//STEP0200 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN       DD DSN=Your 100byte unique key file,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' ')
/*


This will produce
Code:

0629975927333DCRO051 ..D. ..VESFABXXBAFBEK15628       ABC123
0629975872946DCRO051 .. ....VEJF1AK7BR0BF206078       ABS19 
0629975872946DCRO051 ../.H..VEYS3DC38J4S2018394       AGR1W 
0629975872946DCRO051 ..Q. ..VEZFA1700000300257B       AG1   
0629975872947DCRO051 ..O.-..VEW0L000029M1199502       AJ1   
0629975872948DCRO051 ..O.-..VE259136                  AKL102X
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 Dec 19, 2008 1:21 pm
Reply with quote

Skolusu

That worked a treat just what I wanted. Again sorry for the previous confusion caused by myself & my developement colleagues.

Richard Galley
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 Jan 28, 2009 8:33 pm
Reply with quote

The previous resolution worked great but the file spec has changed again. I have tried using the jcl you supplied and adapting that but the result is my output file is out by one position(62 instead of 61).

I am comparing FileB with FileA. If any matches are found in FileB write these to an output dataset.

File information as follows -
FileA 237bytes FB. FileB 1000bytes FB.

FileA pos 2 for 7chars contains an alphnumeric(ABC1234).
FileB pos 61 for 7chars contains an alphanumeric(ABC1234).

FileA will not contain any blanks.
FileB can contain blanks at pos 61.

There may be duplicates in fileA
There will not be any duplicates in fileB.


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               


This is the JCL being used -

Code:
//**********************************************************************
//*                                                                     
//* STEP0100 WILL ELIMINATE THE DUPLICATES FROM 237 BYTE FILE           
//* AND CREATE A 1000 BYT FILE POPULATING THE KEY FROM POS 2 FOR 7 BYTES
//* ONTO POS 61.                                                       
//*                                                                     
//*                                                                     
//**********************************************************************
//STEP0100 EXEC PGM=ICEMAN                                             
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=DTSX018.C1000.MASTFILE.REFVRM.SORTED,DISP=SHR,       
//         UNIT=SYSDA,VOL=SER=ZL5008                                   
//SORTOUT  DD DSN=&&I2,DISP=(,PASS),SPACE=(CYL,(500,200),RLSE),         
//         UNIT=(WCART,5)                                               
//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 1000 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.ADAPH2.FILE30.DUMP.TEST2.FB,DISP=SHR           
//         DD DSN=&&I2,DISP=SHR                                         
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
  SELECT FROM(IN) ON(61,7,CH) TO(OUT) ALLDUPS USING(CTL1)               
//CTL1CNTL DD *                                                         
  OMIT COND=(61,7,CH,EQ,C' ')                                           
  OUTFIL FNAMES=OUT,OMIT=(1,60,CH,EQ,C' ',AND,68,39,CH,EQ,C' ')         
/*                                                                     
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Jan 28, 2009 11:53 pm
Reply with quote

Richard Galley wrote:
The previous resolution worked great but the file spec has changed again. I have tried using the jcl you supplied and adapting that but the result is my output file is out by one position(62 instead of 61).

I am comparing FileB with FileA. If any matches are found in FileB write these to an output dataset.


Richard ,

Unless I am missing something, it is the same as previous requirement. The JCL posted by you should give you the desired results. Show me a sample input data and desired output
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 7:23 pm
Reply with quote

Skolusu

I have posted this as a new post. It's getting confusing as its now on 2 pages. Thanks
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 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
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top