Compare two numeric values in two different files



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Compare two numeric values in two different files

Postby avinashmusic » Mon Feb 17, 2014 3:45 pm

Hi Experts,

I have a requirement where in i have to compare extract and load count and write a report as 'Y' if both counts match, else 'N'

Input 1: LRECL=18
ABCDEFG 0000001655


Input 2: LRECL=10
0000001654


Expected Output: LRECL=31
ABCDEFG <Input 1 count> <Input 2 count> Y/N

For the above example the output will be:
ABCDEFG 0000001655 0000001654 N


Can someone please help? Let me know in case more details are needed.
avinashmusic
 
Posts: 21
Joined: Tue Dec 24, 2013 4:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Compare two numeric values in two different files

Postby avinashmusic » Mon Feb 17, 2014 9:36 pm

Could someone please help me with this?
avinashmusic
 
Posts: 21
Joined: Tue Dec 24, 2013 4:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Compare two numeric values in two different files

Postby enrico-sorichetti » Mon Feb 17, 2014 10:36 pm

please do not solicit for answers

remember,
replying is on voluntary base and on our own time,
and to a certain extent also on the interest of the topic

there is no commitment to reply, there should not be any expectation of an answer

if You have time constraint a forum is not the best place to ask for help
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Compare two numeric values in two different files

Postby skolusu » Tue Feb 18, 2014 2:51 am

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//INA      DD DISP=SHR,DSN=Your Input FB 18 byte file
//INB      DD DISP=SHR,DSN=Your Input FB 10 byte file
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  OPTION COPY                                                 
  JOINKEYS F1=INA,FIELDS=(19,1,A),SORTED,NOSEQCK               
  JOINKEYS F2=INB,FIELDS=(13,1,A),SORTED,NOSEQCK               
  REFORMAT FIELDS=(F1:1,18,F2:1,13)                           
  INREC IFTHEN=(WHEN=(9,10,CH,EQ,20,10,CH),OVERLAY=(31:C'Y')) 
//*                                                           
//JNF1CNTL DD *                                               
  OPTION STOPAFT=1                                             
  INREC OVERLAY=(19:C'N')                                     
//*                                                           
//JNF2CNTL DD *                                               
  OPTION STOPAFT=1                                             
  INREC BUILD=(X,1,10,X,C'N')                                 
//*           
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Compare two numeric values in two different files

Postby avinashmusic » Tue Feb 18, 2014 9:48 am

Thanks Kolusu for your response. I am yet to try it out, but Enrico, i never demanded an answer, it was just a request, and i very well know how this forum goes. I respect your concern though. I was not trying to solicit answers, i had tried a way which paritally works, but dint wanna post it as it could be quite confusing.

Here is what i tried,
//SYSIN    DD *                                               
  OPTION COPY                                                 
  JOINKEYS F1=INA,FIELDS=(9,10,A)           
  JOINKEYS F2=INB,FIELDS=(1,10,A)
  JOIN UNPAIRED F1,F2
  REFORMAT FIELDS=(F1:1,18,F2:1,10,?)
  OPTION COPY
  OUTFIL FNAMES=F1ONLY
  OUTFIL FNAMES=BOTH   
/*


In the next step, i overlayed 'B' that comes in the above output with 'Y'
But unfortunately, it worked only for the case when both the counts match. So i put this up here.

Thanks,
Avinash
avinashmusic
 
Posts: 21
Joined: Tue Dec 24, 2013 4:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Compare two numeric values in two different files

Postby avinashmusic » Tue Feb 18, 2014 10:15 am

skolusu wrote:
//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//INA      DD DISP=SHR,DSN=Your Input FB 18 byte file
//INB      DD DISP=SHR,DSN=Your Input FB 10 byte file
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  OPTION COPY                                                 
  JOINKEYS F1=INA,FIELDS=(19,1,A),SORTED,NOSEQCK               
  JOINKEYS F2=INB,FIELDS=(13,1,A),SORTED,NOSEQCK               
  REFORMAT FIELDS=(F1:1,18,F2:1,13)                           
  INREC IFTHEN=(WHEN=(9,10,CH,EQ,20,10,CH),OVERLAY=(31:C'Y')) 
//*                                                           
//JNF1CNTL DD *                                               
  OPTION STOPAFT=1                                             
  INREC OVERLAY=(19:C'N')                                     
//*                                                           
//JNF2CNTL DD *                                               
  OPTION STOPAFT=1                                             
  INREC BUILD=(X,1,10,X,C'N')                                 
//*           


Thanks Kolusu. Works perfectly. But can you please explain me about the below

//JNF1CNTL DD *                                               
  OPTION STOPAFT=1                                             
  INREC OVERLAY=(19:C'N')                                     
//*                                                           
//JNF2CNTL DD *                                               
  OPTION STOPAFT=1                                             
  INREC BUILD=(X,1,10,X,C'N')                                 
//*
avinashmusic
 
Posts: 21
Joined: Tue Dec 24, 2013 4:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Compare two numeric values in two different files

Postby skolusu » Wed Feb 19, 2014 2:44 am

avinashmusic wrote:Thanks Kolusu. Works perfectly. But can you please explain me about the below


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post