I was struggling with this problem:
I write report to the dataset and want the amount values to be aligned by right:
Let's say I fetch 3 rows from table
A. 200.000
B. 2000.000
C. 100473.090
I want to report look like this:
A 2009-12-29 200.000
B 2009-12-29 2000.000
C 2009-12-29 100473.090
These are main steps of what I tried:
Variables:
01 WS-AMOUNT PIC S9(15)V9(3) COMP-3 VALUE 0.
01 REPORT-LINE.
05 WS-DATE PIC X(10).
05 PIC X VALUE ' '.
05 WS-AMOUNT-R
PIC ZZZ,ZZZ,ZZZ,ZZZ,ZZ9,999.
01 REPORT-LINE.
05 WS-DATE PIC X(10).
05 PIC X VALUE ' '.
05 WS-AMOUNT-R
PIC ZZZ,ZZZ,ZZZ,ZZZ,ZZ9,999.
SQL fetch:
FETCH CURR INTO
:WS-DATE,
:WS--AMOUNT
:WS-DATE,
:WS--AMOUNT
Move:
MOVE WS-AMOUNT TO WS-AMOUNT-R
What i get:
2009-12-29 0,200
2009-12-29 2,000
2009-12-29 100,473
2009-12-29 0,200
2009-12-29 2,000
2009-12-29 100,473
this might give you some info. When i add these displays after move sentence, this what i see:
DISPLAY WS-AMOUNT
DISPLAY WS-AMOUNT-R
+000000000000200000
0,200
+000000000002000000
2,000
+000000000100473090
100,473
0,200
+000000000002000000
2,000
+000000000100473090
100,473
I also tried JUSTIFIED RIGHT, but that only seem to work for DISPLAYs and don't have any effect when I print values to dataset.
Do you have any suggestions?