IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Display mismatching fields using SORT/ICETOOL utility


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 11, 2009 12:18 pm
Reply with quote

Hi,

I need to compare two files to create an output file with mismatching fields.

Assume Emp No is the key field.

Output file should contain the key field and mismatching fields.



File1

Emp No Name IBU Proj Code

45832 Yogananda IHLD CISEDS

65123 Rajesh BCMD BOFA

116216 Rohan EUSD BCHN




File2

Emp No Name IBU Proj Code

45832 Yogananda IHLD CISEDS

65123 Rajesh BCMD BOFA

116216 Rohan EUSD SDFV



Output

116216 BCHN SDFV.

How can it be implemented using SORT/ICETOOL utility?


Thanks,
Marina.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Sep 11, 2009 12:42 pm
Reply with quote

OK, the usual questions.

The RECFM & LRECL of both files.
The key position(s), length(s) and format(s) of both files.
Are there duplicate key values in either of the files.
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 11, 2009 1:56 pm
Reply with quote

Hi,

RECFM - Sequential file (PS)

It can be VB or FB file.
If input file is FB then it needs to be changed to VB for comparison.
And the record length will also be dynamic. So we need to consider maximum record length.
These depend on the input files which we give and that keeps changing.

Key position, key length also need to be assumed.
In the above scenario assume the key is in 1st position and having key-length 5.

If you could provide a sample script for above requirement it would be helpful?
There will not be any duplicate key values.

Thanks,
Marina.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Sep 11, 2009 3:44 pm
Reply with quote

do not post the same topic in two different forums please
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Fri Sep 11, 2009 3:53 pm
Reply with quote

If a sample script is all that you need, the following might help you,

Assuming the key to be available in the position 1 to 5. And the field which has to be checked if it is updated is available in the position 9 to 12.

Code:
//ICETOOL0 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN1      DD *                                                 
13414AAA1123                                                   
23434BBB3432                                                   
32432CCC3242                                                   
45654DDD5463                                                   
54674EEE3423                                                   
//IN2      DD *                                                 
13414AAA1123                                                   
23434BBB4342                                                   
32432CCC3242                                                   
45654DDD5463                                                   
54674EEE4234                                                   
//OUTPUT   DD SYSOUT=*                                         
//T1       DD DSN=&&T1,DISP=(,PASS),UNIT=TMPDA,SPACE=(TRK,(5,5))
//T2       DD DSN=&&T2,DISP=(,PASS),UNIT=TMPDA,SPACE=(TRK,(5,5))
//CONCT    DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,DELETE)           
//         DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,DELETE)           
//TOOLIN   DD *                                                     
   COPY FROM(IN1) USING(CTL1)                                       
   COPY FROM(IN2) USING(CTL2)                                       
   SPLICE FROM(CONCT) TO(OUTPUT) USING(CTL3) ON(1,9,CH) WITH(14,1) -
   KEEPNODUPS                                                       
//CTL1CNTL DD *                                                     
  OUTFIL FNAMES=T1,BUILD=(1,5,9,4,6,3,C'11')                       
//CTL2CNTL DD *                                                     
  OUTFIL FNAMES=T2,BUILD=(1,5,9,4,6,3,C'22')                       
//CTL3CNTL DD *                                                     
  OUTFIL FNAMES=OUTPUT,INCLUDE=(13,2,ZD,EQ,22),BUILD=(1,5,10,3,6,4)
/*                                                                 




My output was :
Code:

23434BBB4342
54674EEE4234
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Sep 11, 2009 4:20 pm
Reply with quote

Am I correct in thinking that you wish to compare the whole record based on key value.
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 11, 2009 4:25 pm
Reply with quote

Hi Rockish,

Thanks for the sample script.
But the requirement is slightly different . If you loook at the original post there are some fields in the records which needs to be omitted.



Output

116216 BCHN SDFV.


For the above output only the non-matching project codes are displayed along with the key.
Since the employee name and IBU fields are matching we need to delete that.

How do we omit the matching fields?
One more requirement is only key position will be know to me.
The position of the non-matching fields will be unknown.
The non-matching fields need to be retrieved when key is given as input.

Thanks,
Marina.
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 11, 2009 4:28 pm
Reply with quote

Yes expat,

Absolutely right.
The non-matching fields need to be retrieved when key is given as input.
Only the key position and key length is known.
And i need to omit the matching fields.

Thanks,
Marina.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Sep 11, 2009 4:35 pm
Reply with quote

Quote:
Only the key position and key length is known.

and... just curious how are other processes dealing with such unknown entities icon_eek.gif

Quote:
The position of the non-matching fields will be unknown.


maybe the position of the fields to be matched is not known...
as a char offset/position, but at least at least is the
<word> ( sequence of non blank chars separated by a properly defined separator)
position known
using the above concept the string/word to be matched
Quote:
116216 Rohan EUSD BCHN
would be the 3rd word after the key BCHN

how many records in the files ??
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Fri Sep 11, 2009 4:37 pm
Reply with quote

Oops.. After reading EXPAT's reply and the first post, now i feel like, for every matching keys, field by field comparison is required and the required output should have both the old and new values for the changed fields..

I think its better if Marina can clarify more about fields to be matched..
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Fri Sep 11, 2009 4:39 pm
Reply with quote

OMG.. By the time i fixed my internet problem and posted my reply, three new replies already !!! Sorry for the out of sync post icon_neutral.gif
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 11, 2009 4:42 pm
Reply with quote

All fields need to be compared baesd on the key field.
Key fields will be same in both the files. (For the time being forget about inserted and deleted records).

Compare all the fields based on the key and retrieve only the non-matching fields(not the entire non-matching record).
The matching fields should not get displayed.

As i mentioned before file format (FB or VB) and LRECL are all dynamic.
These depend on the user.

I hope this clarifies.

Thanks,
Marina.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Sep 11, 2009 4:44 pm
Reply with quote

Quote:
I hope this clarifies.

NO
please answer what I asked in my previous post
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 11, 2009 4:47 pm
Reply with quote

I am sorry,
But i dont get your question?

Could you please elaborate the same?
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Fri Sep 11, 2009 5:00 pm
Reply with quote

Now let me summarise what I have understood !!!

There are two input files with unique keys. Apart from the key, the length of the remaining fields in both the files are unknown. (Hence the LRECL of the file is unknown as well).
Now the requirement is to match the records with the same key from both files and display all the fields that have unmatched values.
I have to agree that, this is beyond my capability as of now. So I am going to turn into a silent observer for this post from now on and let the experts do the rest of talking.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Sep 11, 2009 5:06 pm
Reply with quote

ok let' s put the question in a different way...
you talk about a key and we came up with...
the key position 1 length 5 ( the sample record key is 6 but let' s forget abou it )

the you talk about fileds, by visual inspection can be evinced that for the record I used as a sample
the fields are Rohan, EUSD, BCHN

but in IT the subroutine/class parse_based_on_visual_inspection is not yet available
( rumors tell that it will be available on the second release of OS/VU )

so please,please define an algorithm by which we can extract fields

my previous post proposed one...
field = sequence of chars separated by blanks
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 11, 2009 5:06 pm
Reply with quote

It can be done only using COBOL.

As you do not know the position of the non-matching fields.

So you will have to search with the key.

Once you find a matching record with same key in the 2nd file, compare byte by byte the rest of the data.

When you find a non-matching field retrieve using the COPYBOOK.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Sep 11, 2009 5:12 pm
Reply with quote

the issue is shifting towards pure sillyness

Quote:
It can be done only using COBOL.

what algorithm logic are You going to use to identify each field

if You told that we might give better answers
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 11, 2009 5:15 pm
Reply with quote

I am thinking,
If u have any suggestions please do so.

Thanks,
Marina.
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 11, 2009 5:18 pm
Reply with quote

I was on the right track initially, was thinking of doing it in COBOL.
Then somebody suggested DFSORT/ICETOOL utility.
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Fri Sep 11, 2009 5:20 pm
Reply with quote

If you dont know the algorithm by which you are going to separate fields from each other, not just COBOL, nothing can help u..

All that Enrico tries to ask from you is, what seperates the fields ? When do you say that a field has ended and the next field has started ?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Sep 11, 2009 5:20 pm
Reply with quote

any reason that You do not want to answer that simple question

what is the logic to separate fields ?

I proposed one, ( word concept ) is it the right approach ?
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 11, 2009 6:06 pm
Reply with quote

The delimiter is a comma, and i need to know how to retrieve the position of the mismatching byte.
That byte at the varying positon needs to be compared with the copybook positon in order to retrieve the exact field.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Sep 11, 2009 7:24 pm
Reply with quote

Hello,

Quote:
I have to agree that, this is beyond my capability as of now.
Yours, and everyone else. . . icon_wink.gif Unless they are very lucky (or happen to be psychic).

Quote:
Key fields will be same in both the files. (For the time being forget about inserted and deleted records).
No. The complete requirement including proper sample input and output should be posted. Why should people waste time providing multiple solutions for scope creep. Often, the additional requirement definition causes the original working solution to need changes (or be completely re-written) - wasting more time.

The sample data should be posted using the "Code" tag to preserve alignment and improve readability.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Sep 12, 2009 3:32 am
Reply with quote

Quote:
The delimiter is a comma, and i need to know how to retrieve the position of the mismatching byte.
That byte at the varying positon needs to be compared with the copybook positon in order to retrieve the exact field.


why suddenly a change inn the whole environment description...
You start showing blank delimited <fields>, now You go dow a completely different path of utterly darkness

do You realize that You made people lose time on your unwillingness to post a proper description of Your problem/requirement from the beginning

and You did not even care to answer the qustions You were asked..

since You are asking for help, You should not post what You think,
but what people trying to help You want to know, which means reply to thyr question icon_evil.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts REASON 00D70014 in load utility DB2 6
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top