Page 1 of 1

Remove records according to a list

PostPosted: Tue Feb 08, 2011 4:54 pm
by olivermf
Hello,

I want to omit all records in a PS-File according to a list of chars in another file and do this using DFSort/Icetool.

Example:

File:

abcdef1234567ghijklmn
abcdef2345678ghijklmn
abcdef3456789ghijklmn
abcdef4567890ghijklmn

File2:
2345678
3456789


I want to omit all records that include the chars in File2 on column 6 length 7. There can be more than one entry in the first file that includes the char in file2. All of them have to be deleted.

The last PTF-Packages has been installed on the mainframe system.

Thank you in advance,

regards,

Oliver

Re: Remove records according to a list

PostPosted: Tue Feb 08, 2011 10:12 pm
by skolusu
olivermf,

The following DFSORT JCL will give you the desired results

//STEP0100 EXEC PGM=SORT                   
//SYSOUT   DD SYSOUT=*                     
//INA      DD *                           
----+----1----+----2----+----3----+----4---
ABCDEF1234567GHIJKLMN                     
ABCDEF2345678GHIJKLMN                     
ABCDEF3456789GHIJKLMN                     
ABCDEF4567890GHIJKLMN                     
//INB      DD *                           
2345678                                   
3456789                                   
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                           
  OPTION COPY                             
  JOINKEYS F1=INA,FIELDS=(7,7,A)           
  JOINKEYS F2=INB,FIELDS=(1,7,A)           
  JOIN UNPAIRED,F1,ONLY                   
//*


The output from this job is
ABCDEF1234567GHIJKLMN
ABCDEF4567890GHIJKLMN

Re: Remove records according to a list

PostPosted: Wed Feb 09, 2011 1:14 pm
by olivermf
Thank you very much for your fast reply!
This was exactly what I wanted to do.