Minoru Massaki at IBM Mainframe Discussion List <[email protected]>
wrote on 01/23/2012 08:47:00 AM:
> I'm looking for a way to do following by DFSORT.   I have read through
> DFSORT manuals but I could not find out the method.  Your help would
> be highly appreciated.
>
> There is a master file which contains Volume serial (VOLSER).  The
> master file is sorted by VOLSER and there is NO duplicate VOLSER.
> Each record of the detailed record file contains VOLSER and data set
> name.  The detailed record file is also sorted by VOLSER and there are
> duplicate VOLSER.  In some case, detailed record file does not contain
> VOLSER record which is in mster record.
> I want to split detailed record file into two files based on master
> record file as following:
>
> Master record file
>    VOL000
>    VOL001
>    VOL005
>    VOL010
>
> Detailed record file
>     VOL001   AAA
>     VOL002   BBB
>     VOL005   CCC
>     VOL005   DDD
>     VOL007   EEE
>     VOL007   FFF
>
> DFSORT output
>    master-exist
>        VOL001   AAA
>        VOL005   CCC
>        VOL005   DDD
>
>    non-master
>        VOL002   BBB
>        VOL007   EEE
>        VOL007   FFF
>
>
> Can DFSORT do it?

You can use a DFSORT JOINKEYS job like the following to do what  you asked
for.
I made some assumptions about the RECFM and LRECL of you input files and
the
starting positions of your fields, but you can adjust as needed if I
guessed wrong.

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD *
   VOL000
   VOL001
   VOL005
   VOL010
//IN2 DD *
    VOL001   AAA
    VOL002   BBB
    VOL005   CCC
    VOL005   DDD
    VOL007   EEE
    VOL007   FFF
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(4,6,A),SORTED
  JOINKEYS F2=IN2,FIELDS=(5,6,A),SORTED
  JOIN UNPAIRED,F2
  REFORMAT FIELDS=(F2:1,80,?)
  OPTION COPY
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'B'),BUILD=(1,80)
  OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,80)
/*

For complete details on DFSORT's JOINKEYS function, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA60/4.0?DT=20110608113434

Frank Yaeger - DFSORT Development Team (IBM) - [email protected]
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration

 => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

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

Reply via email to