Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Joinkeys overlay and unmatched with Outfil

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ambalam

New User


Joined: 19 Aug 2018
Posts: 5
Location: India

PostPosted: Thu Aug 23, 2018 11:57 am    Post subject: Joinkeys overlay and unmatched with Outfil
Reply with quote

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
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8720
Location: Welsh Wales

PostPosted: Thu Aug 23, 2018 12:22 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ambalam

New User


Joined: 19 Aug 2018
Posts: 5
Location: India

PostPosted: Thu Aug 23, 2018 12:59 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ambalam

New User


Joined: 19 Aug 2018
Posts: 5
Location: India

PostPosted: Thu Aug 23, 2018 1:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1024
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Aug 23, 2018 2:01 pm    Post subject:
Reply with quote

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 :
Code:
  OVERLAY=(50:552,1) 


Garry.
Back to top
View user's profile Send private message
ambalam

New User


Joined: 19 Aug 2018
Posts: 5
Location: India

PostPosted: Thu Aug 23, 2018 2:24 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2098
Location: UK

PostPosted: Thu Aug 23, 2018 2:54 pm    Post subject: Reply to: Joinkeys overlay and unmatched with Outfil
Reply with quote

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
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1024
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Aug 23, 2018 3:39 pm    Post subject:
Reply with quote

I misread the REFORMAT statement icon_redface.gif 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
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 365
Location: Maryland

PostPosted: Thu Aug 23, 2018 5:09 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2408
Location: @my desk

PostPosted: Thu Aug 23, 2018 9:52 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ambalam

New User


Joined: 19 Aug 2018
Posts: 5
Location: India

PostPosted: Thu Aug 30, 2018 2:59 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2408
Location: @my desk

PostPosted: Thu Aug 30, 2018 8:47 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Extra data in overlay field speermb DFSORT/ICETOOL 2 Thu Sep 13, 2018 6:04 pm
No new posts Reformat clause in joinkeys sortcard ... Mounika Nemani DFSORT/ICETOOL 2 Thu May 31, 2018 5:35 pm
No new posts OUTREC OVERLAY different to INCREC ge... Joerg.Findeisen SYNCSORT 8 Fri Apr 27, 2018 2:11 am
No new posts Duplicate PARM on OUTFIL sancraig16 SYNCSORT 11 Thu Apr 05, 2018 10:25 pm
No new posts SELECT TO MULIPLE OUTFIL speermb DFSORT/ICETOOL 5 Fri Mar 23, 2018 10:44 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us