Page 1 of 1

joinkeys with conditions

PostPosted: Wed Mar 07, 2012 6:53 pm
by pulcinella
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".

Re: joinkeys with conditions

PostPosted: Wed Mar 07, 2012 10:26 pm
by skolusu
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.

Re: joinkeys with conditions

PostPosted: Thu Mar 08, 2012 10:45 pm
by pulcinella
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

Re: joinkeys with conditions

PostPosted: Fri Mar 16, 2012 12:25 pm
by pulcinella
Attached requirements modified with positive conditions (new requeriments)

thanks