Page 1 of 1

Compare field in one file with field in other file

PostPosted: Tue Apr 09, 2019 10:08 pm
by pgkkreddy1
Hi,

Good morning. Please help me out with below sort card

File1 data:

201903
201905
201906
201902

File 2 data:
201903

I want to get the data from file1, with condition file1value less than file 2 value
Please help me to get this, I used join but not working

SORT FIELDS=COPY                      
JOINKEYS FILES=F1,FIELDS=(1,4,a)        
JOINKEYS FILES=F2,FIELDS=(1,4 ,a)        
REFORMAT FIELDS=(F1:1,449,?,F2:1,4)    
INCLUDE COND=(1,4,BI,LT,451,4,BI)      


Regards,
KK reddy

Re: Compare field in one file with field in other file

PostPosted: Wed Apr 10, 2019 3:21 pm
by NicC
What is not working? How is it not working? Is this the only attempt that you have made?

Re: Compare field in one file with field in other file

PostPosted: Fri Apr 12, 2019 6:45 pm
by pgkkreddy1
Thank you Nic for the Reply.
I tried some other ways. But able to get.
Please help me out

Re: Compare field in one file with field in other file

PostPosted: Fri Apr 12, 2019 7:46 pm
by Garry F Carroll
I tried some other ways. But able to get.


This is not helpful. You need to explain clearly what you are trying to achieve. What format is your input? What is the DCB info for the datasets?

You show e.g. 201903 which is a 6-byte field and your sort control cards specify 4-byte fields to be treated as BI. Is this input in zoned-decimal (ZD) format or are you showing binary values from 4-byte fields?

What is your desired result? You say
I want to get the data from file1, with condition file1value less than file 2 value
Which value ? All your 4-byte fields as shown have the same value in both datasets. Bytes 5 & 6 are the only differences and these are not mentioned in your control cards. Why do you need a JOIN ? Is there only one record in the second dataset or can there be multiple records?

Can you show any of your failing jobs?

Garry.

Re: Compare field in one file with field in other file

PostPosted: Fri Apr 12, 2019 10:18 pm
by pgkkreddy1
Hi,

Thank you.

yes it is binary format. first 2 bytes year and second 2 bytes Month.

Jnf1 : 449 length and jnf2: 80 out file: 449

[code=mainframe]SYSIN :                                                          
  SORT FIELDS=COPY                                                
  JOINKEYS FILES=F1,FIELDS=(1,2,A,3,2,A)                          
  JOINKEYS FILES=F2,FIELDS=(1,2,A,3,2,A)                          
  REFORMAT FIELDS=(F1:1,449,?,F2:1,4)                            
  INCLUDE COND=(1,4,BI,EQ,451,4)                                  
                                *                                
WER813I  INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED    
WER251A  INCLUDE/OMIT INVALID FORMAT                              
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                    
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE      
             

Thank you
KK

Re: Compare field in one file with field in other file

PostPosted: Sat Apr 13, 2019 1:11 am
by Garry F Carroll
Only part of the DCB provided.... are these datasets FB or VB ? If VB, you haven't allowed for the 4-byte RDW at the start of the record.

You've posted in the DFSORT forum but are using SYNCSORT - which is a competitor product and has a separate section. Try posting in the correct location in future.

You haven't shown anything from a failing job? The JCL, control cards and any output would be useful. You haven't said what your expected output should look like.
Please supply all relevent information when posting. which records should be output and where are you outputting these? Your INCLUDE might just output the "joined" records.

Garry.