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

Icetool to splice data from 2 files


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

New User


Joined: 05 Oct 2005
Posts: 94

PostPosted: Thu Jul 12, 2007 9:24 am
Reply with quote

Code:

//VBUSPLIT EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN1      DD DSN=VAST.TTRAN.F1,
//            DISP=SHR                                         
//T1       DD DSN=VAST.US.T1,                   
//            DISP=(MOD,CATLG,DELETE),           
//            SPACE=(TRK,(1,50)),
//            UNIT=SYSDA                         
//TOOLIN   DD *                                                   
SELECT FROM(IN1) TO(T1)  ON(37,9,ZD) ON(46,4,ZD) FIRST USING(CTL1)
 /*                                                 
 //CTL1CNTL DD *                                     
    OUTFIL FNAMES=T1,                               
    OUTREC=(2X,3:37,9,181X,193:48,2,6X)             
    INCLUDE COND=(1,2,CH,EQ,C'A ',AND,602,2,BI,EQ,1)
    SUM FIELDS=NONE                                 
 /*                                               

This is a part of the JCl being used to obtain a the first temporary dataset for splicing.
I want to confirm out whether the following mentioned steps are the exact manner in which DFSORT would produce the o/p. I have run the step and getting the correct o/p but would like to finalise it wont be failing in any condition

Functioning details
1) The include condition will be executed first and all the i/p records in IN1 satisfying the criteria will go to temp dataset.
2) The outrec step will executed next and only the mentioned fields will be populated.
3) The sorting will take place next and since I'm using first, only the first duplicate record is being selected and finally written to the T1.
I feel the Sum fields= None is not required in this case but added it for extra check.The actual requirement is to get only the first duplicate record.

All the suggestions are highly appreciated.

Thanks,
Nikhil S.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Jul 12, 2007 3:05 pm
Reply with quote

nikyojin
Quote:
I feel the Sum fields= None is not required
Yes, its not required.

Quote:
3) The sorting will take place next and since I'm using first, only the first duplicate record is being selected and finally written to the T1.

To confirm what you want exactly, check these definition's:
Quote:
FIRST - keep only the first record for each value (that is, records with non-duplicate values, and the first record for duplicate values)
FIRSTDUP - only keep the first record for duplicate values
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Jul 12, 2007 8:48 pm
Reply with quote

The order of processing is as follows:

The INCLUDE statement is processed before SELECT.

SELECT will sort on the key value (ON fields) - FIRST will keep the first record with each key value (ON fields).

SUM will be processed next but since SELECT has already removed the duplicates, SUM won't have any effect.

OUTFIL will be processed next and will reformat the selected records.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Jul 13, 2007 9:54 am
Reply with quote

Frank
I have an doubt on the order of processing that you have mentioned,
I felt like SUM FIELDS=NONE is done before the FIRST.

Because when we mention FIRSTDUP in the place of FIRST , i did not not get any records in the o/p, that is SUM fields=none is removing the duplicates and because of this FIRSTDUP is not able to extract any record to the o/p.

The code i tried is here
Code:
//GETMATCH EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
121212                                                                 
121213                                                                 
121214                                                                 
131313                                                                 
/*                                                                     
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
    SELECT FROM(IN1) TO(OUT)  ON(1,2,ZD) FIRSTDUP USING(CTL1)           
/*                                                                     
//CTL1CNTL DD *                                                         
    OUTFIL FNAMES=OUT,                                                 
    OUTREC=(2X,1,6)                                                     
    INCLUDE COND=(1,2,CH,EQ,C'12')                                     
    SUM FIELDS=NONE                                                     
/*                                                                     

The O/p OUT is empty.
The same Card with FIRST in the place of FIRSTDUP gives
Code:
  121212

Please help me in understanding the flow! icon_question.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri Jul 13, 2007 8:25 pm
Reply with quote

Technically, you're right. There's a lot of interaction between ICETOOL and DFSORT, but the actual "FIRST" processing is done with an E35 which is processed after SUM. (I've been sick all week and not thinking too clearly at times.)

But the main point here is that SUM should NOT be used with SELECT since it either isn't needed or can interfere with SELECT's processing.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Jul 13, 2007 8:46 pm
Reply with quote

Thanks for clarification Frank
Back to top
View user's profile Send private message
nikyojin

New User


Joined: 05 Oct 2005
Posts: 94

PostPosted: Sun Jul 15, 2007 10:50 am
Reply with quote

Thanks Krisprems and Frank for all your valuable suggestions. I have been able to get the desired output.
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

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
Search our Forums:

Back to Top