joinkeys with conditions



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

joinkeys with conditions

Postby pulcinella » Wed Mar 07, 2012 6:53 pm

Good afternoon

I have an input file of 300 positions and need to get an output file of 456 positions based on a number of conditions.

The structure of the files as attachment in the document "structure.txt"

The 300 positions of the input file is written to the 300 top positions in the output file, the rest to complete the 456, should be formatted as shown in "requeriments.txt"

An example of the output is in the document "result.txt".
You do not have the required permissions to view the files attached to this post.
pulcinella
 
Posts: 114
Joined: Mon Dec 10, 2007 10:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: joinkeys with conditions

Postby skolusu » Wed Mar 07, 2012 10:26 pm

Pulicnella,

On the first look I have a couple of questions.

1.I don't see where you need JOINKEYS in here. All you are doing is evaluating a bunch of fields in the output and writing them to the output.

2. There are couple of IF ELSE statements which are contradicting.

ex:
   IF TIPCEN-E = 'R'                                 
      MOVE DIVIS-E TO AMBSU2-S                       
   ELSE                                               
      MOVE DIVIS-E TO AMBSU2-S                         
   END-IF                     


What exactly is the above statement doing? It doesn't matter what the TIPCEN-E value is, you are just moving DIVIS-E to AMBSU2-S. If that is the case why do even need that IF statement?


3. One of the IF statement is checking ZON-E = '' , does that mean null value ? or space? (I don't see any value between the quotes)

4. What's up with NOT= conditions? A good programming exercise is to check for positive conditions.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: joinkeys with conditions

Postby pulcinella » Thu Mar 08, 2012 10:45 pm

Skolusu

Before posting it I try not to make mistakes but I see that something always escapes me. So I appreciate your insights.

1. - It's true. the joinkeys not necessary. Always comes to mind the word. I should have put "process conditions" or "conditions in process" or something similar

2. - What you comment is correct. It should be MOVE DIVIS-E TO AMBSU2-S. You do not need the IF statement

3. - should be SPACES... ZON-E = ' ' (spaces). I have no null values

4. - It's true. A good program should be provided with positive terms. Because of the time, I copied the specifications as written without considering whether there was another way of them. At best, using positive statements, the code would become less complex. If needed, try to see if there is a more correct to put it.

Thank you. a greeting
pulcinella
 
Posts: 114
Joined: Mon Dec 10, 2007 10:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: joinkeys with conditions

Postby pulcinella » Fri Mar 16, 2012 12:25 pm

Attached requirements modified with positive conditions (new requeriments)

thanks
You do not have the required permissions to view the files attached to this post.
pulcinella
 
Posts: 114
Joined: Mon Dec 10, 2007 10:18 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post