How can I display the minus sign on the left of a number with VISION:Report?
search cancel

How can I display the minus sign on the left of a number with VISION:Report?

book

Article ID: 30998

calendar_today

Updated On:

Products

Vision:Report

Issue/Introduction

VISION:Report does not have an edit pattern to insert a sign byte preceding the first significant digit of an edited field.
However, this can be accomplished by using an edit pattern that generates the sign byte following the last digit of the edited output and logic in the sample code below:

     EQU FILLER WST
     EQU FLDA (2)-B X'FEDC'               /* -292 in binary
     MOVE FLDA TO PRT20 C                 /* convert to edited format 
     PRINT 
     IF PRT26 = C'-'                      /* negative number ?
       MOVE BLANK TO PRT26                /* remove trailing negative sign
       IF PRT19-25 INCLUDES BLANK REVERSE /* scan for a leading blank 
         MOVE C'-' TO PTR1                /* insert leading negative sign 
       ENDIF
     ENDIF
     PRINT
9999 END

The sample code generates an edited number in PRT20-26 using edit mask "C" (C'bbb292-').
If a minus sign is present in the last byte of the output, PRT26, it is blanked out.
Then the output field and a preceding blank in front of the output field are scanned from right to left for the first blank byte (C'bbbb292-').
The sign byte is inserted their, yielding the desired format of C'bbb-292b'.

Environment

Release: VSNREP00100-16.1-VISION:Report
Component: