Hi All,
I want to remove set of duplicates(not similar rows) from my input file .
Ex:
1st postion : header or trailer or remark
2 to 6 : primary key field
1st set of records
012345AAA --- > The record with '0' at 1st position is HEADER
112345AAA ---- > All the records with '1' AT 1ST position are DETAILS
112345AAA
212345AAA --- > All the records with '2' at 1st are REMARKS
2nd set of records
023456BBB
223456BBB
223456BBB
123456BBB
223456BBB
3rd set of records
012345CCC
212345CCC
112345CCC
212345CCC
212345CCC
Remarks can be present for header or detail or for both.
Now, I want to delete either 1st or 3rd set of records irrespective of how many detail or remark records present.
Required Output
012345AAA
112345AAA
112345AAA
212345AAA
023456BBB
223456BBB
223456BBB
123456BBB
223456BBB
OR
023456BBB
223456BBB
223456BBB
123456BBB
223456BBB
012345CCC
212345CCC
112345CCC
212345CCC
212345CCC
I can write program to acheive this but I want to kown easier way to do the same using DFSORT.
Remove set of duplicates from input file
-
- Posts: 7
- Joined: Thu Jan 08, 2009 6:06 pm
- Skillset: COBOL, JCL, DB2, IDMS, VSAM
- Referer: INTERNET
- Frank Yaeger
- Global moderator
- Posts: 1079
- Joined: Sat Jun 09, 2007 8:44 pm
- Skillset: DFSORT, ICETOOL, ICEGENER
- Referer: Search
- Contact:
Re: Remove set of duplicates from input file
You can use a DFSORT job like the following to remove a given group of records (e.g. third group). You'll need z/OS DFSORT PTF UK90013 (July, 2008) to use DFSORT's new WHEN=GROUP function. If you don't have this PTF, ask your System Programmer to install it.
I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. I used 81,8,ZD,EQ,3 to remove the third group. If you want to remove another group, change 3 to the correct number (e.g. 1 for the first group).
For complete details on DFSORT's new WHEN=GROUP function and the other new functions available with PTF UK90013, see:
http://www.ibm.com/systems/support/stor ... /mvs/ugpf/
I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. I used 81,8,ZD,EQ,3 to remove the third group. If you want to remove another group, change 3 to the correct number (e.g. 1 for the first group).
Code: Select all
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
012345AAA
112345AAA
112345AAA
212345AAA
023456BBB
223456BBB
223456BBB
123456BBB
223456BBB
012345CCC
212345CCC
112345CCC
212345CCC
212345CCC
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'0'),
PUSH=(81:ID=8))
OUTFIL OMIT=(81,8,ZD,EQ,3),BUILD=(1,80)
/*
For complete details on DFSORT's new WHEN=GROUP function and the other new functions available with PTF UK90013, see:
http://www.ibm.com/systems/support/stor ... /mvs/ugpf/
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Similar Topics
- Replies
- Views
- Last post
-
-
File Handling 3 input files and 1 output file by using EZT
by pavan426 » Thu Sep 09, 2021 12:17 am » in CA-Easytrieve - 0
- 4429
-
by pavan426
View the latest post
Thu Sep 09, 2021 12:17 am
-
-
-
eliminate duplicates with different data
by cobol_dev » Fri Jun 03, 2022 3:47 am » in DFSORT/ICETOOL/ICEGENER - 7
- 1887
-
by cobol_dev
View the latest post
Wed Jun 15, 2022 10:44 pm
-
-
- 1
- 2354
-
by sergeyken
View the latest post
Fri Jun 03, 2022 2:49 am
-
- 4
- 2258
-
by sergeyken
View the latest post
Mon Jun 26, 2023 12:56 am
-
-
remove leading special chars, space & trailing special char
by srihemz » Tue Jun 30, 2020 8:06 pm » in DFSORT/ICETOOL/ICEGENER - 2
- 3874
-
by sergeyken
View the latest post
Wed Jul 01, 2020 4:55 pm
-