Victor,

It is not quite clear as to what to merge when all you need is to match 2 
files on the DSN names and output from 1 file if they matched. A sample of 
input and desired output would have helped. You can use DFSORT JOINKEYS to 
match the 2 files and get the desired results. 

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=* 
//INA      DD * 
----+----1----+----2----+----3----+----4----+----5----+----6
A.B.C                                       ,0001,0002 
A.B.C.D                                     ,0002,0004 
A.B.C.D.E                                   ,0003,0006 
A.B.C.D.E.F                                 ,0004,0008 
//INB      DD * 
A.B.C 
A.B.C.D 
C.D.E.F.G 
//SORTOUT  DD SYSOUT=* 
//SYSIN    DD * 
  OPTION COPY 
  JOINKEYS F1=INA,FIELDS=(1,44,A),SORTED,NOSEQCK 
  JOINKEYS F2=INB,FIELDS=(1,44,A),SORTED,NOSEQCK 
  REFORMAT FIELDS=(F1:1,55) 
//* 

The output from this job is 

A.B.C                                       ,0001,0002
A.B.C.D                                     ,0002,0004

If that is not what you expect , then please show a sample input and 
desired output.

Thanks,
Kolusu
DFSORT Development
IBM Corporation

IBM Mainframe Discussion List <[email protected]> wrote on 
04/22/2013 01:27:42 AM:

> From: Victor Zhang <[email protected]>
> To: [email protected], 
> Date: 04/22/2013 01:28 AM
> Subject: Merging two files
> Sent by: IBM Mainframe Discussion List <[email protected]>
> 
> Hello,
> There are two files:
> file 1: 1-44 contans dsn names, sorted in ascending order,no duplicate 
names
> file 2: 
> 1-44 contains dsn names
> 45 is , 
> 46-49 is 4 digits chars
> 50 is ,
> 51-54 is 4 digits chars
> the files is sorted in ascedning order, keys are multiple keys:1-44,
> 51-54,46-49
> Can I use sort to merge the two files?
> ie. if dsn in file2 is found in files, then output the files records.
> 
> Appreciate your help.
> 
> Regards
> Victor
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
> 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to