Page 1 of 1

Need to write the match and unmatched record in the output

PostPosted: Sun Feb 22, 2009 12:14 pm
by bodhi
Hello,

I have to create a report in which i need to join two file and put the match record in the output also the unmatched record of the first file must be in output file.I am using the sort but it is not working as per the expectation.First file has the record length 400 and second file has the record length 450.

job and card.
//STEP21 EXEC PGM=SORT
//SORTJNF1 DD DSN=first input file ,DISP=SHR
//SORTJNF2 DD DSN=second input file,DISP=SHR
//SORTOF02 DD DSN=ARCHIVES.YR2009.OUTPUT.UN,DISP=SHR
//SORTOF01 DD DSN=ARCHIVES.YR2009.OUTPUT1,DISP=SHR
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(109,9,A)
JOINKEYS FILE=F2,FIELDS=(2,9,A)
REFORMAT FIELDS=(F1:1,400,F2:1,450),FILL=X'FF'
JOIN UNPAIRED
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOF01,INCLUDE=(401,1,BI,EQ,X'FF'),OUTREC=(1,400)
OUTFIL FNAMES=SORTOF02,INCLUDE=(1,1,BI,NE,X'FF',AND,97,1,CH,NE,X'FF'),
OUTREC=(1,97,415,30,400:X)

My requirement is that the record count of the first file is equal to record count of output file (match and unmatched records). Could you please help me out of this problem.

Thanks
Bodhi.

Re: Need to write the match and unmatched record in the output

PostPosted: Sun Feb 22, 2009 12:39 pm
by dick scherrer
Hello,

Post some sample from both input files as well as what you want for output (data, counts, etc).

You don't need to post complete records, only enough data to show your requirement and the rules that are to be followed.

Use copy/paste and the "Code" tag to post code, jcl, data or anything else that you want to make readable (code can preserve alignment). Use Preview to see your post as the forum will see it - when you are satisfied with the appearance, Submit.

Re: Need to write the match and unmatched record in the output

PostPosted: Sun Feb 22, 2009 1:40 pm
by bodhi
Hello Dick,

First file record: total records (11)
0000023100,93,061214,V3, ,C,BCGFA , 50405.02
0000023100,93,061214,V3, ,C,BCGFA , 50405.02
0000023100,93,061215,V3, ,C,BCGFA , 50405.02
0000023100,93,061215,V3, ,C,BCGFA , 50405.02
0000023100,93,061221,V3, ,C,BCGFA , 50405.02
0000023100,93,061220,V3, ,C,BCGFA , 50405.02
0000023100,93,061220,V3, ,C,BCGFA , 50405.02
0000023100,93,061220,V3, ,C,BCGFA , 50405.02
0000023101,AH,061221,V3, ,C,BCUZA , 48045.41
0000023101,AH,061221,V3, ,C,BCUZC , 48045.41
0000023101,AH,061221,V3, ,C,BCUZA , 48045.41


Second file record: total record(2)
0BCGFA NBRUIN ENGINEERED PARTS INC
0BCUZC NTINNERMAN PALNUT ENGINEERED PRODUCT

Expected output is :total record(11) matched and unmatched both
0000023100,93,061214,V3, ,C,BCGFA , 50405.02, NBRUIN ENGINEERED PARTS INC
0000023100,93,061214,V3, ,C,BCGFA , 50405.02, NBRUIN ENGINEERED PARTS INC
0000023100,93,061215,V3, ,C,BCGFA , 50405.02, NBRUIN ENGINEERED PARTS INC
0000023100,93,061215,V3, ,C,BCGFA , 50405.02, NBRUIN ENGINEERED PARTS INC
0000023100,93,061221,V3, ,C,BCGFA , 50405.02, NBRUIN ENGINEERED PARTS INC
0000023100,93,061220,V3, ,C,BCGFA , 50405.02, NBRUIN ENGINEERED PARTS INC
0000023100,93,061220,V3, ,C,BCGFA , 50405.02, NBRUIN ENGINEERED PARTS INC
0000023100,93,061220,V3, ,C,BCGFA , 50405.02, NBRUIN ENGINEERED PARTS INC
0000023101,AH,061221,V3, ,C,BCUZA , 48045.41
0000023101,AH,061221,V3, ,C,BCUZC , 48045.41,NTINNERMAN PALNUT ENGINEERED PRODUCT
0000023101,AH,061221,V3, ,C,BCUZA , 48045.41

hopes this will help

Bodhi

Re: Need to write the match and unmatched record in the output

PostPosted: Wed Feb 25, 2009 2:27 am
by Alissa Margulies
Try changing your first OUTFIL INCLUDE statement to the following:

OUTFIL FNAMES=SORTOF01,INCLUDE=(1,1,BI,NE,X'FF'),OUTREC=(1,400)
 

Let me know if this gives you the desired output. If not, let me know and I would be happy to assist you further.