Whats wrong with this DFSORT please



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

Whats wrong with this DFSORT please

Postby Andyf » Tue Nov 30, 2010 8:02 pm

I have the following data which
..20101123
....20011113
.*..20501231
.*..20501231
..00737..20011113
..00738..20011113
.æ........@

which I run through DFSORT with parameters

   OPTION COPY                             
   OUTREC IFTHEN=(WHEN=INIT,               
          BUILD=(1,2,PD,M11)),             
      IFTHEN=(WHEN=(1,2,PD,EQ,0),         
          BUILD=(4:3,10)),                 
      IFTHEN=(WHEN=(1,2,PD,EQ,10),         
          BUILD=(4:3,2,PD,M11,5,8)),       
      IFTHEN=(WHEN=(1,2,PD,EQ,15),         
          BUILD=(4:3,2,PD,M11,5,8)),       
      IFTHEN=(WHEN=(1,2,PD,EQ,20),         
          BUILD=(4:3,5,8,2,PD,M11,10,8)), 
      IFTHEN=(WHEN=(1,2,PD,EQ,30),         
          BUILD=(4:3,2,PD,M11,5,10)),     
      IFTHEN=(WHEN=(1,2,PD,EQ,99),         
          BUILD=(4:3,9,PD,M11))           


and get the following output

000 .
010 .
015 .
015 .
020 .
020 .
099 .

which is not the output wanted,

but when I change the sort parameters to the following (which to my mind is the same, but obviously isn't)

  OPTION COPY                                     
  OUTREC IFTHEN=(WHEN=(1,2,PD,EQ,0),             
       BUILD=(1,2,PD,M11,3,10)),               
   IFTHEN=(WHEN=(1,2,PD,EQ,10),                 
       BUILD=(1,2,PD,M11,3,2,PD,M11,5,8)),     
   IFTHEN=(WHEN=(1,2,PD,EQ,15),                 
       BUILD=(1,2,PD,M11,3,2,PD,M11,5,8)),     
   IFTHEN=(WHEN=(1,2,PD,EQ,20),                 
       BUILD=(1,2,PD,M11,3,5,8,2,PD,M11,10,8)),
   IFTHEN=(WHEN=(1,2,PD,EQ,30),                 
       BUILD=(1,2,PD,M11,3,2,PD,M11,5,10)),     
   IFTHEN=(WHEN=(1,2,PD,EQ,99),                 
       BUILD=(1,2,PD,M11,3,9,PD,M11))           


I get the desired output of

00020101123
01000220011113
01500120501231
01500220501231
0200073700120011113
0200073800120011113
09900000000000000007

Question: why the differences, does the IFTHEN=(WHEN=INIT, change the data so that the rest of the IFTHEN commands don't recognise the input, if so can I get around this?
Andyf
 
Posts: 10
Joined: Mon May 24, 2010 3:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Whats wrong with this DFSORT please

Postby Frank Yaeger » Wed Dec 01, 2010 2:17 am

Pretty simple. When you use:

   OUTREC IFTHEN=(WHEN=INIT,   
          BUILD=(1,2,PD,M11)), 


you are changing the 2-byte PD value in positions 1-2 to a 3-byte ZD value in positions 1-3.

So after the WHEN=INIT clause, your first record would just have:

000

So the subsequent tests of 1,2,PD,EQ,n will NOT be testing the right value. Instead you'd need to use 1,3,ZD,EQ,n. But you've also lost the rest of the data in the record, so you can't move it. If you want to convert to ZD first, you need to move the rest of the data over to start in position 4. Then you can test for 1,3,ZD,EQ,n and move the data you want from position 4 on.
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: Whats wrong with this DFSORT please

Postby Andyf » Wed Dec 01, 2010 2:19 pm

Thank your response, all working now
Andyf
 
Posts: 10
Joined: Mon May 24, 2010 3:16 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post