two files matching with icetool



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

two files matching with icetool

Postby taeufer » Wed Oct 07, 2009 7:05 pm

Hello all, final accusing my English is not so good!

I have the following problem

IN1 (with only old key in colums 1-4)
AAAA
AAAA
BBBB
CCCC

IN2 (with two keys, old in colums 1-4 and new in colums 6-9)
AAAA 1111
CCCC 3333

OUT
1111 AAAA
1111 AAAA
BBBB BBBB
CCCC 3333

OUT all from IN1
- new-key (IN2) old-key (IN1) - the old key is present in IN1 and IN2 or
- old-key (IN1) old-key (IN1) - the old key is only in IN1

Please let me know if we can write an ICETOOL for this

Thanks in advance
Joachim
taeufer
 
Posts: 5
Joined: Wed Oct 07, 2009 6:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: two files matching with icetool

 

Re: two files matching with icetool

Postby Frank Yaeger » Wed Oct 07, 2009 8:23 pm

Shouldn't the fourth output record be

3333 CCCC

If not, why not?

What is the RECFM and LRECL of each input file?

Can IN2 have duplicate records? If so, show an example of input and output for that.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: two files matching with icetool

Postby taeufer » Thu Oct 08, 2009 1:00 pm

Hi Frank
my error, to adjust the fourth output record

3333 CCCC

IN1 (FB 692) - have dublicate records, old-key on colums 104-107
IN2 (FB 200) - have not dublicate records, old key on colums 1-4, new-key an colums 7-10

OUT (FB 696)
new-key from IN2 and all data from IN1 when the old key is present in IN1 and IN2 or
old-key from IN1 and all data from IN1 when the old key is only in IN1

thanks Joachim
taeufer
 
Posts: 5
Joined: Wed Oct 07, 2009 6:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: two files matching with icetool

Postby Frank Yaeger » Thu Oct 08, 2009 9:59 pm

You can use a DFSORT/ICETOOL job like the following to do what you asked for. You didn't say where you wanted the new key and old key in the OUT file, so I assumed you wanted the new key in 1-4 and the old key in 6-9. Adjust as needed.

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/692)
//IN2 DD DSN=...  input file2 (FB/200)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/696)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(6,4,CH) KEEPNODUPS WITHALL -
  WITH(6,4) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1:7,4,6:1,4)
/*
//CTL2CNTL DD *
  INREC BUILD=(6:104,4)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,IFOUTLEN=696,
    IFTHEN=(WHEN=(1,4,CH,EQ,C' '),OVERLAY=(1:6,4))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: two files matching with icetool

Postby taeufer » Sun Oct 11, 2009 3:28 pm

Hi Frank, we did not understand ourselves
Other example
//S1   EXEC  PGM=ICETOOL                                               
//TOOLMSG   DD  SYSOUT=*                                             
//DFSMSG    DD  SYSOUT=*                                           
//IN1       DD *
*IN1 have duplicate records (FB/15)
*Columns 1-9 old-key (match key), 11-15 text)                                               
OLD-KEY-1 TEXT1
OLD-KEY-2 TEXT2                                                         
OLD-KEY-2 TEXT2
OLD-KEY-3 TEXT3
/*                                                                 
//IN2       DD *
*IN2 have not duplicate records (FB/26)
*Columns 1-9 old-key (match key), 11-19 new key, 21-26 Date (year and calendar week)
OLD-KEY-1 NEW-KEY-A 200910
OLD-KEY-2 NEW-KEY-B 201004
/*                                                                     
//T1       DD  DSN=USER.TMP1,                                 
//             DISP=(MOD,CATLG),                                       
//             UNIT=ASPOOL,SPACE=(27900,(500,50),RLSE)       
//OUT      DD  DSN=USER.OUT,                                 
//             DISP=(,CATLG,DELETE),                                   
//             DCB=(RECFM=FB,LRECL=32,DSORG=PS),                     
//             UNIT=ASPOOL,SPACE=(27900,(500,50),RLSE)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,9,CH) KEEPNODUPS WITHALL -
 WITH(11,9) WITH(21,6) USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(1:1,26,27:6X)
/*
//CTL2CNTL DD *
  INREC BUILD=(1:1,9,10:18X,28:11,5)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,
   IFTHEN=(WHEN=(11,9,CH,EQ,C' '),OVERLAY=(1:1,9))
/* 

the splice command is not correct ?? T1 and OUT should be like that
T1:
OLD-KEY-1 NEW-KEY-A 200910     
OLD-KEY-2 NEW-KEY-B 201004     
OLD-KEY-1                  TEXT1
OLD-KEY-2                  TEXT2
OLD-KEY-2                  TEXT2
OLD-KEY-3                  TEXT3

OUT:
OLD-KEY-1 NEW-KEY-A 200910 TEXT1
OLD-KEY-2 NEW-KEY-A 201004 TEXT2
OLD-KEY-2 NEW-KEY-A 201004 TEXT2
OLD-KEY-3 OLD-KEY-3        TEXT3 

Thanks in advance
Joachim
taeufer
 
Posts: 5
Joined: Wed Oct 07, 2009 6:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: two files matching with icetool

Postby taeufer » Sun Oct 11, 2009 4:06 pm

Mey error for OUT
OUT:
OLD-KEY-1 NEW-KEY-A 200910 TEXT1
OLD-KEY-2 NEW-KEY-B 201004 TEXT2
OLD-KEY-2 NEW-KEY-B 201004 TEXT2
OLD-KEY-3 OLD-KEY-3        TEXT3
taeufer
 
Posts: 5
Joined: Wed Oct 07, 2009 6:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: two files matching with icetool

Postby taeufer » Tue Oct 13, 2009 12:03 pm

:) Solution
//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1       DD *
OLD-KEY-1 TEXT1
OLD-KEY-2 TEXT2
OLD-KEY-2 TEXT2
OLD-KEY-3 TEXT3
OLD-KEY-4 TEXT4
OLD-KEY-5 TEXT5
/*
//IN2       DD *
OLD-KEY-1 NEW-KEY-A 200910
OLD-KEY-2 NEW-KEY-B 201004
OLD-KEY-3 NEW-KEY-C 201006
OLD-KEY-4 NEW-KEY-D
OLD-KEY-6 NEW-KEY-F
/*
//T1       DD  DSN=USER.TMP1,
//             DISP=(MOD,CATLG),
//             UNIT=ASPOOL,SPACE=(27900,(500,50),RLSE)
//T2       DD  DSN=USER.TMP2,
//             DISP=(MOD,CATLG),
//             UNIT=ASPOOL,SPACE=(27900,(500,50),RLSE)
//OUT      DD  DSN=USER.OUT,
//             DISP=(,CATLG,DELETE),
//             DCB=(RECFM=FB,LRECL=32,DSORG=PS),
//             UNIT=ASPOOL,SPACE=(27900,(500,50),RLSE)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(1,9,CH) KEEPNODUPS WITHALL -
   WITH(28,5) WITH(33,1) USING(CTL3)
COPY FROM(T2) TO(OUT) USING(CTL4)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(1:1,26,27:6X,33:C'BB')
/*
//CTL2CNTL DD *
  INREC BUILD=(1:1,9,10:18X,28:11,5,33:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=T2,
   IFTHEN=(WHEN=(11,9,CH,EQ,C' '),OVERLAY=(11:1,9))
/*                                                 
//CTL4CNTL DD *                                   
  OMIT COND=(33,1,CH,NE,C'V')                     
  OUTFIL FNAMES=OUT,BUILD=(1,32)                   
/*                             

Many thanks and greeting from Germany
Joachim
taeufer
 
Posts: 5
Joined: Wed Oct 07, 2009 6:57 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post