DFSORT Best Example for Multiple Overlay

In DFSORT the OVERLAY concept tells you that how to replace one character with other character. The speciality of this post tells how to write correct syntax for multiple overlay. I hope you are familiar with job card. So, I have given only sort card here.


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

DFSORT Overlay

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

Also read

The standard syntax is as follows

Read syntax diagramSkip 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