Copy records for matching key appearing at different places.

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
User avatar
rangab
Active Member
Posts: 56
Joined: Fri Mar 17, 2006 3:21 pm

Copy records for matching key appearing at different places.

Post by rangab » Tue Feb 03, 2009 5:30 pm

Hi,

I want to compare FILE-1 & FILE-2 and compare matching records from FILE-2 to output file.

FILE-1: RECFM=FB, LRECL=80

Code: Select all

TBIG100
TBIG200
TBIG980
FILE-2: RECFM=FB, LRECL=88

Code: Select all

XMART_C%F#N_TBIG800_FINTE%AM
PRIN%CE%TON_FINTEAM_BAR%^*&SA_TBIG200
OVERLAY*&_COMPO%$%ITT_TBIG100
XMART_CAPT#*_09900_TBIG910
JUMPR%&_TBIG980_RSECUR@@_FIN
Expected Output:

Code: Select all

OVERLAY*&_COMPO%$%ITT_TBIG100
PRIN%CE%TON_FINTEAM_BAR%^*&SA_TBIG200
JUMPR%&_TBIG980_RSECUR@@_FIN
Thanks.
========
Ranga...:-0)
========
Learn Which You Don't Know - Teach Others Which They Don't Know.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Feb 03, 2009 9:41 pm

Do you want to select records in which any of the 7-character strings from input file1 appear anywhere in input file2? Or are the "rules" something else?

What is the maximum number of records you can have in input file1 (e.g. 10? 100? 1000? 10000?).
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

User avatar
rangab
Active Member
Posts: 56
Joined: Fri Mar 17, 2006 3:21 pm

Post by rangab » Tue Feb 03, 2009 10:26 pm

Frank, Thanks for the reply.

Yes. Your assumption is correct. The File-1 can have records anywhere between 28000 to 50000. The File-2 can have records upto 1.5 millions.

Thank you.
========
Ranga...:-0)
========
Learn Which You Don't Know - Teach Others Which They Don't Know.

skolusu
Member
Posts: 43
Joined: Sat Jul 26, 2008 12:38 am

Post by skolusu » Tue Feb 03, 2009 11:26 pm

The following DFSORT/ICETOOL JCL will give you the desired results based on this assumption.

1. All your search strings in file 2 starts with a word "TBIGxxx".(we can modify to look for other strings also)
2. There can be only 1 occurance of TBIGxxx in your file-2 per record and it doesn't have any duplicates (we can handle duplicates also, let me know if you want to handle them also)

Brief explanation of the Job.

1.Step0100 - Copy the key contents from 80 byte file1 to pos 89 for 7 bytes and write to temp file t1
2.Step0200 - Use Parse to capture the 7 bytes starting with TBIG in your 88 byte file and put that at the end i.e pos 89 and write it temp file t2
3. Now concatenate these 2 files and any matching recording will be a dupe and since we only wanted the records from file 2 , we use the LASTDUP parm to get the desired results

Code: Select all

//STEP0100 EXEC PGM=ICEMAN                                 
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                            
TBIG100                                                    
TBIG200                                                    
TBIG980                                                    
//SORTOUT  DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE) 
//SYSIN    DD *                                            
  SORT FIELDS=COPY                                         
  INREC BUILD=(89:1,7)                                     
//*                                                        
//STEP0200 EXEC PGM=ICEMAN                                      
//SYSOUT   DD SYSOUT=*                                          
//SORTIN   DD *                                                 
XMART_C%F#N_TBIG800_FINTE%AM                                    
PRIN%CE%TON_FINTEAM_BAR%^*&SA_TBIG200                           
OVERLAY*&_COMPO%$%ITT_TBIG100                                   
XMART_CAPT#*_09900_TBIG910                                      
JUMPR%&_TBIG980_RSECUR@@_FIN                                    
//SORTOUT  DD DSN=&&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)      
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                              
  INREC PARSE=(%00=(STARTAT=C'TBIG',FIXLEN=7)),                 
       OVERLAY=(89:%00)                                         
/*
//STEP0300 EXEC PGM=ICETOOL                    
//TOOLMSG  DD SYSOUT=*                         
//DFSMSG   DD SYSOUT=*                         
//IN       DD DSN=&&T1,DISP=SHR                
//         DD DSN=&&T2,DISP=SHR                
//OUT      DD SYSOUT=*                         
//TOOLIN   DD *                                
  SELECT FROM(IN) TO(OUT) ON(89,7,CH) LASTDUP  
/* 
The output from this job is

Code: Select all

OVERLAY*&_COMPO%$%ITT_TBIG100          
PRIN%CE%TON_FINTEAM_BAR% *&SA_TBIG200  
JUMPR%&_TBIG980_RSECUR@@_FIN           
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

User avatar
rangab
Active Member
Posts: 56
Joined: Fri Mar 17, 2006 3:21 pm

Post by rangab » Tue Feb 03, 2009 11:36 pm

skolusu, Thank you very much for the immediate help.
========
Ranga...:-0)
========
Learn Which You Don't Know - Teach Others Which They Don't Know.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others