Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Compare Two datasets and get the 1st unmatched record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ArunkumarGanesan

New User


Joined: 09 Jan 2020
Posts: 8
Location: USA

PostPosted: Fri Mar 27, 2020 2:00 am    Post subject: Compare Two datasets and get the 1st unmatched record
Reply with quote

Hi,

I am having a requirement to compare two datasets and get the 1st unmatched after the matched record and last unmatched record from 1st file alone.

Input1: Recfm: FB LRECL:80
Key: 1,8,ZD
20200209
20200312
20200414
20200516

Input2: Recfm: FB LRECL:80
Key:4,8,ZD
MAY20200209INITIAL

Expected Output:
20200312 20200516

I tried using joinkeys. I am getting all unmatched records in the unmatched file.
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2405
Location: Hampshire, UK

PostPosted: Fri Mar 27, 2020 2:50 am    Post subject: Reply to: Compare Two datasets and get the 1st unmatched record
Reply with quote

Line 5 of your control statements has a positional error.
Back to top
View user's profile Send private message
ArunkumarGanesan

New User


Joined: 09 Jan 2020
Posts: 8
Location: USA

PostPosted: Fri Mar 27, 2020 2:59 am    Post subject: Re: Reply to: Compare Two datasets and get the 1st unmatched record
Reply with quote

Nic Clouston wrote:
Line 5 of your control statements has a positional error.


Nic. I'm so sorry i didn't get your advice. Can you please explain me
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 317
Location: Inside the SPEW (Cincinnati OH USA)

PostPosted: Fri Mar 27, 2020 4:14 am    Post subject:
Reply with quote

Nic's humorous comment was alerting you to the fact that you failed to include your control statements in your original post.
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 309
Location: Bamberg, Germany

PostPosted: Fri Mar 27, 2020 10:12 am    Post subject: Re: Reply to: Compare Two datasets and get the 1st unmatched record
Reply with quote

Nic Clouston wrote:
Line 5 of your control statements has a positional error.

It has been fixed now. Output is as requested:
Code:
20200312 20200516
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 309
Location: Bamberg, Germany

PostPosted: Thu Apr 02, 2020 10:58 am    Post subject:
Reply with quote

It seems impossible for the TS to provide any Code that was tried or if the issue has been solved to provide a solution. icon_evil.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2405
Location: Hampshire, UK

PostPosted: Thu Apr 02, 2020 2:06 pm    Post subject: Reply to: Compare Two datasets and get the 1st unmatched record
Reply with quote

Nowadays you cannot tell if they are just being rude or are under lockdown and unable to get to work.
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 309
Location: Bamberg, Germany

PostPosted: Fri Apr 03, 2020 10:05 am    Post subject:
Reply with quote

Code:
//THEEND   EXEC PGM=ICEMAN
//F1       DD *                                                       
20200209 
20200312 
20200414 
20200516 
/*                                                                   
//F2       DD *
JUN20200209INITIAL                                                   
/*                                                                   
//SORTOUT  DD SYSOUT=*                                               
//SYSOUT   DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  JOINKEYS F1=F1,FIELDS=(1,8,A),SORTED                               
  JOINKEYS F2=F2,FIELDS=(4,8,A),SORTED,NOSEQCK                       
  JOIN UNPAIRED,F1                                                   
  REFORMAT FIELDS=(F1:1,8,F2:4,8,?)                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(18:+0,ZD,LENGTH=8)),               
    IFTHEN=(WHEN=GROUP,BEGIN=(17,1,CH,EQ,C'B'),PUSH=(18:SEQ=8)),     
    IFTHEN=(WHEN=GROUP,BEGIN=(18,8,ZD,EQ,+2),PUSH=(9:1,8))           
  SORT FIELDS=(18,8,ZD,D)                                             
  OUTFIL FNAMES=(SORTOUT),                                           
    INCLUDE=(18,8,ZD,GT,+1),                                         
    ACCEPT=1,NULLOFL=RC4,                                             
    BUILD=(9,8,X,1,8)                                                 
  END                                                                 
/*

Output:
Code:
20200312 20200516
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare two character variables Head ... Harold Barnes CLIST & REXX 3 Fri Aug 28, 2020 12:38 am
No new posts Abend deletes last record written julietspringsteen ABENDS & Debugging 10 Fri Aug 21, 2020 7:45 pm
No new posts Problem getting record length of a re... amitc23 COBOL Programming 2 Thu Jul 02, 2020 10:52 pm
No new posts How to fetch the latest record from a... Dinesh Mani DFSORT/ICETOOL 8 Tue Jun 02, 2020 5:34 pm
No new posts Compare multiple files using JCL/Rexx... tanvi110788 JCL & VSAM 4 Tue May 19, 2020 5:47 pm

Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us