Page 1 of 1

check each record from input1 to mutliple input2 files

PostPosted: Wed Oct 10, 2018 5:05 pm
by thotlma
HI All

i have requirement like this. i have input file1 in that have many records.
i have other 12 input2 files so i have comparae each record from input1 with input2 12 files if any record match then copy to the out out file
i have written below code but it is copying complete records from input2 to out put
i have comparing 1 to 18 lengh from input1 with input2
could you please help me?

STEP001   EXEC PGM=SORT                                        
SORTJNF1  DD DSN=XXX.Q.KR0Z2R99.XXXX.ISA.OUP(0),DISP=SHR  
SORTJNF2  DD DSN=xxx.P.K0101N00.xxxx11P1.xxxxXTO(0),DISP=SHR  
          DD DSN=xxx.P.K3211N00.xxxx11P1.xxxxXTO(0),DISP=SHR  
          DD DSN=xxx.P.K2912N00.xxxx11P1.xxxxXTO(0),DISP=SHR  
          DD DSN=xxx.P.K0618N00.xxxx11P1.xxxxXTO(0),DISP=SHR  
          DD DSN=xxx.P.K3720N00.xxxx11P1.xxxxXTO(0),DISP=SHR  
          DD DSN=xxx.P.K4731N00.xxxx11P1.xxxxXTO(0),DISP=SHR  
          DD DSN=xxx.P.K0242N00.xxxx11P1.xxxxXTO(0),DISP=SHR  
          DD DSN=xxx.P.K4451N00.xxxx11P1.xxxxXTO(0),DISP=SHR  
          DD DSN=xxx.P.K1256N00.xxxx11P1.xxxxXTO(0),DISP=SHR  
          DD DSN=xxx.P.K4560N00.xxxx11P1.xxxxXTO(0),DISP=SHR  
          DD DSN=xxx.P.K1961N00.xxxx11P1.xxxxXTO(0),DISP=SHR  
          DD DSN=xxx.P.K3290N00.xxxx11P1.xxxxXTO(0),DISP=SHR  
SORTOUT   DD DSN=XXX.Q.KR0Z2R99.XXX.MAT.OUP(+1),          
             DISP=(NEW,CATLG,DELETE),                          
             DCB=(LRECL=261,BLKSIZE=0,RECFM=FB),              
             SPACE=(CYL,(20,10),RLSE)                          
SYSPRINT  DD SYSOUT=*                        
SYSOUT    DD SYSOUT=*                        
SYSIN     DD *                              
 JOINKEYS FILE=F1,FIELDS=(1,18,A)            
 JOINKEYS FILE=F2,FIELDS=(1,18,A)            
 JOIN UNPAIRED,F1,F2                        
 REFORMAT FIELDS=(F2:1,258,F2:264,1,F2:334,2)
 SORT FIELDS=COPY


added the code tags

Re: check each record from input1 to mutliple input2 files

PostPosted: Wed Oct 10, 2018 5:41 pm
by enrico-sorichetti
help people who spend their time helping You!
good forum manners suggest the use of the code tags when posting mainframe data
( the code tags force the use of a monospaced/fixed font, making code and data snippets more readable )

edited Your post and done it for You

Re: check each record from input1 to mutliple input2 files

PostPosted: Wed Oct 10, 2018 5:49 pm
by expat
So what have you tried so far and what results have you obtained.
Why do you think that your results are different from expected ?

Re: check each record from input1 to mutliple input2 files

PostPosted: Wed Oct 10, 2018 9:04 pm
by thotlma
the complete data getting from iput2 to out file ..iam not getting matching records
i will tell the example of my requirement
input1
123456
789456
123789
123458
147852
852963

input2
123789
123458
852963
001245
014789
025847


outfile
123789
123458
852963

Re: check each record from input1 to mutliple input2 files

PostPosted: Thu Oct 11, 2018 2:02 am
by enrico-sorichetti
what is that You did not understand when I asked You to use the code tags for code and data snippets ?
coded again :evil:

Re: check each record from input1 to mutliple input2 files

PostPosted: Thu Oct 11, 2018 8:26 pm
by Garry F Carroll
Your REFORMAT statement doesn't have the match-marker so you can select which records you want to output. You then don't have control cards to select the records you want to output based on the match-marker.

Garry.

Re: check each record from input1 to mutliple input2 files

PostPosted: Thu Oct 11, 2018 8:55 pm
by thotlma
Hi Gary
see below modfied code..
still not working..the matching records copy to out file

 JOINKEYS FILE=F1,FIELDS=(1,06,A)            
 JOINKEYS FILE=F2,FIELDS=(1,06,A)            
 JOIN UNPAIRED,F1,F2                        
 REFORMAT FIELDS=(f2:1,6)
 SORT FIELDS=COPY


EDITED AGAIN TO USE THE CODE TAGS

Re: check each record from input1 to mutliple input2 files

PostPosted: Thu Oct 11, 2018 9:03 pm
by Garry F Carroll
you still don't have the match-marker. ( a ? ) in tbe reformat statement & you then need to select the matched records in an outfil statement.

GaRRY.

Re: check each record from input1 to mutliple input2 files

PostPosted: Thu Oct 11, 2018 9:13 pm
by thotlma
please can you send me the code ?

Re: check each record from input1 to mutliple input2 files

PostPosted: Fri Oct 12, 2018 1:27 pm
by Garry F Carroll
Modify to suit your record length. The '?' is replaced by a '1', '2' or 'B' for file1 only, file2 only or both, respectively in the intermediate record.

REFORMAT FIELDS=(F2:1,6,?)
           OUTFIL INCLUDE=(7,1,CH,EQ,C'2'),BUILD=(1,6)


Garry