How can I right-justify a character field in VISION:Report?
You can right-justify a character string with the VISION:REPORT WHEN statement.
The following example moves a left-justified character string terminated by a blank in LEFT-FIELD to RIGHT-FIELD by whatever length LEFT-FIELD character string is.
In this case, the LEFT-FIELD character string is 3-bytes.
VISION:Report will scan to the end of RIGHT-FIELD, subtract by the length found for LEFT-FIELD and move LEFT-FIELD to RIGHT-FIELD for the length found after
the WHEN statement.
EQU MY-AREA WST EQU LEFT-FIELD (8) C'123' EQU RIGHT-FIELD (10) C'ABCDEFGHIJ' EQU RIGHT-END (3) C'XYZ' EQU LEFT-LEN (4)-B * PRINTHEX WST1-100 /* BEFORE IMAGE MOVE P'8' TO LEFT-LEN /* ASSUME LEFT FIELD IS NON-BLANK WHEN LEFT-FIELD INCLUDES BLANK /* SCAN FOR END OF STRING MOVE @VAL-WHEN-LTH TO LEFT-LEN. SET PTA RIGHT-END SET PTA DOWN LEFT-LEN MOVE LEFT-FIELD TO PTA1 LEFT-LEN PRINTHEX WST1-30 /* AFTER IMAGE GOTO EOJ 9999 END ---
Here is what the output of program would look like:
WST1-100 123 ABCDEFGHIJXYZ FFF44444CCCCCCCCCDEEE000000000 123000001234567891789000000000 01..05...10...15...20...25...30 WST1-100 123 ABCDEFG123XYZ FFF44444CCCCCCCFFFEEE000000000 123000001234567123789000300000 01..05...10...15...20...25...30