|
View previous topic :: View next topic
|
| Author |
Message |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
Just wondering if it is possible.
The job below works fine, but just for experimentation, tried to do the build from 1 to 3451 and an overlay of the only position that needs to be changed. I couldn't find any examples of using the BUILD and OVERLAY together, and by trial and error of combining the two options have only met with errors
Not a problem if it isn't possible as the job I have already created works fine anyway.
| Code: |
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
|
| Code: |
//SYSIN DD *
OPTION COPY
JOINKEYS FILE=F1,FIELDS=(1,12,A)
JOINKEYS FILE=F2,FIELDS=(1,12,A),SORTED,NOSEQCK
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F2:1,3451,?)
OUTREC IFTHEN=(WHEN=(3452,1,CH,EQ,C'B'),
BUILD=(1,3447,C'A',3449,3)),
IFTHEN=(WHEN=(3452,1,CH,EQ,C'2'),
BUILD=(1,3451))
/*
//JNF1CNTL DD *
*** DELETE DUPS FROM JNF1 INPUT FILE
SUM FIELDS=NONE
/*
|
One of the options tried was this one. Also swapping the order of the two options around didn't work either.
| Code: |
OUTREC IFTHEN=(WHEN=(3452,1,CH,EQ,C'B'),
OVERLAY(3447:C'A'),
BUILD=(1,3451)),
IFTHEN=(WHEN=(3452,1,CH,EQ,C'2'),
BUILD=(1,3451))
|
Error from the code above
| Code: |
OPTION COPY
JOINKEYS FILE=F1,FIELDS=(1,12,A)
JOINKEYS FILE=F2,FIELDS=(1,12,A),SORTED,NOSEQCK
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F2:1,3451,?)
OUTREC IFTHEN=(WHEN=(3452,1,CH,EQ,C'B'),
OVERLAY(3447:C'A'),
BUILD=(1,3451)),
$
ICE107A F DUPLICATE, CONFLICTING, OR MISSING INREC OR OUTREC STATEMENT OPERANDS
IFTHEN=(WHEN=(3452,1,CH,EQ,C'2'),
$
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
BUILD=(1,3451))
|
|
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Hi expat,
I don't have DFSORT here, but I was wondering how the non-matching records from File1 will be handled in the above job, Wont it come to the output just as it is in the REFORMAT along with the indicator at pos-3452? |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
Hi Arun,
The output file contains the records that I want, in the format that I want, as I am only doing the OUTREC BUILD for the two conditions that I want to include.
I think  |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
| as I am only doing the OUTREC BUILD for the two conditions that I want to include. |
Hi expat,
I am not sure how DFSORT works in this scenario, but I believe Syncsort will not filter records based on the IFTHENs, the unqualified records will pass to the output as it is in the REFORMAT.  |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
Arun,
The DFSORT job is a replacement for another job, using two steps and SAS to produce the file. I have created both files from
a) The original job
b) The DFSORT job
and running a compare both files are exactly the same, so I have no worries over the validity of the output, but was just wondering if I could combine both the BUILD and OVERLAY together. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
| I have no worries over the validity of the output, but was just wondering if I could combine both the BUILD and OVERLAY together. |
Hi expat,
Of course this is off-topic
There may be no non-matching records from file1 for now, but the card made me thinking, what if they do come in input.
If we are sure if that scenario need not be considered, I would have preferred something equivalent to this
| Code: |
JOIN UNPAIRED,F2
REFORMAT FIELDS=(F2:1,3451,?)
INREC IFTHEN=(WHEN=(3452,1,CH,EQ,C'B'),
OVERLAY=(3448:C'A')),IFOUTLEN=3451 |
btw AFAIK, BUILD and OVERLAY cant go together. let's see what kolusu has to say on this. |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
I did try a mini test with non matching records in file1 and you are right, they do come out.
Just changed the JOIN UNPAIRED,F1,F2 to JOIN UNPAIRED,F2 and it seems OK now.
 |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
expat,
You cannot use BUILD and OVERLAY at the same time. It has to be either BUILD or OVERLAY.
As Arunraj pointed out using IFOUTLEN is a good choice to discard the unnecessary fields.
Alternatively you can use CHANGE operator which can look up a value and change based on that value.
ex:
| Code: |
//SYSIN DD *
OPTION COPY
JOINKEYS FILE=F1,FIELDS=(1,12,A)
JOINKEYS FILE=F2,FIELDS=(1,12,A),SORTED,NOSEQCK
JOIN UNPAIRED,F2
REFORMAT FIELDS=(F2:1,3451,?)
INREC BUILD=(1,3447,
3452,1,CHANGE=(1,C'B',C'A'),NOMATCH=(3448,1),
3449,3)
/*
//JNF1CNTL DD *
*** DELETE DUPS FROM JNF1 INPUT FILE
SUM FIELDS=NONE
/* |
The CHANGE operator will evaluate the value at 3452 and if it is a "B" then it will update the value at 3448 to an "A". If it is not "B" then it will copy the contents of 3448 AS IS. |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
| Thanks guys |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|