# Compare 2 work files

**URL:** <https://techcommunity.softwareag.com/t/compare-2-work-files/245214>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural\
**Created:** [October 20, 2021, 4:47pm UTC](https://techcommunity.softwareag.com/t/compare-2-work-files/245214 "2021-10-20T16:47:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jade.hone](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jade.hone](https://techcommunity.softwareag.com/u/jade.hone)\
**Post date:** [October 20, 2021, 4:47pm UTC](https://techcommunity.softwareag.com/t/compare-2-work-files/245214/1 "2021-10-20T16:47:32Z")

</div>

Natural

#### What are trying to achieve? Please describe in detail.

What is the best way to compare data in two work files which have the same field present?  
I want to accomplish the following:  
Read work file 1 and select FIELD  
Search for FIELD in work file 2  
If FIELD present in both work files  
Write work file 3

#### Do you get any error messages? Please provide a **full error** message screenshot and log file.

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [October 20, 2021, 6:50pm UTC](https://techcommunity.softwareag.com/t/compare-2-work-files/245214/2 "2021-10-20T18:50:46Z")

</div>

So long as the work files are sorted by the matched field(s), this can be done very easily with [Sequential Match](https://techcommunity.softwareag.com/t/sequential-match/60707) logic.

In customizing ZZMATCH, you will remove most of the comment lines and trace logic, leaving a simple, compact program.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [January 18, 2022, 6:51pm UTC](https://techcommunity.softwareag.com/t/compare-2-work-files/245214/3 "2022-01-18T18:51:10Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
