Page 1 of 1

Variable length files matching records

PostPosted: Thu Jun 28, 2012 3:55 pm
by whowillwait4u
Hi,

I have two variable length files of LRECL 1296. There are no key fields.I want to match on whole records.If a record is present in both should go to BOTH.If a record is present only in file 1 it should go to F1ONLY.If a record is present only in file 2 it should go to F2ONLY.All 3 output files should be of fixed length with LRECL 1296. Fill the extra bytes with spaces.

Could you please help with DFSORT jcl needed?!

Re: Variable length files matching records

PostPosted: Thu Jun 28, 2012 6:10 pm
by NicC
The sort JCL is in the DFSORT manual - you will need to tailor it for your installation.

As for your joinkeys control cards - have you looked in the forum - done a search on joinkeys? It would apper that your requirements is a minimal joinkeys operation and plenty of examples exist.

Re: Variable length files matching records

PostPosted: Thu Jun 28, 2012 7:02 pm
by BillyBoyo
One step with VTOF for each file.

Then a step for the joinkeys with UNPAIRED,F1,F2, specifying the full record as the key, using the ? in the REFORMAT and testing that/using SAVE for the split of the data into three files.

That plus the forum examples and the manual should get you started.

Re: Variable length files matching records

PostPosted: Thu Jun 28, 2012 10:20 pm
by skolusu
Use the following DFSORT JCL which will give you the desired results
//STEP0100 EXEC PGM=SORT,REGION=0M                                             
//SYSOUT   DD SYSOUT=*                                               
//INA      DD DSN=Your Input VB file1,DISP=SHR                                     
//INB      DD DSN=Your Input VB file2,DISP=SHR                                     
//BOTH     DD SYSOUT=*                                               
//F1ONLY   DD SYSOUT=*                                               
//F2ONLY   DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  JOINKEYS F1=INA,FIELDS=(1,1296,A)                                 
  JOINKEYS F2=INB,FIELDS=(1,1296,A)                                 
  JOIN UNPAIRED                                                     
  REFORMAT FIELDS=(F1:1,1296,?,F2:1,1296)                           
  OUTFIL FNAMES=BOTH,INCLUDE=(1297,1,CH,EQ,C'B'),BUILD=(1,1296)     
  OUTFIL FNAMES=F1ONLY,INCLUDE=(1297,1,CH,EQ,C'1'),BUILD=(1,1296)   
  OUTFIL FNAMES=F2ONLY,INCLUDE=(1297,1,CH,EQ,C'2'),BUILD=(1298,1296)
//*                                                                 
//JNF1CNTL DD *                                                     
  INREC OVERLAY=(1296:X)                                             
//*                                                                 
//JNF2CNTL DD *                                                     
  INREC OVERLAY=(1296:X)                                             
//*

Re: Variable length files matching records

PostPosted: Tue Jul 03, 2012 6:47 pm
by whowillwait4u
Thank you All!

I got what i am looking for. I did the same told by Billyboyo before posting this in forum. VTOF and JOINKEYs. But i wanted to reduce the number of steps in my JOB. skolusu gave me that. Thank buddies!. I appreciate your time!

Re: Variable length files matching records

PostPosted: Tue Jul 03, 2012 11:29 pm
by skolusu
whowillwait4u wrote:Thank you All!

I got what i am looking for. I did the same told by Billyboyo before posting this in forum. VTOF and JOINKEYs. But i wanted to reduce the number of steps in my JOB. skolusu gave me that. Thank buddies!. I appreciate your time!



You don't need VTOF as you can directly create the FB files. Use the following Control cards
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  JOINKEYS F1=INA,FIELDS=(5,1292,A)                                 
  JOINKEYS F2=INB,FIELDS=(5,1292,A)                                 
  JOIN UNPAIRED                                                     
  REFORMAT FIELDS=(F1:5,1292,?,F2:5,1292)                           
  OUTFIL FNAMES=BOTH,INCLUDE=(1293,1,CH,EQ,C'B'),BUILD=(1,1292)     
  OUTFIL FNAMES=F1ONLY,INCLUDE=(1293,1,CH,EQ,C'1'),BUILD=(1,1292)   
  OUTFIL FNAMES=F2ONLY,INCLUDE=(1293,1,CH,EQ,C'2'),BUILD=(1294,1292)
//*                                                                 
//JNF1CNTL DD *                                                     
  INREC OVERLAY=(1296:X)                                             
//*                                                                 
//JNF2CNTL DD *                                                     
  INREC OVERLAY=(1296:X)                                             
//*