|
View previous topic :: View next topic
|
| Author |
Message |
ambalam
New User
Joined: 19 Aug 2018 Posts: 5 Location: India
|
|
|
|
Hi All,
I have two files of length 500 and same structure . I am comparing the files and updating the first file (F1) , with values from 50th position of F2. I am using be below JCL to update my first file and working fine.
| Code: |
//SORTJNF1 DD DSN=FILE1,
// DISP=SHR
//SORTJNF2 DD DSN=FILE2,
// DISP=SHR
//SORTOUT DD DSN=FILE1UPD,
// DISP=(,CATLG,DELETE),
// SPACE=(500,(30,20)),AVGREC=K,
// LRECL=500,RECFM=FB
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,10,A,65,5,A,)
JOINKEYS FILES=F2,FIELDS=(1,10,A,65,5,A,)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,500,?,F2:50,1)
OPTION COPY
OUTFIL IFOUTLEN=500,
IFTHEN=(WHEN=(501,1,CH,EQ,C'B'),OVERLAY=(50:502,1))
|
Now I also want to create a file with unmatched records from first file (F1) . So I modified the JCL as follows.
| Code: |
//SORTJNF1 DD DSN=FILE1
// DISP=SHR
//SORTJNF2 DD DSN=FILE2
// DISP=SHR
//OUT1 DD DSN=FILE1UP
// DISP=(,CATLG,DELETE),
// SPACE=(600,(30,20)),AVGREC=K,
// LRECL=500,RECFM=FB
//OUT2 DD DSN=FILE1.NOMATCH,
// DISP=(,CATLG,DELETE),
// SPACE=(600,(30,20)),AVGREC=K,
// LRECL=500,RECFM=FB
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,19,A,65,5,A,)
JOINKEYS FILES=F2,FIELDS=(1,19,A,65,5,A,)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,500,?,F2:50,1)
OPTION COPY
OUTFIL FNAMES=OUT1,INCLUDE=(501,1,CH,EQ,C'B'),
IFTHEN=(WHEN=(501,1,CH,EQ,C'B'),OVERLAY=(50:502,1)),
BUILD=(1,600)
IFTHEN=(WHEN=(501,1,CH,EQ,C'1'),
OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,500),
|
But I am facing the error below
| Code: |
ICE214A F DUPLICATE, CONFLICTING, OR MISSING OUTFIL STATEMENT OPERANDS
IFTHEN=(WHEN=(501,1,CH,EQ,C'1'),
$
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,500),
|
can you please let me know how can I correct the error and create the unmatched file in the same step.
Please learn to use the code tags to make things easier to read. They are easy to use
| Code: |
[code]
Your stuff here
[/code] |
|
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Do you need the comma on the last statement for OUT1.
| Code: |
IFTHEN=(WHEN=(501,1,CH,EQ,C'1'),
maybe should be
IFTHEN=(WHEN=(501,1,CH,EQ,C'1')
|
|
|
| Back to top |
|
 |
ambalam
New User
Joined: 19 Aug 2018 Posts: 5 Location: India
|
|
|
|
Hi EXPACT ,
Thank you for your suggestion . I had tried without comma and the results are same only.
| Code: |
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,19,A,65,5,A,)
JOINKEYS FILES=F2,FIELDS=(1,19,A,65,5,A,)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,500,?,F2:50,1)
OPTION COPY
OUTFIL FNAMES=OUT1,INCLUDE=(501,1,CH,EQ,C'B'),
IFTHEN=(WHEN=(501,1,CH,EQ,C'B'),OVERLAY=(50:502,1)),
BUILD=(1,500)
IFTHEN=(WHEN=(501,1,CH,EQ,C'1'),
OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,500)
/* |
| Code: |
OUTFIL FNAMES=OUT1,INCLUDE=(601,1,CH,EQ,C'B'),
IFTHEN=(WHEN=(501,1,CH,EQ,C'B'),OVERLAY=(50:502,1)),
BUILD=(1,500)
$
DUPLICATE, CONFLICTING, OR MISSING OUTFIL STATEMENT OPERANDS
IFTHEN=(WHEN=(501,1,CH,EQ,C'1'),
$
BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,500)
|
Infact I have tried other combination for the syntax also. But the results seems to be same. Can we use overlay with build ? If not how can we use instead of this . |
|
| Back to top |
|
 |
ambalam
New User
Joined: 19 Aug 2018 Posts: 5 Location: India
|
|
|
|
I have tried the following also.
| Code: |
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,10,A,65,5,A)
JOINKEYS FILES=F2,FIELDS=(1,10,A,65,5,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,500,?,F2:50,1)
OPTION COPY
OUTFIL FNAMES=OUT1,INCLUDE=(501,1,CH,EQ,C'B'),
IFTHEN=(WHEN=(501,1,CH,EQ,C'B'),OVERLAY=(50:502,1)),
BUILD=(1,500)
OUTFIL FNAMES=OUT2,
IFTHEN=(WHEN=(501,1,CH,EQ,C'1'),
BUILD=(1,500)
/* |
The output is
| Code: |
OUTFIL FNAMES=OUT1,INCLUDE=(501,1,CH,EQ,C'B'),
IFTHEN=(WHEN=(501,1,CH,EQ,C'B'),OVERLAY=(50:502,1)),
BUILD=(1,500)
$
DUPLICATE, CONFLICTING, OR MISSING OUTFIL STATEMENT OPERANDS
OUTFIL FNAMES=OUT2,
IFTHEN=(WHEN=(501,1,CH,EQ,C'1'),
BUILD=(1,500)
|
|
|
| Back to top |
|
 |
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1217 Location: Dublin, Ireland
|
|
|
|
I think your parentheses are misplaced. You want to overlay & build for the case where "B" and, separately, select the records where case is "1". Then all other records to the SAVE output.
e.g.
| Code: |
OUTFIL FNAMES=OUT1,INCLUDE=(501,1,CH,EQ,C'B'),
IFTHEN=(WHEN=(501,1,CH,EQ,C'B'),OVERLAY=(50:502,1),
BUILD=(1,500)),
IFTHEN=(WHEN=(501,1,CH,EQ,C'1'),
BUILD=(1,500))
OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,500)
|
You say:
| Quote: |
| I am comparing the files and updating the first file (F1) , with values from 50th position of F2. |
What you have is overlaying byte 50 of the record from file 1 with the first byte from the record in file 2. Is this what you want? or should this be :
Garry. |
|
| Back to top |
|
 |
ambalam
New User
Joined: 19 Aug 2018 Posts: 5 Location: India
|
|
|
|
Hi Garry,
I am getting the expected results for overlay , that is file F1 in 50th position is updating perfectly with the 50 th position from file F2. , with my first JCL. Only problem is when I tried to write the unmatched records for F1 , I am getting error.
REFORMAT FIELDS=(F1:1,500,?,F2:50,1) is ok. |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| I believe that your JCL is working OK. It is your Sort control statements that you are having problems with. JCL and program control statements are not the same thing. |
|
| Back to top |
|
 |
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1217 Location: Dublin, Ireland
|
|
|
|
I misread the REFORMAT statement v
However, I suggested moving the last close parenthesis of the IFTHEN from after the OVERLAY to after the BUILD, then continue into the next IFTHEN which has the OVERLAY omitted and has the closing parenthesis after a separate BUILD.
Garry. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2288 Location: USA
|
|
|
|
In your first IFTHEN= group, subparameters BUILD=, and OVERLAY= are mutually exclusive.
You need to review the logic of your parameters.
P.S.
It might be easier to catch similar problems, including misplaced parenthesis, if you aligned your code properly (with logical indentation), and divided parameters by lines.
This is an extra recommendation besides of standard one: always use code tags in your questions. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
As sergeyken pointed out, your original problem is having BUILD and OVERLAY in the same OUTFIL, you cannot have both, you can have ONLY either one of those.
| Quote: |
| I also want to create a file with unmatched records from first file (F1) |
From this it looks like you are trying to create 2 outputs
OUT1 - All the records from F1 with pos-50 replaced for matching records in F2.
OUT2 - ONLY non-matching records from F1.
If that is what you want, then you can keep the OUT1 OUTFIL same as what you showed in your very first post and add another OUTFIL like this (untested).
| Code: |
JOINKEYS FILES=F1,FIELDS=(1,10,A,65,5,A,)
JOINKEYS FILES=F2,FIELDS=(1,10,A,65,5,A,)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,500,?,F2:50,1)
OPTION COPY
OUTFIL FNAMES=OUT1,
IFOUTLEN=500,
IFTHEN=(WHEN=(501,1,CH,EQ,C'B'),
OVERLAY=(50:502,1))
OUTFIL FNAMES=OUT2,
INCLUDE=(501,1,CH,EQ,C'1'),
BUILD=(1,500) |
But your later posts show that you are including only matching records into OUT1, if that is what you want you can add an INCLUDE in OUT1 OUTFIL to extract only 'B' records.
IFOUTLEN would help limit your final record length - if that is what you were trying to do with the extra BUILD. You had it in your original control card but looks like you left that out in your 'modified' control card. |
|
| Back to top |
|
 |
ambalam
New User
Joined: 19 Aug 2018 Posts: 5 Location: India
|
|
|
|
Thank You Arun ! This was exactly what I required.
Sorry for the delay . I was on a vacation for a week.
Thanks Garry , Nic and Sergeyken . |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| ambalam wrote: |
Thank You Arun ! This was exactly what I required.
Sorry for the delay . I was on a vacation for a week.
Thanks Garry , Nic and Sergeyken . |
You're welcome. Thanks for the update! |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|