Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Difference records using ICETOOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
itzphaniz

New User


Joined: 02 Sep 2005
Posts: 39

PostPosted: Tue Nov 03, 2009 1:55 pm    Post subject: Difference records using ICETOOL
Reply with quote

I've two FB files with 80 record length.
IN1:
Code:
ABCDE
DTSSY
XYZAB
12345
23456


IN2:
Code:
ABCDZ
DTSSY
XYZAB
56789
23457


First 4 characters is the key. I need a output file with the records that got changed on the key. The changed records should be from IN1.

For above input files, the output should be:

Code:
ABCDE
23456


I'm using the below ICETOOL card, but it is giving me both the changed records from IN1 and IN2.


Toolin:
Code:
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL1)
SELECT FROM(T1) TO(T2) ON(1,80,CH) NODUPS USING(CTL5) 
COPY FROM(T3) TO(OUT2) USING(CTL1)                     


CTL1:
Code:
SORT FIELDS=COPY


CTL5:
Code:
OUTFIL FNAMES=T3,REMOVECC,NODETAIL,SECTIONS=(1,8,TRAILER3=(1,8))


But it is this output:

Code:
ABCDE
ABCDZ
12345
23456
23457
56789


Any suggestions on how to eliminate
1) Records IN1 not IN2
2) Records IN2 not IN1

Also the output should have only the changed records on the key from IN1. Any help or pointers would be deeply appreciated.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Nov 03, 2009 2:07 pm    Post subject:
Reply with quote

Well, you are most of the way there. You have eliminated all of the duplicated records of length 80, but now you may need a second pass of the data selecting only the first duplicate on the 4 byte key.

Probably not the most elegant or efficient way, but for a quick fix it should work. I am pretty sure that Frank or Kolusu will give a better solution a little later in the day.
Back to top
View user's profile Send private message
itzphaniz

New User


Joined: 02 Sep 2005
Posts: 39

PostPosted: Tue Nov 03, 2009 2:15 pm    Post subject:
Reply with quote

Well I just noticed a typo in my control cards, here are the actual control cards that I used. Sorry for the inconvenience

Toolin:
Code:
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL1)
SELECT FROM(T1) TO(T2) ON(1,4,CH) NODUPS USING(CTL5) 
COPY FROM(T2) TO(OUT2) USING(CTL1)                       


CTL1:
Code:
SORT FIELDS=COPY


CTL5:
Code:
OUTFIL FNAMES=T2,REMOVECC,NODETAIL,SECTIONS=(1,8,TRAILER3=(1,8))
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Nov 03, 2009 2:54 pm    Post subject:
Reply with quote

Well, based on your post, the data given and the required result, the code below worked for me.

The first select removes all duplicate records based on the file length of 80. So any unchanged records are deleted. This leaves the task of finding only records with the same key but a different data content.

The second select will pick only the first duplicate record of those that have an identical key value, but a different data content.
Code:

//ICETOOL  EXEC PGM=ICETOOL
//SYSOUT   DD SYSOUT=*     
//SYSPRINT DD SYSOUT=*     
//TOOLMSG  DD SYSOUT=*     
//DFSMSG   DD SYSOUT=*     
//IN1      DD *           
ABCDE                     
DTSSY                     
XYZAB                     
12345                     
23456                     
/*                         
//IN2      DD *           
ABCDZ                     
DTSSY                     
XYZAB                     
56789                     
23457                     
/*                         
//OUT1     DD DSN=&&TEMP01,DISP=(MOD,PASS,DELETE),   
//            RECFM=FB,LRECL=80,SPACE=(TRK,(5,5),RLSE)
//OUT2     DD DSN=&&TEMP02,DISP=(MOD,PASS,DELETE),   
//            RECFM=FB,LRECL=80,SPACE=(TRK,(5,5),RLSE)
//OUT3     DD SYSOUT=*                               
//TOOLIN   DD *                                       
 COPY FROM(IN1)      TO(OUT1)    USING(CTL1)         
 COPY FROM(IN2)      TO(OUT1)    USING(CTL1)         
 SELECT FROM(OUT1)   TO(OUT2)    ON(1,80,CH) NODUPS   
 SELECT FROM(OUT2)   TO(OUT3)    ON(1,4,CH)  FIRSTDUP
/*                                                   
//CTL1CNTL DD *                                       
  SORT FIELDS=COPY                                   
/*                                                   

The result
Code:

ABCDE                   
23456                   
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Tue Nov 03, 2009 3:03 pm    Post subject: Reply to: Difference records using ICETOOL
Reply with quote

OK... I' ll bite
why not simply concatenate the two files in the proper sequence ...
the content of the concatenation of the two input files is the same as the OUT1 content
Back to top
View user's profile Send private message
itzphaniz

New User


Joined: 02 Sep 2005
Posts: 39

PostPosted: Tue Nov 03, 2009 3:23 pm    Post subject:
Reply with quote

@Expat - This works just perfect. Thanks a lot!. I didn't know about FIRSTDUP. Thanks for letting me know! icon_smile.gif

@Enricho - icon_smile.gif icon_smile.gif - Yeah, you are right, content after concatenation is same as OUT1. I've modified the step accordingly!

Thanks a lot guys for your valuable time!
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Nov 03, 2009 3:36 pm    Post subject:
Reply with quote

Going on the comment from Enrico, a quick rethink of the process .......
But I am sure that Frank or Kolusu will improve on it
Code:

//ICETOOL  EXEC PGM=ICETOOL
//SYSOUT   DD SYSOUT=*     
//SYSPRINT DD SYSOUT=*     
//TOOLMSG  DD SYSOUT=*     
//DFSMSG   DD SYSOUT=*     
//IN1      DD *             
ABCDE                       
DTSSY                       
XYZAB                       
12345                       
23456                       
/*                         
//         DD *             
ABCDZ                       
DTSSY                       
XYZAB                       
56789                       
23457                       
//OUT1     DD DSN=&&TEMP01,DISP=(MOD,PASS,DELETE),   
//            RECFM=FB,LRECL=80,SPACE=(TRK,(5,5),RLSE)
//OUT2     DD SYSOUT=*                               
//TOOLIN   DD *                                       
 SORT FROM(IN1)      TO(OUT1)    USING(CTL1)         
 SELECT FROM(OUT1)   TO(OUT2)    ON(1,4,CH)  FIRSTDUP
/*                                                   
//CTL1CNTL DD *                                       
  SORT FIELDS=(1,80,CH,A),EQUALS                     
   SUM FIELDS=NONE                                   
/*     
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Nov 03, 2009 11:34 pm    Post subject:
Reply with quote

itzphaniz,

concatenate both files together and use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
ABCDE                                                               
DTSSY                                                               
XYZAB                                                               
12345                                                               
23456                                                               
//         DD *                                                     
ABCDZ                                                               
DTSSY                                                               
XYZAB                                                               
56789                                                               
23457                                                               
//SORTOUT  DD SYSOUT=*   
//SYSIN DD *
  SORT FIELDS=(1,4,CH,A),EQUALS
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,1,ZD,RESTART=(1,4))),
   IFTHEN=(WHEN=GROUP,BEGIN=(81,1,ZD,EQ,1),PUSH=(82:81,1,1,80))
  OUTFIL INCLUDE=(81,2,ZD,EQ,21,AND,1,5,CH,NE,83,5,CH),BUILD=(83,80)                                       
Back to top
View user's profile Send private message
itzphaniz

New User


Joined: 02 Sep 2005
Posts: 39

PostPosted: Wed Nov 04, 2009 6:50 pm    Post subject: Reply to: Difference records using ICETOOL
Reply with quote

Thanks a lot for the alternate way Kolusu! :-)
Back to top
View user's profile Send private message
itzphaniz

New User


Joined: 02 Sep 2005
Posts: 39

PostPosted: Tue Nov 24, 2009 5:03 pm    Post subject:
Reply with quote

Expat: A quick question to you on the toolin control card that you gave earlier

Code:
 //TOOLIN   DD *                                       
 COPY FROM(IN1)      TO(OUT1)    USING(CTL1)         
 COPY FROM(IN2)      TO(OUT1)    USING(CTL1)         
 SELECT FROM(OUT1)   TO(OUT2)    ON(1,80,CH) NODUPS   
 SELECT FROM(OUT2)   TO(OUT3)    ON(1,4,CH)  FIRSTDUP
/*                                                   
//CTL1CNTL DD *                                       
  SORT FIELDS=COPY                                   
/*                                                 


To be more precise in this part
Code:
 SELECT FROM(OUT1)   TO(OUT2)    ON(1,80,CH) NODUPS 


Here the file is 80 and assumed all are character fields. For ex: if the length of input file was 1000 and had all types of variables such as PD, ZD, BI, C etc., Do I have to include all individual variables after "ON"

i.e. like below? Will it work? if not is there any easier way?

Code:
SELECT FROM(OUT1)   TO(OUT2)    ON(1,100,CH,101,100,PD,201,800,BI) NODUPS
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Nov 24, 2009 9:42 pm    Post subject:
Reply with quote

That is NOT the correct syntax for multiple ON fields. The correct syntax would be:

ON(p,m,f) ON(p,m,f) ON(p,m,f)

However, you cannot use a 100 byte PD field. The maximum length you can use for a PD field is 16 bytes = 31 digits. A 100 byte PD field would have 199 digits ... kind of ridiculous.

As to whether you'd need to break down the large field into smaller fields of different formats, that depends on whether or not each field is "normalized". For example, if your PD fields have a mixture of F, C and D signs, then you'd need to treat them as PD. If they all just had C signs, then you could treat them as BI.

Code:

//TOOLIN   DD *                                       
 COPY FROM(IN1)      TO(OUT1)    USING(CTL1)         
 COPY FROM(IN2)      TO(OUT1)    USING(CTL1)         
...
/*                                                   
//CTL1CNTL DD *                                       
  SORT FIELDS=COPY                                   
/*     


You DO NOT need CTL1CNTL ... a COPY operator automatically does a COPY operation. You don't have to tell it to do one with SORT FIELDS=COPY. You could write this as:

Code:

COPY FROM(IN1)  TO(OUT1)           
COPY FROM(IN2)  TO(OUT1)   


But using the concatenated data sets as input would eliminate the need for these COPY operators anyway.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Group elements using ICETOOL Learncoholic DFSORT/ICETOOL 2 Fri Apr 14, 2017 11:01 am
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us