|
View previous topic :: View next topic
|
| Author |
Message |
Vinodh S
New User

Joined: 12 Apr 2012 Posts: 28 Location: LA, California
|
|
|
|
I have a master file which has huge numeber of records.
My requirement is to split the Master file into two output files, based on another Reference File. The output files should in the same layout/format as that of the Master file.
The reference file is completely of a different layout. A particular key field matches with the Master file and Refence file.
The key fields in the reference file needs to be matched with the (first 13 bytes of the) master file and for a matching key records, the records needs to be written in the matched output file. Vice versa, for an unmatched key records, the records needs to be written in another unmatched output file.
Master File: [Duplicates possible in the first 13 bytes and first 13 bytes form the Reference file's Key]
| Code: |
Keyfield Data_part
015015000000198781 KIM WILSON 45578 asdsaduhjdasd
015015000000198782 KIM WILSON 47851 asdsaduhjdasd
015015000000198783 KIM WILSON 47221 asdsaduhjdasd
015015000000198784 KIM WILSON 21351 asdsaduhjdasd
015015000120178948 JULES THOM 21351 asdsaduhjdasd
015015000120178947 JULES THOM 21351 asdsaduhjdasd
015015000120178946 JULES THOM 21351 asdsaduhjdasd
015015000779846241 STANLEE JO 21351 asdsaduhjdasd
015015000999846241 CHRISTO 21351 asdsaduhjdasd
015015000999846241 DALE JAMES 21351 asdsaduhjdasd
|
Reference File: [First 13 bytes is the Key field for this File ]
| Code: |
Keyfield Data_part
0150150000001 KIM WILSON 45578 asdsaduhjdasd
0150150007798 STANLEE JO 21351 asdsaduhjdasd
0150150009998 DALE JAMES 21351 asdsaduhjdasd
|
MAtched Output File: (same as master file layout)
| Code: |
015015000000198781 KIM WILSON 45578 asdsaduhjdasd
015015000000198782 KIM WILSON 47851 asdsaduhjdasd
015015000000198783 KIM WILSON 47221 asdsaduhjdasd
015015000000198784 KIM WILSON 21351 asdsaduhjdasd
015015000779846241 STANLEE JO 21351 asdsaduhjdasd
015015000999846241 DALE JAMES 21351 asdsaduhjdasd
|
Unmatched Output File: (same as master file layout)
| Code: |
015015000120178948 JULES THOM 21351 asdsaduhjdasd
015015000120178947 JULES THOM 21351 asdsaduhjdasd
015015000120178946 JULES THOM 21351 asdsaduhjdasd
015015000999846241 DALE JAMES 21351 asdsaduhjdasd
|
note: My system doesnt support the JOIN keys function , So I had to use the Splice function.
I tried up things, but dint successfully turn up. The sum of the records in the matched and unmatched did not match up the master file.
So please help me on this. |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
| If you have referred the manual you could have made use of ready made code using SPLICE |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you don't show us your code, we can't suggest what might be wrong with it.
Can you also provide the ICE201I message from any sort step? |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
As Bill said either show us the error you got ?
or refer this link and correct your code as per your needs |
|
| Back to top |
|
 |
Vinodh S
New User

Joined: 12 Apr 2012 Posts: 28 Location: LA, California
|
|
|
|
Thanks Bill and Pandora..
I did refer the same link in order to find the solution for my question.
And to BILL's question on ICE201x message,
The record type is F in the ICE201x message in the SORTOUT. I have verified it today after going thru the sticky post in this forum.
I currently don't have the message in Handy to paste the exact display.
| Code: |
//*
//JS010 EXEC PGM=ICETOOL
//*
//MASTER DD DSN=Master.File,
// DISP=SHR
//REFER DD DSN=refer.file,
//* LRECL=6410
// DISP=SHR
//MATCHF DD DSN=matched.file,
// DISP=(NEW,CATLG,DELETE),
// DCB=(LRECL=6383,RECFM=FB,BLKSIZE=0),
// SPACE=(CYL,(700,900),RLSE),
// VOL=(,,,90)
//UNMATCHF DD DSN=unmatch.file,
// DISP=(NEW,CATLG,DELETE),
// DCB=(LRECL=6383,RECFM=FB,BLKSIZE=0),
// SPACE=(CYL,(700,900),RLSE),
// VOL=(,,,90)
//T1 DD DSN=&&T1,VOL=(,,,90),
// DISP=(MOD,PASS)
//*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//*
//TOOLIN DD *
* ADD '11' IDENTIFIER FOR FILE1 RECORDS.
COPY FROM(MASTER) TO(T1) USING(CTL1)
* ADD '22' IDENTIFIER FOR FILE2 RECORDS.
COPY FROM(REFER) TO(T1) USING(CTL2)
* SPLICE TO MATCH UP RECORDS AND WRITE THEM TO THEIR
* APPROPRIATE OUTPUT FILES.
SPLICE FROM(T1) TO(MATCHF) ON(1,15,CH) -
WITHALL WITH(1,6383) WITH(6386,1) -
USING(CTL3)
/*
//CTL1CNTL DD *
* MARK FILE1 RECORDS WITH '11'
OUTREC FIELDS=(1,15,6385:C'11')
/*
//CTL2CNTL DD *
* MARK FILE2 RECORDS WITH '22'
OUTREC FIELDS=(1,6383,6385:C'22')
/*
//CTL3CNTL DD *
* WRITE MATCHING RECORDS TO MATCHF FILE.
OUTFIL FNAMES=MATCHF,INCLUDE=(6385,2,CH,EQ,C'12'),OUTREC=(1,6383)
* WRITE UNMATCHING RECORDS TO UNMATCHF FILE.
OUTFIL FNAMES=UNMATCHF,INCLUDE=(6385,2,CH,EQ,C'22'),OUTREC=(1,6383)
|
|
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
| Where you able to get the solution that you expected?? |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| Vinodh S wrote: |
note: My system doesnt support the JOIN keys function , So I had to use the Splice function.
I tried up things, but dint successfully turn up. The sum of the records in the matched and unmatched did not match up the master file.
So please help me on this. |
Joinkeys is available since November, 2009 . If you are running a version of DFSORT that doesn't support joinkeys, then you probably are running an Unsupported version of DFSORT. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Vinodh S,
Is there a chance of your site bringing DFSORT more up-to-date? JOINKEYS would simplify and save on runtimes.
Have you tested what you have written?
Just run that OUTREC for the master file standalone, and have a look at what it produces. Is that what you were expecting? Is that why you have the first WITH? Does that first WITH give you the actual results you want?
You have copied it, but not bothered to change the comments, so the comments now mislead. Do you realise that the extra space in the example was just for demonstration purposes? You don't need it.
For your case
| Code: |
| OUTREC OVERLAY=(6384:C'xx') |
is more likely what you want.
How do your counts not balance? Is the discrepency something you can trace to having duplicates on both files? |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Vinod s,
Here is a splice JCL which will give you the desired results
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//MASTER DD DISP=SHR,DSN=Your Input Master File
//REFER DD DISP=SHR,DSN=Your Input REFER File
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)
//MATCH DD SYSOUT=*
//NOMATCH DD SYSOUT=*
//TOOLIN DD *
* ADD 'RR' IDENTIFIER FOR REFER FILE RECORDS.
COPY FROM(REFER) TO(T1) USING(CTL1)
* ADD 'MM' IDENTIFIER FOR MASTER FILE RECORDS.
COPY FROM(MASTER) TO(T1) USING(CTL2)
* SPLICE THE IDENTIFIER ON TO MASTER RECORDS
* AND WRITE THEM OUT TO MATCH AND NOMATCH FILE
SPLICE FROM(T1) TO(MATCH) ON(1,13,CH) WITHALL -
WITH(1,6384) KEEPNODUPS KEEPBASE USING(CTL3)
//*
//CTL1CNTL DD *
* MARK REFER FILE RECORDS WITH 'RR'
INREC OVERLAY=(6384:C'RR')
//*
//CTL2CNTL DD *
* MARK MASTER FILE RECORDS WITH 'MM'
INREC OVERLAY=(6384:C'MM')
//*
//CTL3CNTL DD *
* SPLIT THE FILES INTO MATCH AND NOMATCH
* MATCHING RECORDS WILL HAVE 'MR' AT POS 6384
* NON MATCHING RECORDS WILL HAVE 'MM' AT POS 6384
OUTFIL FNAMES=MATCH,INCLUDE=(6384,2,CH,EQ,C'MR'),BUILD=(1,6383)
OUTFIL FNAMES=NOMATCH,INCLUDE=(6384,2,CH,EQ,C'MM'),BUILD=(1,6383)
//* |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|