Page 1 of 1

Compare two numeric values in two different files

PostPosted: Mon Feb 17, 2014 3:45 pm
by avinashmusic
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.

Re: Compare two numeric values in two different files

PostPosted: Mon Feb 17, 2014 9:36 pm
by avinashmusic
Could someone please help me with this?

Re: Compare two numeric values in two different files

PostPosted: Mon Feb 17, 2014 10:36 pm
by enrico-sorichetti
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

Re: Compare two numeric values in two different files

PostPosted: Tue Feb 18, 2014 2:51 am
by skolusu
//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')                                 
//*           

Re: Compare two numeric values in two different files

PostPosted: Tue Feb 18, 2014 9:48 am
by avinashmusic
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

Re: Compare two numeric values in two different files

PostPosted: Tue Feb 18, 2014 10:15 am
by avinashmusic
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')                                 
//*

Re: Compare two numeric values in two different files

PostPosted: Wed Feb 19, 2014 2:44 am
by skolusu
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