Example 12
OPTION COPY
OUTREC OVERLAY=(11:11,16,JFY=(SHIFT=RIGHT,LEAD=C'(',
TRAIL=C')',LENGTH=18))
This example illustrates how you can right-justify fields within your records.
The 50-byte FB input records might look like this:
0001 9-1-632-731
0002 011-276-321-7836
0003 753-218-307
0004 528-314
Note that the second field has left-justified
numeric values in various forms. We want to right-justify these values
and surround them with a left parenthesis and right parenthesis.The 50-byte FB output records look like this:
0001 (9-1-632-731)
0002 (011-276-321-7836)
0003 (753-218-307)
0004 (528-314)
We use OUTFIL OVERLAY to limit the changes to the second field. We use JFY to right-justify the second field with surrounding parentheses. SHIFT=RIGHT shifts the characters to the right. LEAD=C'(' adds a left parenthesis before the first non-blank character. TRAIL=C')' adds a right parenthesis after the last non-blank character. LENGTH=18 increases the output length by 2 bytes to allow for the parentheses (overriding the default of 16 from the input length).