DFSORT Best Example, How to Use Multiple Overlay

Here’s the best example of multiple-overlay. This example shows you how replace values using OVERLAY.

DFSORT Multiple OVERLAY.

OPTION COPY
OUTREC IFTHEN=(WHEN=INIT, BUILD=(1:1,40,50:106,4,60:170,4,BI,EDIT=(TT.TT),70:170,4)),
IFTHEN=(WHEN=(50,4,CH,EQ,C’COR’,AND,70,4,BI,GT,+2000), OVERLAY=(70:C’20%’,X)),
IFTHEN=(WHEN=(50,4,CH,EQ,C’COR’,AND,70,4,BI,LE,+2000), OVERLAY=(70:C’10%’,X)),
IFTHEN=(WHEN=(50,4,CH,EQ,C’VALD’),OVERLAY=(70:C’25%’,X)),
IFTHEN=(WHEN=NONE,OVERLAY=(70:C’15%’,X))

WHEN condition satisfied, it overlayed with a value or character.

Advertisements

The explanations

  • WHEN=INIT: Use one or more WHEN=INIT clauses to apply BUILD, FINDREP or OVERLAY items to all of your input records. WHEN=INIT clauses and WHEN=GROUP clauses are processed before any of the other IFTHEN clauses.
  • WHEN=INIT changes (if any) and WHEN=GROUP changes (if any) are applied to input records that do not meet the criteria for any of the WHEN=(logexp) clauses.
  • WHEN=NONE It means no other condition satisfied
  • One IFTHEN clause is satisfied, then skips checking for other IFTHEN statement

Standard Multiple OVERLAY syntax

Skip visual syntax diagram   .-,-------------------------------------------------------------------
V                                                                     |   
>>---IFTHEN=(-+-WHEN=INIT-+-,PARSE=(definitions)-+-------------------+-)-+-><
              |           '-+-,BUILD=(items)---+-'                   |       
              |             +-,OVERLAY=(items)-+                     |       
              |             '-,FINDREP=(items)-'                     |       
              +-WHEN=GROUP-+-,BEGIN=(logexp)-+-,PUSH=(items)---------+       
              |            +-,KEYBEGIN=(p,m)-+                       |       
              |            +-,END=(logexp)---+                       |       
              |            '-,RECORDS=n------'                       |       
              +-WHEN=(logexp)-+-,PARSE=(definitions)-+-+-----------+-+       
              |               '-+-,BUILD=(items)---+-' '-,HIT=NEXT-' |       
              |                 +-,OVERLAY=(items)-+                 |       
              |                 '-,FINDREP=(items)-'                 |       
              +-WHEN=ANY-+-,PARSE=(definitions)-+-+-----------+------+       
              |          '-+-,BUILD=(items)---+-' '-,HIT=NEXT-'      |       
              |            +-,OVERLAY=(items)-+                      |       
              |            '-,FINDREP=(items)-'                      |       
              '-WHEN=NONE-+-,PARSE=(definitions)-+-------------------'       
                          '-+-,BUILD=(items)---+-'                           
                            +-,OVERLAY=(items)-+                             
                           '-,FINDREP=(items)-'

DFSORT | SORT | Overlay

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.