IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Combining BUILD and OVERLAY in one statement, just wondering


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
expat

Global Moderator


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

PostPosted: Wed Jun 05, 2013 2:20 pm
Reply with quote

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 icon_eek.gif

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

Moderator


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

PostPosted: Wed Jun 05, 2013 2:37 pm
Reply with quote

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

Global Moderator


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

PostPosted: Wed Jun 05, 2013 3:26 pm
Reply with quote

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 icon_eyes.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Jun 05, 2013 3:31 pm
Reply with quote

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. icon_confused.gif
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Jun 05, 2013 3:43 pm
Reply with quote

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

Moderator


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

PostPosted: Wed Jun 05, 2013 3:51 pm
Reply with quote

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 icon_smile.gif

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

Global Moderator


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

PostPosted: Wed Jun 05, 2013 4:03 pm
Reply with quote

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.

icon_eyes.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 05, 2013 9:49 pm
Reply with quote

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

Global Moderator


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

PostPosted: Thu Jun 06, 2013 11:38 am
Reply with quote

Thanks guys
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
No new posts Build dataset list with properties us... PL/I & Assembler 4
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Help, trying to use OVERLAY to get a ... DFSORT/ICETOOL 3
Search our Forums:

Back to Top