DFSORT The Best Example How to Use Multiple Overlay

Here is the best DFSORT example on OVERLAY. The OVERLAY replaces one character with another.


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)),

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

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                                                                     |   
              |           '-+-,BUILD=(items)---+-'                   |       
              |             +-,OVERLAY=(items)-+                     |       
              |             '-,FINDREP=(items)-'                     |       
              |            +-,KEYBEGIN=(p,m)-+                       |       
              |            +-,END=(logexp)---+                       |       
              |            '-,RECORDS=n------'                       |       
              |               '-+-,BUILD=(items)---+-' '-,HIT=NEXT-' |       
              |                 +-,OVERLAY=(items)-+                 |       
              |                 '-,FINDREP=(items)-'                 |       
              |          '-+-,BUILD=(items)---+-' '-,HIT=NEXT-'      |       
              |            +-,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.