MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Eztrieve to compare 1 file against multiple files

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
dohellwithmf
Beginner


Joined: 12 Jul 2007
Posts: 55
Topics: 23

PostPosted: Thu Apr 30, 2009 6:53 pm    Post subject: Eztrieve to compare 1 file against multiple files Reply with quote

Hi All,

I need ur urgent help. I have to compare 1 file against 4 files in an Ezt. Based on which 2 files have matchign keys i have to populate different indicators in the output file. example:

--if key in file 1 matches with file2 then 12
--if key in file 1 matches with file3 then 13
--if key in file 1 matches with file 2 and file 3 then 123 and so on....

Pls reply asap....thanks in anticipation !!!!
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Apr 30, 2009 8:07 pm    Post subject: Reply with quote

dohellwithmf,

untested sample code. I assumed that your key is 4 bytes in pos 1 in all files and File1 does NOT have any duplicates.

Code:

//SYSIN    DD *         
                                         
  FILE FILE1                           
       F1-KEY           01 04 A           
                                         
  FILE FILE2                           
       F2-KEY           01 04 A           
                                         
  FILE FILE3                           
       F3-KEY           01 04 A           

  FILE FILE4                           
       F4-KEY           01 04 A           
                                         
  FILE OUTPUT FB(0 0)                   
       OUT-KEY          01 04 A           
       OUT-FLAGS        06 04 A           
     

******************************************
* MAINLINE                               *
******************************************
                                         
 JOB INPUT (FILE1   KEY (F1-KEY)  +
            FILE2   KEY (F2-KEY)  +
            FILE3   KEY (F3-KEY)  +
            FILE4   KEY (F4-KEY))

     IF MATCHED                     
        OUT-KEY     = F1-KEY
        OUT-FLAGS   = '1234'
        PUT OUTPUT
     ELSE-IF FILE1 AND FILE2 AND NOT FILE3 AND NOT FILE4
        OUT-KEY     = F1-KEY
        OUT-FLAGS   = '12  '
        PUT OUTPUT                   
     ELSE-IF FILE1 AND FILE3 AND NOT FILE2 AND NOT FILE4
        OUT-KEY     = F1-KEY
        OUT-FLAGS   = '13  '
        PUT OUTPUT                   
     ELSE-IF FILE1 AND FILE4 AND NOT FILE2 AND NOT FILE3
        OUT-KEY     = F1-KEY
        OUT-FLAGS   = '14  '
        PUT OUTPUT                   
     END-IF     
 
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group