Author: Gunapala CN
Subject: How can we have the varying lenth of key filed in join key!
Posted: Fri Oct 14, 2016 7:31 pm (GMT 5.5)
Hi Folks,
I've come across once scenario while using Join keys :
problem statement :Compare two different length of files(length of 10 & 18), write all key matched records from dataset-2 against dataset-1 into the one output data set.
Key Filed, would get vary from 1 to till 5 length from two data sets records.
Input records :
dataset -1
Note :.... are PD numbers
dataset 2
from above its giving duplicate rows in output data sets
Output :
Problem here is duplicates and incorrect mapping for example : dataset records is G1AJJ provided, basicaly it find first letter match from second file but its exact match would be G1.
what exactly i want is that is there any way to put varying key size while matching since this key filed expected to be varry from 1 to 5 length
Thanks for all in advance !!
Note - anyway im writing COBOL pgm to handle this but i just curios to know if any other way of doing it![icon_smile.gif]()
CODE' D
help people who spend their time on Your issues
_________________
Gunapala
Subject: How can we have the varying lenth of key filed in join key!
Posted: Fri Oct 14, 2016 7:31 pm (GMT 5.5)
Hi Folks,
I've come across once scenario while using Join keys :
problem statement :Compare two different length of files(length of 10 & 18), write all key matched records from dataset-2 against dataset-1 into the one output data set.
Key Filed, would get vary from 1 to till 5 length from two data sets records.
Input records :
dataset -1
Code: |
03...F51CG 03...F54TA 03...G11AJ 03...G11DD 03...G12AC 03...G12AE |
Note :.... are PD numbers
dataset 2
Code: |
B4 +1.33 +0.01097 B6 +1.59 +0.00327 B9 +1.69 +0.00406 F1 +1.49 +0.00502 F3 +1.77 +0.00865 F4 +1.57 +0.00512 F5 +1.52 +0.00462 F7 +1.38 +0.01356 F8 +1.55 +0.03842 G1 +1.82 +0.01564 G2 +2.54 +0.01105 G3 +1.42 +0.03960 G4 +1.36 +0.01124 G5 +1.47 +0.01400 G6 +1.90 +0.01696 G7 +2.01 +0.02553 |
Code: |
//SPLIT01 EXEC PGM=SORT,COND=(4,LT) //SYSOUT DD SYSOUT=* //SORTJNF1 DD DSN=JKT.VXJJ0TFU.UPLOAD.FILE.P,DISP=SHR //SORTJNF2 DD DSN=JKT.SYST.CUSTREND.NONPROM(0),DISP=SHR //SORTOUT DD DSN=JKT.SYST.CUSTREND.NONPROM.TRIAL, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(1,1),RLSE), // MGMTCLAS=MCNEVER,UNIT=DASD, // DCB=(DSORG=PS,RECFM=FB,LRECL=18) //SYSIN DD * JOINKEYS FILE=F1,FIELDS=(6,1,A) JOINKEYS FILE=F2,FIELDS=(1,1,A) REFORMAT FIELDS=(F2:1,18) SORT FIELDS=COPY /* //* |
from above its giving duplicate rows in output data sets
Output :
Code: |
F1 +1.49 +0.00502 F3 +1.77 +0.00865 F4 +1.57 +0.00512 F5 +1.52 +0.00462 F7 +1.38 +0.01356 F8 +1.55 +0.03842 F1 +1.49 +0.00502 F3 +1.77 +0.00865 F4 +1.57 +0.00512 F5 +1.52 +0.00462 F7 +1.38 +0.01356 F8 +1.55 +0.03842 G1 +1.82 +0.01564 G2 +2.54 +0.01105 G3 +1.42 +0.03960 G4 +1.36 +0.01124 |
Problem here is duplicates and incorrect mapping for example : dataset records is G1AJJ provided, basicaly it find first letter match from second file but its exact match would be G1.
what exactly i want is that is there any way to put varying key size while matching since this key filed expected to be varry from 1 to 5 length
Thanks for all in advance !!
Note - anyway im writing COBOL pgm to handle this but i just curios to know if any other way of doing it

CODE' D
help people who spend their time on Your issues
_________________
Gunapala