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

Combining feilds from three files into one using ICETOOL


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

New User


Joined: 19 Apr 2006
Posts: 22
Location: bangalore

PostPosted: Tue Apr 17, 2007 4:14 pm
Reply with quote

Hi All,
I am trying to combine a feild which is present in three different files (not having same LRECL) into one file.My code is

Code:

//STEP01   EXEC PGM=ICETOOL,                     
//TOOLMSG  DD  SYSOUT=*                                       
//DFSMSG    DD  SYSOUT=*                                       
//INFIL1       DD  DSN=FILE1,DISP=SHR               
//INFIL2       DD  DSN=FILE2,DISP=SHR
//INFIL3       DD  DSN=FILE3,DISP=SHR
//TMP1         DD DSN=&&TMP,DISP=(MOD,PASS),
//                      SPACE=(CYL,(10,10)),       
//                      UNIT=SYSDA                                       
//OUTFIL      DD DSN=FILE4,                       
//                UNIT=(SYSDA,10),DISP=(NEW,CATLG),               
//                SPACE=(CYL,(10,5),RLSE)
//TOOLIN     DD *                                               
    COPY FROM(INFIL1) TO(TMP1) USING(CTL1)                     
    COPY FROM(INFIL2) TO(TMP1) USING(CTL2)                     
    COPY FROM(INFIL3) TO(TMP1) USING(CTL3)                     
    SPLICE FROM(TMP1) TO(OUTFIL) ON(1,12,ZD) WITH(13,5)       
/*   
//CTL1CNTL DD  *
      OUTREC  FIELDS= (1:5197,7,PD,TO=ZD,LENGTH=12) 
/*
//CTL2CNTL  DD  *
    OUTREC  FIELDS= (14:159,6,PD,TO=ZD,LENGTH=12)
/*
//CTL3CNTL  DD *
   OUTREC FEILDS =(27:3,6,PD,TO=ZD,LENGTH=12)
/*
//   


The feild(Emp no) which I am trying to combine is common in the three input files .
The Input and output looks like

Feild in File1 :
111222333444
111333222444
222111333444
222333111444

Feild in File2:
111333222444
222111333444
222333111444
333111222444

Feild in File3:
222111333444
222333111444
333111222444
444111222333

The output I am getting is

111333222444111333222444
222111333444222111333444

But the expected outputs is

111222333444 111333222444 222111333444
111333222444 222111333444 222333111444
222111333444 222333111444 333111222444
222333111444 333111222444 444111222333

Please let me know where I am going wrong ? Thanks
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Apr 17, 2007 4:19 pm
Reply with quote

I think you may have to do it in two goes, SPLICE IN1 & IN2 to give OUT1, and then SPLICE IN3 with OUT1.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Apr 17, 2007 4:32 pm
Reply with quote

junaid83,

You need to use WITHALL option followed by 2 with options like

Code:
SPLICE FROM(TMP1) TO(OUTFIL) ON(1,12,ZD)
WITHALL WITH(13,5) WITH(27,5)


Note: Please change WITH(27,5) according to your third record position
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: Tue Apr 17, 2007 11:02 pm
Reply with quote

k.junaid83,

I don't see how you could have gotten the output you show with the job you show.

It appears you want to splice the fields record-by-record. In order to do that, you need to add a sequence number to each record and use SPLICE with WITHEACH. Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//STEP01   EXEC PGM=ICETOOL,
//TOOLMSG DD  SYSOUT=*
//DFSMSG  DD  SYSOUT=*
//INFIL1  DD  DSN=FILE1,DISP=SHR
//INFIL2  DD  DSN=FILE2,DISP=SHR
//INFIL3  DD  DSN=FILE3,DISP=SHR
//TMP1    DD DSN=&&TMP,DISP=(MOD,PASS),
//           SPACE=(CYL,(10,10)),
//           UNIT=SYSDA
//OUT  DD DSN=FILE4,
//        UNIT=(SYSDA,10),DISP=(NEW,CATLG),
//        SPACE=(CYL,(10,5),RLSE)
//TOOLIN     DD *
COPY FROM(INFIL1) TO(TMP1) USING(CTL1)
COPY FROM(INFIL2) TO(TMP1) USING(CTL2)
COPY FROM(INFIL3) TO(TMP1) USING(CTL3)
SPLICE FROM(TMP1) TO(OUTFIL) ON(1,12,ZD) WITH(13,5) -
  USING(CTL4)
/*
//CTL1CNTL DD  *
  OUTREC FIELDS=(1:5197,7,PD,TO=ZD,LENGTH=12)
/*
//CTL2CNTL  DD  *
    OUTREC FIELDS=(14:159,6,PD,TO=ZD,LENGTH=12)
/*
//CTL3CNTL  DD *
   OUTREC FEILDS=(27:3,6,PD,TO=ZD,LENGTH=12)
/*
//CTL4CNTL  DD *
  OUTFIL FNAMES=OUT,BUILD=(1,38)
/*
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Wed Apr 18, 2007 11:19 pm
Reply with quote

Hi Frank,
Pls Can u explain TO=ZD,LENGTH=12 in
OUTREC FIELDS=(14:159,6,PD,TO=ZD,LENGTH=12)?

Thanks
Aneeta
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: Wed Apr 18, 2007 11:55 pm
Reply with quote

Code:

14:159,6,PD,TO=ZD,LENGTH=12


converts the 6-byte PD value starting at input position 159 to a 12-byte ZD value starting at output position 14.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

Use [URL] BBCode for External Links
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 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 Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top