|
Greg Weber wrote: > > Hello, > > I am looking for some advise. I am working on a project, this project > requires that I compare records from 2 files. File A and File B. File > A is the primary file and File B is the secondary file. I need to > compare the records that are in File A to the records in File B. What I > am having a problem with is if there is a record in File B that is not > in File A I need to know that. I Was going to read File A and chain out > to File B to see if the record exists in File B. I am having problems > on how to determine if there is a record in File B that is not in File > A. Any help would be greatly appreciated. > Can you say 'Matching Record' ? All joking aside, this is a perfect match (sorry) for what you want. Here's a small program (some comments intentionally removed - so no attacks allowed on that either :-) ) that uses matching record while reading a this year & last year GL Master file and posting the closing account balance from last year to the opening balance of this year (no attacks from the critics and purists please, this is from a program originally written in the early 80's on a S/34). It had actually been written using CHAIN to update, but at a customer with a LARGE chart of accounts (over 40,000) it was taking something like 40 minutes to run. The run time for matching record was something like 4 minutes (don't hold me to those numbers, it was 10 years ago, but the speed up was of that order of magnitude). The matching fields are the M2 & M1 indicators on fields COMPFL and ACCTGL. As a quick lesson in matching record, these indicators define in order (like L1, L2 etc) the fields you want to match on. They aren't really indicators, just matching levels, and you could use the same matching level on several fields if you wanted (you aren't limited to 9 only). When a field in the two files (or more, you could have multiple secondary files) matches, indicator MR is set on. If the first file has record identifying indicator 01, and the sedond file 02, then: 01 MR Record just read from primary file, there is a match in secondary (if you update on 01 MR you would update the primary file). 01NMR Record just read from primary file, no match in secondary 02 MR Record just read from secondary file, matched previously read record from primary file (this would be normal condition to update secondary file on if, for example, you wanted to propogate a new field like product code from a primary master to all records in a transaction file that had same item #). 02NMR Record just read from secondary file, no match in primary H/TITLE TO POST OPENING BALANCES AT YEAR END. F* * N.PALMER - 12NOV87 - CHANGE CHAIN TO MATCHING RECORD. F* * FGLLYMST IP AE K DISK F GLMAST KRENAMEREC1 FGLMAST US AE K DISK F GLMAST KRENAMEREC2 FGLNAME2CIF E K DISK E* E MON 13 11 2 IREC1 01 I COMPGLL2M2 I ACCTGLL1M1 I MO01GL MON,1 I MO02GL MON,2 I MO03GL MON,3 I MO04GL MON,4 I MO05GL MON,5 I MO06GL MON,6 I MO07GL MON,7 I MO08GL MON,8 I MO09GL MON,9 I MO10GL MON,10 I MO11GL MON,11 I MO12GL MON,12 I MO13GL MON,13 IREC2 02 I COMPGLL2M2 I ACCTGLL1M1 I OPENGL OPENG I OPNLGL OPENL C* C *IN98 IFEQ '0' C KEYC KLIST C KFLD RCID C KFLD KEY6 C KEYGL KLIST C KFLD COMPGL C KFLD ACCTGL C MOVE '1' *IN98 CONTROL LR TOT C END C* C *INL2 IFEQ '1' C Z-ADD12 ACPRCC 67 C MOVEL'C' RCID 1 C Z-ADDCOMPGL KEY6 60 C KEYC CHAINGLNAME2C 68 C** *IN68 IFEQ '0' C** ACPRCC COMP 13 67 C** END C END C* C *IN01 IFEQ '1' C XFOOTMON OPENB 112 C ADD OPENGL OPENB C ACPRCC IFLT 13 C SUB MON,13 OPENB C END C END C* C**** KEYGL CHAINGLMAST 02 C *IN02 IFEQ '1' C *INMR ANDEQ'1' C Z-ADDOPENB OPENG C Z-ADDOPENGL OPENL C Z-ADD*ZERO MO01GL C Z-ADD*ZERO MO02GL C Z-ADD*ZERO MO03GL C Z-ADD*ZERO MO04GL C Z-ADD*ZERO MO05GL C Z-ADD*ZERO MO06GL C Z-ADD*ZERO MO07GL C Z-ADD*ZERO MO08GL C Z-ADD*ZERO MO09GL C Z-ADD*ZERO MO10GL C Z-ADD*ZERO MO11GL C Z-ADD*ZERO MO12GL C Z-ADD*ZERO MO13GL C UPDATREC2 C END -- ... Neil Palmer AS/400~~~~~ ... NxTrend Technology -Canada ____________ ___ ~ ... Markham, Ontario, Canada |OOOOOOOOOO| ________ o|__||= ... Phone: (905) 731-9000 x238 |__________|_|______|_|______) ... url:http://www.NxTrend.com oo oo oo oo OOOo=o\ ... mailto:NPalmer@NxTrend.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This is the Midrange System Mailing List! To submit a new message, * * send your mail to "MIDRANGE-L@midrange.com". To unsubscribe from * * this list send email to MAJORDOMO@midrange.com and specify * * 'unsubscribe MIDRANGE-L' in the body of your message. Questions * * should be directed to the list owner / operator: david@midrange.com * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.