> 2.     A dataset with data to insert into a BASE record IF the key data
match
> I'd like to outputs.
>
> 1.     With the BASE records that were NOT updated
>
> 2.     With the BASE records that WERE updated


George,

It is tough to diagnose without looking at the data or the joblog. SPLICE
is an old technique to match files and it has limitation when you have a
MANY to MANY match.  If both files have duplicates on the key, then splice
will not give the cartesian product. Also expanding the files to larger
lrecl and sorting it would require additional resources.

Either way you need to use Joinkeys which is much more efficient and better
processing option to match files.

Check out the following smart tricks which shows different ways to match
and update files

   Join fields from two files on a key
   Join fields from two files record-by-record
   Cartesian join
   Create files with matching and non-matching records

https://www.ibm.com/support/pages/smart-dfsort-tricks

If you have trouble adapting those tricks, here is something that I coded
so that it is easy to understand. Brief description of the job.

STEP0100 - creates a sample BASE dataset (LRECL=480, RECFM=FB)
STEP0200 - creates the UPDT dataset  (LRECL=100, RECFM=FB)
STEP0300 - Matches BASE file with UPDT file and creates with matching and
non-matching records ( This is the ONLY step that you would need to run)

//***************************************************************
//* CREATE THE BASE FILE WITH SAMPLE DATA AND LRECL=480 RECFM=FB*
//***************************************************************
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
1111111111                   - THIS DOES NOT HAVE A MATCHING KEY
AAAAAAAAAA                   - THIS DOES NOT HAVE A MATCHING KEY
BBBBBBBBBB                   - HAS MATCHING KEY SO UPDATE POSITION 151
ZZZZZZZZZZ                   - HAS MATCHING KEY SO UPDATE POSITION 151
//SORTOUT  DD DSN=&&BASE,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN    DD *
  OPTION COPY
  INREC OVERLAY=(151:C'MOVE THIS VALUE TO POSITION 191',480:X)
/*
//***************************************************************
//* CREATE THE UPDT FILE WITH SAMPLE DATA AND LRECL=100 RECFM=FB*
//***************************************************************
//STEP0200 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
KKKKKKKKKK
ZZZZZZZZZZ                     UPDATE THE 1234 BASE
BBBBBBBBBB                     UPDATE THE 5678 BASE
//SORTOUT  DD DSN=&&UPDT,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN    DD *
  OPTION COPY
  INREC OVERLAY=(100:X)
/*
//***************************************************************
//* MATCH THE BASE FILE WITH KEY (1,21) AND UPDATE POS 151 FROM *
//* THE VALUES FROM UPDT FILE                                   *
//***************************************************************
//STEP0300 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//BASE     DD DISP=(OLD,PASS),DSN=&&BASE
//UPDT     DD DISP=(OLD,PASS),DSN=&&UPDT
//BASEUPDT DD SYSOUT=*
//ONLYBASE DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  JOINKEYS F1=BASE,FIELDS=(1,21,A)
  JOINKEYS F2=UPDT,FIELDS=(1,21,A)
  JOIN UNPAIRED
  REFORMAT FIELDS=(F1:1,480,?,F2:32,20)

  OUTFIL FNAMES=BASEUPDT,
  INCLUDE=(481,1,CH,EQ,C'B'),
  BUILD=(1,150,482,20,20X,151,330)

  OUTFIL FNAMES=ONLYBASE,
  INCLUDE=(481,1,CH,EQ,C'1'),
  BUILD=(1,150,40X,151,330)
/*

Further if you have any questions please let me know

Thanks,
Kolusu
DFSORT Development
IBM Corporation

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to