Hi,
I have two files that need to be compared based on a field.
first file : is of record length 90 and the field to be compared is from column pos 1-9. This field is duplicated.
Second file: is of record length 150 and the field to be compared is from column pos 1-9. This field is not duplicated.
If the field in first file is present in the second file then we need to write the record from first file to third file along with a filed from the second file present in col pos 140-150.
If it is not present then we need to have it as spaces.
Please guide me with a solution.
Comparing two files
-
- Posts: 1
- Joined: Fri Mar 07, 2014 12:18 pm
- Skillset: Cobol, JCL, Basics of IMS-DB and Easytrieve
- Referer: Mainframe queries and forum search on google
Re: Comparing two files
Hi,
You need to first run a step to remove duplicate records from your first file. Code is
//Sysin dd*
sort fields=(1,9,CH,A)
sum fields=none
/*
Then you have to use JOINKEYS in your sysin card as below:
JOINKEYS F1=FILEA,FIELDS=(1,9,A)
JOINKEYS F2=FILEB,FIELDS=(1,9,A)
REFORMAT FIELDS=(F1:1,90,F2:140,11)
SORT FIELDS=COPY
Hope this will help.
You need to first run a step to remove duplicate records from your first file. Code is
//Sysin dd*
sort fields=(1,9,CH,A)
sum fields=none
/*
Then you have to use JOINKEYS in your sysin card as below:
JOINKEYS F1=FILEA,FIELDS=(1,9,A)
JOINKEYS F2=FILEB,FIELDS=(1,9,A)
REFORMAT FIELDS=(F1:1,90,F2:140,11)
SORT FIELDS=COPY
Hope this will help.
-Yogesh
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Joining 2 vb files into vsam files ended error
by newbiemainframe » Thu Nov 12, 2020 7:59 am » in JCL - 1
- 1758
-
by NicC
View the latest post
Thu Nov 12, 2020 7:15 pm
-
-
- 8
- 6141
-
by kbabu
View the latest post
Mon Mar 15, 2021 8:25 am
-
- 0
- 2576
-
by JIMDOOEY
View the latest post
Tue Mar 01, 2022 8:48 am
-
- 1
- 1847
-
by sergeyken
View the latest post
Mon Nov 23, 2020 7:25 pm
-
- 1
- 1251
-
by sergeyken
View the latest post
Tue Nov 08, 2022 7:22 pm