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 

Merge using ICETOOL

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


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Thu Apr 02, 2009 5:13 am    Post subject: Merge using ICETOOL Reply with quote

My requirement is that i have 2 files file1 and file2. i want to do some formatting on both file1 and file2 and then merge both of them. Is it possible in a single step using ICETOOL

Code:
//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN1          DD DSN=FILE1,DISP=SHR       
//IN2          DD DSN=FILE2,DISP=SHR       
//T1           DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//T2           DD DSN=&&T2,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT          DD DSN=OUTFILE,DISP=OLD
//TOOLIN   DD *                                             
  COPY FROM(IN1) USING(CTL1)                                 
  COPY FROM(IN2) USING(CTL2)                                 
//CTL1CNTL DD *                                             
  OUTFIL FNAMES=T1,OVERLAY=(10:1,1,C'D')                     
//CTL2CNTL DD *                                             
  OUTFIL FNAMES=T2,OVERLAY=(10:1,1,C'C')                     
//*

Now after executing this i would want to merge T1 and T2 and obtain an output in OUTFILE. i checked the ICETOOL documentation in http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICECA109/6.0?DT=20020722140254 but am not able to find a keyword for MERGE.
Is it possible to obtain a single step solution using either DFSORT/ICETOOL

eg. If i have file1 as
1111111111
2222222222
3333333333

and file2 as
4444444444
5555555555
6666666666

i would want an output as
111111111D
222222222D
333333333D
444444444C
555555555C
666666666C
_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
edkir98
Beginner


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Thu Apr 02, 2009 7:03 am    Post subject: Reply with quote

Sorry.. found an answer by myself..
but just wanted to know if there is a better way to write this..

i'm getting two files file1 and file2 from each system SYSTEMA and SYSTEMB.
there are 2 requirements
1) i want to format the FILE1 from SYSTEMA and concatenate with FILE1 from SYSTEMB
2) i want to concatenate FILE2 from both the SYSTEMS and remove duplicates.

i wrote the JCL but just wanted to know if there is a way to write this without using the TEMP files.

Code:
//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN1      DD DSN=SYSTEMA.FILE1,DISP=SHR         
//IN2      DD DSN=SYSTEMB.FILE1,DISP=SHR         
//IN3      DD DSN=SYSTEMA.FILE2,DISP=SHR         
//IN4      DD DSN=SYSTEMB.FILE2,DISP=SHR         
//TMP1     DD DSN=&&TMP1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//TMP2     DD DSN=&&TMP2,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT1     DD DSN=FILE1.TOTAL.OUTPUT,             
//         DISP=(NEW,CATLG,DELETE),                           
//         SPACE=(CYL,(10,10),RLSE),                           
//         DCB=(RECFM=FB,LRECL=140)                           
//OUT2     DD DSN=FILE2.TOTAL.OUTPUT,             
//         DISP=(NEW,CATLG,DELETE),                           
//         SPACE=(CYL,(10,10),RLSE),                           
//         DCB=(RECFM=FB,LRECL=52)                             
//TOOLIN   DD *                                               
  COPY   FROM(IN1)  TO(TMP1) USING(CTL1)                       
  COPY   FROM(IN2)  TO(TMP1)                                   
  COPY   FROM(TMP1) TO(OUT1)                                   
  COPY   FROM(IN3)  TO(TMP2)                                   
  COPY   FROM(IN4)  TO(TMP2)                                   
  SELECT FROM(TMP2) TO(OUT2) ON(20,7,CH) FIRST                 
//CTL1CNTL DD *                                               
  OUTFIL FNAMES=TMP1,OVERLAY=(7:1,1,C'C')         

_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Apr 02, 2009 10:28 am    Post subject: Reply with quote

edkir98,

It can be simplified but I need more details. Is there anything in the files that identifies which system send it?

Code:

-----------------------------------------
SYSTEM |FILE   |LRECL |RECFM| IDENTIFIER|
-----------------------------------------
  A    |  1    | ???  | ??? | FILE1SYSA?|
  A    |  2    | ???  | ??? | FILE2SYSB?|
-----------------------------------------
  B    |  1    | ???  | ??? | FILE1SYSA?|
  B    |  2    | ???  | ??? | FILE2SYSB?|


Answer these questions and we will show you a way to do it
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
edkir98
Beginner


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Thu Apr 02, 2009 11:16 am    Post subject: Reply with quote

hi Kolusu,

no.. infact we are formating the FILE1 from SYSTEMA and overlaying the indicator in position 7 only to differentiate SYSTEMA AND SYSTEMB files.

For FILE2 we need not differentiate.. Only merging the files and removing the duplicates in positions 20,7 is enough.

Code:
-----------------------------------------
SYSTEM |FILE   |LRECL |RECFM| IDENTIFIER|
-----------------------------------------
  A    |  1    | 140  | FB | FILE1SYSA|
  A    |  2    | 052  | FB | FILE2SYSA|
-----------------------------------------
  B    |  1    | 140  | FB | FILE1SYSB|
  B    |  2    | 052  | FB | FILE2SYSB|


FILE1's record length in both systems is 140 (RECFM FB)
FILE2's record length in both systems is 52 (RECFM FB)

hope i made it clear...
_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Apr 02, 2009 12:12 pm    Post subject: Reply with quote

edkir98,

For 140 LRECL file You don't need temp datasets you can directly code disp=MOD on the final files itself

For 52 LRECL files just concatenate them together and remove the duplicates and directly write to output

The following DFSORT/ICETOOL JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL               
//TOOLMSG  DD SYSOUT=*                     
//DFSMSG   DD SYSOUT=*                     
//SYSA140  DD DSN=SYSTEMA.FILE1,DISP=SHR
//SYSB140  DD DSN=SYSTEMB.FILE1,DISP=SHR
//*
//SYSAB52  DD DSN=SYSTEMA.FILE2,DISP=SHR         
//         DD DSN=SYSTEMB.FILE2,DISP=SHR
//* 
//OUT1     DD DSN=SYSAB140.TOTAL.OUTPUT,               
//            DISP=(MOD,CATLG,CATLG),                         
//            UNIT=SYSDA,                                     
//            SPACE=(CYL,(10,10),RLSE)                       
//*
//OUT2     DD DSN=SYSAB52.NODUP.OUTPUT,               
//            DISP=(NEW,CATLG,CATLG),                         
//            UNIT=SYSDA,                                     
//            SPACE=(CYL,(10,10),RLSE)                       
//TOOLIN   DD *                                               
  COPY FROM(SYSA140) USING(CTL1)                             
  COPY FROM(SYSB140) TO(OUT1)                                 
  SELECT FROM(SYSAB52) TO(OUT2) ON(20,7,CH) FIRST
//CTL1CNTL DD *                                               
  OUTFIL FNAMES=OUT1,OVERLAY=(7:1,1,C'C')                     
//*


Since you coded DISP=MOD on the F140 file , it is a good idea to delete the file before every run . so code this step as the first step

Code:

//STEP0050 EXEC PGM=IEFBR14                     
//DELME    DD DSN=SYSAB140.TOTAL.OUTPUT,
//            DISP=(MOD,DELETE,DELETE),         
//            UNIT=SYSDA,                       
//            SPACE=(CYL,(10,10),RLSE)         
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
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