Matching files with different length



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Re: Matching files with different length

Postby Frank Yaeger » Tue Feb 10, 2009 2:05 am

Here's a DFSORT/ICETOOL job for your new requirement:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/124)
//IN2 DD DSN=...  input file2 (FB/2)
//CTL2CNTL DD DSN=&&C2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//  DD *
  OUTFIL FNAMES=OUT2,SAVE
/*
//OUT1 DD DSN=...  output file1 (FB/124)
//OUT2 DD DSN=...  output file2 (FB/124)
//TOOLIN DD *
COPY FROM(IN2) USING(CTL1)
COPY FROM(IN1) USING(CTL2)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=CTL2CNTL,REMOVECC,
    HEADER1=(' OUTFIL FNAMES=OUT1,INCLUDE=(1,1,CH,NE,1,1,CH,OR,'),
    BUILD=(C'  17,2,CH,EQ,C''',1,2,C''',OR,',80:X),
    TRAILER1=('  1,1,CH,NE,1,1,CH)')
/*
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: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Matching files with different length

Postby pulcinella » Tue Feb 10, 2009 2:28 pm

Thank you frank for your help.

I would like to explain the following,

In your first example when you compare the position 31,1 with the position 1,1 you used:

//CTL1CNTL DD *
OUTFIL FNAMES=CTL2CNTL,REMOVECC,
HEADER1=(' INCLUDE FORMAT=CH,COND=(1,1,NE,1,1,OR,'),
BUILD=(C' 31,1,EQ,C''',1,1,C''',OR,',80:X),
TRAILER1=(' 1,1,NE,1,1)')
/*

When I want to compare the position 17,2 with position 1,2 I used

//CTL1CNTL DD *
OUTFIL FNAMES=CTL2CNTL,REMOVECC,
HEADER1=(' INCLUDE FORMAT=CH,COND=(1,2,NE,1,2,OR,'),
BUILD=(C' 17,2,EQ,C''',1,2,C''',OR,',80:X),
TRAILER1=(' 1,2,NE,1,2)')
/*

because I thought that I must change the header1 and trailer1 put 1,2 instead 1,1

In your new example you used

//CTL1CNTL DD *
OUTFIL FNAMES=CTL2CNTL,REMOVECC,
HEADER1=(' OUTFIL FNAMES=OUT1,INCLUDE=(1,1,CH,NE,1,1,CH,OR,'),
BUILD=(C' 17,2,CH,EQ,C''',1,2,C''',OR,',80:X),
TRAILER1=(' 1,1,CH,NE,1,1,CH)')
/*

then, I should not be changed the header1 and trailer1 and only changed build

Thank you very much
pulcinella
 
Posts: 114
Joined: Mon Dec 10, 2007 10:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Matching files with different length

Postby Frank Yaeger » Tue Feb 10, 2009 9:48 pm

HEADER1 and TRAILER1 are just creating "NOP" conditions to make it easier to generate the correct syntax for the INCLUDE statement:

    INCLUDE COND=(1,1,CH,NE,1,1,CH,OR,           <-  HEADER1
       condition1,                 <--- BUILD line 1
       condition2,                 <--- BUILD line 2
       ...
      1,1,CH,NE,1,1,CH)       <--- TRAILER1


BUILD creates the real conditions for comparison from the input records.

HEADER1 and TRAILER1 just create the first line and last line required for the INCLUDE syntax. That way, we don't have to identify the first line and last line in the input data set. The conditions created by HEADER1 for the first line and by TRAILER1 for the last line just have to never be true so they won't include any records. 1,1,CH,NE,1,1,CH does that. You can use 1,2,CH,NE,1,2,CH if you like but there's no reason to.
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: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Matching files with different length

Postby pulcinella » Wed Feb 11, 2009 12:12 am

Hello Frank,
I greatly appreciate your help
thank you
pulcinella
 
Posts: 114
Joined: Mon Dec 10, 2007 10:18 pm
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post