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 

Sequntial file compares
Goto page Previous  1, 2
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Oct 19, 2007 3:36 pm    Post subject: Reply with quote

Dharani,

Quote:
3 END OF FIELD BEYOND MAXIMUM RECORD LENGTH


Quote:
File1 with length 10


Quote:
//CTL1CNTL DD *
INREC BUILD=(1X,1,4,BI,TO=ZD,LENGTH=10,5,219,10X)


Your input file is 10 bytes long. You have 5,219 in your INREC statement which obviously goes beyond your 10 byte input record. So of course you would get that error message. I don't understand why you're using 5,219 when your records are only 10 bytes long.

I can't tell you how to do what you want because you haven't clearly defined what it is you want to do and you haven't shown a good example of your input records and expected output records.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nagarajan.dharani
Beginner


Joined: 04 Apr 2007
Posts: 20
Topics: 4

PostPosted: Wed Oct 24, 2007 2:01 am    Post subject: Reply with quote

Hi Krisprems,

Thanks a lot for having solved my requirement. But that code is getting me unmatched records also.

I tried the following code that you had given me


//*******************************************************
//GETMATCH EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD file1
//IN2 DD file2
//OUT DD o/o file, lrecl=223
//TMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//TOOLIN DD *
COPY FROM(IN1) TO(TMP1) USING(CP01)
COPY FROM(IN2) TO(TMP1) USING(CP02)
SELECT FROM(TMP1) TO(OUT) ON(1,4,BI) ALLDUPS USING(CP03)
/*
//CP01CNTL DD *
OUTREC BUILD=(1,10,ZD,TO=BI,LENGTH=4,224:C'1')
//*
//CP02CNTL DD *
OUTREC OVERLAY=(224:C'2')
//*
//CP03CNTL DD *
OUTFIL INCLUDE=(224,1,CH,EQ,C'2'),BUILD=(1,223)
//*


The SELECT operator returns records that are duplicates as we have given ALLDUPS.

But this also gives me records that are duplicates in my IN1 which i do not need.
I need only need records that have a match in the IN2 file.

I tried with different logics and nothing gave me good results.

It would be great if some one help me out with this.

Thanks,
Dharani
Back to top
View user's profile Send private message Send e-mail
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Wed Oct 24, 2007 4:09 am    Post subject: Reply with quote

nagarajan.dharani,

Quote:

The SELECT operator returns records that are duplicates as we have given ALLDUPS.



ALLDUPS here is used to bring out the rows that are matched.

Quote:

But this also gives me records that are duplicates in my IN1 which i do not need.
I need only need records that have a match in the IN2 file.


Consider the following example:

Contents of IN1 (Only the employee numbers, for example)

11111
11111
22222
33333
44444
44444

Contents of IN2 (Only the employee numbers, for example)

11111
44444
33333
55555


Now in the output file do u want the following records:

11111
33333
44444
(The job which kris gave u will fetch u the above results)

Or do u want the following records:

33333
(only the matching records that dont have dups in file A)

P.S: Please be clear in your requirement coz u didnt mention about this condition anywhere in the beginning. You have just said "The requirement is to compare both the files and get the records with common employee number(If the employee number is present in both the files). " Also use code tags for clarity.
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
nagarajan.dharani
Beginner


Joined: 04 Apr 2007
Posts: 20
Topics: 4

PostPosted: Wed Oct 24, 2007 4:45 am    Post subject: Reply with quote

Hi Vivek,

Following are the input file values and the output that i need.

Contents of IN1 (Only the employee numbers, for example)

11111
11111
22222
33333
44444
44444
66666
66666


Contents of IN2 (Only the employee numbers, for example)

11111
44444
33333
55555


Now in the output that i need is
11111
11111
44444
44444
33333


But the code that kris gave will give the output as following

11111
11111
44444
44444
33333
66666
66666

Since we have given ALLDUPS the 66666 in the IN1 which is a duplicate in IN1
is in output. I should not have 66666 in the output.

Basically i want all the records in IN1 if the employee number is present in IN2 without the duplicates removed.

Here 66666 is not present in IN2.

Thanks,
Dharani
Back to top
View user's profile Send private message Send e-mail
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Wed Oct 24, 2007 4:58 am    Post subject: Reply with quote

nagarajan.dharani
vivek1983 is right, my ICETOOL JCL behaves as per the example shown by vivek1983.

Quote:

But this also gives me records that are duplicates in my IN1 which i do not need.
I need only need records that have a match in the IN2 file.


Better you show us a sample set of input and output records, explaining the scenarios.
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
nagarajan.dharani
Beginner


Joined: 04 Apr 2007
Posts: 20
Topics: 4

PostPosted: Wed Oct 24, 2007 5:03 am    Post subject: Reply with quote

Hi Kris,

I've posted my sample values already.

Thanks,
Dharani
Back to top
View user's profile Send private message Send e-mail
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Wed Oct 24, 2007 7:09 am    Post subject: Reply with quote

For the example that you have shown, this code should work:
Code:
//*******************************************************               
//STEP001  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
11111                                                                   
11111                                                                   
22222                                                                   
33333                                                                   
44444                                                                   
44444                                                                   
66666                                                                   
66666                                                                   
/*                                                                     
//IN2      DD *                                                         
11111                                                                   
44444                                                                   
33333                                                                   
55555                                                                   
/*                                                                     
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//OUT      DD SYSOUT=*     
//TOOLIN   DD *                                                         
 COPY FROM(IN2)  TO(TMP1) USING(CP02)                                   
 COPY FROM(IN1)  TO(TMP1) USING(CP01)                                   
 SPLICE FROM(TMP1) TO(OUT) ON(1,10,CH) WITH(13,1) -                     
        WITHALL             USING(CP03) KEEPNODUPS                     
/*                                                                     
//CP01CNTL DD   *                                                       
  OUTREC BUILD=(1,10,12:C'11')                                         
/*                                                                     
//CP02CNTL DD   *                                                       
  OUTREC BUILD=(1,10,12:C'22')                                         
/*                                                                     
//CP03CNTL DD   *                                                       
  OUTFIL FNAMES=OUT,INCLUDE=(12,2,CH,EQ,C'21'),BUILD=(1,10)             
/*                                                                     
                                           

OUT Contains
Code:
11111   
11111   
33333   
44444   
44444   

The OUT is not the exact order as in the i/p, it will be in sorted order.
Let me know if you need it in the original i/p order.
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
nagarajan.dharani
Beginner


Joined: 04 Apr 2007
Posts: 20
Topics: 4

PostPosted: Wed Oct 24, 2007 8:02 am    Post subject: Reply with quote

Hi Kris,,

Thanks a lot for your code.

If my input files are as the following and the employee number is in binary format

Contents of IN1 (Employee numbers with their names, for example)

11111 zzzzzzz
11111 aaaaaa
22222 ccccccc
33333 dddddd
44444 eeeeee
44444 ffffff
66666 hhhhhh
66666 kkkkkk


Contents of IN2 (Only the employee numbers, for example)

11111
44444
33333
55555

My output should be as with the employee number in the binary format

11111 zzzzzzz
11111 aaaaaa
44444 eeeeee
44444 ffffff
33333 dddddd


Thanks again for your great help and trying to get some more help from you all as i have more requirements.


Thanks,
Dharani
Back to top
View user's profile Send private message Send e-mail
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Wed Oct 24, 2007 8:53 am    Post subject: Reply with quote

nagarajan.dharani

Quote:
If my input files are as the following and the employee number is in binary format

Considering the employee numbers are in binary format in both the file's in the position 1-4.
Code:
//*******************************************************               
//STEP001  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD FILE1                                                     
//IN2      DD FILE2                                                     
//OUT      DD O/P FILE, LRECL=223                                       
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//TOOLIN   DD *                                                         
  COPY FROM(IN2) TO(TMP1) USING(CP02)                                   
  COPY FROM(IN1) TO(TMP1) USING(CP01)                                   
  SPLICE FROM(TMP1) TO(OUT) ON(1,4,BI) WITH(13,1) -                     
        WITHALL             USING(CP03) KEEPNODUPS                     
/*                                                                     
//CP01CNTL DD *                                                         
  OUTREC OVERLAY=(224:C'11')                                           
//*                                                                     
//CP02CNTL DD *                                                         
  OUTREC OVERLAY=(224:C'22')                                           
//*                                                                     
//CP03CNTL DD *                                                         
  OUTFIL INCLUDE=(224,2,CH,EQ,C'21'),BUILD=(1,223)                     
//*                                                                     

_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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