Is there a function to right-justify data with mixed Numerics, Characters and Blanks?
Easytrieve Plus Report Generator, release 6.4
Easytrieve Plus cannot automatically process right-justified/left-justified data containing Numbers, Characters and Blanks.
(Numbers are right-justified only, Characters are left-justified only)
Change the input data to 6-digit numeric data that matches the N type ZONE decimal or create a code to process data right-justified.
There are various possible ways for the code to process data right-justified.
The following is a sample code.
For example;
<Input Data>
DATA1 :9
DATA2 :70000
DATA3 :30
----+----1----+----2----+----3
<Sample source code that cannot be right-justified>
FILE IFILE1 FB(80 0)
I1-KEY 1 14 A
I1-OTHER 15 6 N
*
FILE OFILE1 FB(184 0)
O1-REC 1 184 A
*
WS-ALC1 W 6 N
*-------------------------------------
JOB INPUT(IFILE1)
WS-ALC1 = I1-OTHER
WS-ALC1 = WS-ALC1 + 10
DISPLAY 'WS-ALC1 : ' WS-ALC1
<Output results>
WS-ALC1 : 900010 <= Expected value:19
WS-ALC1 : 700010 <= Expected value:70010
WS-ALC1 : 300010 <= Expected value:40
<Sample source code to right-justify>
Code Contents:
1. Rearrange "I1-OTHER" and "WS-ALC1" once to type A alphanumeric.
2. Find the blank position of "I1-OTHER", and clear "WS-ALC1" to 0, then move the number of "I1-OTHER" to "WS-ALC1".
FILE IFILE1 FB(80 0)
I1-KEY 1 14 A
I1-OTHER 15 6 N
I1-OTHER-A I1-OTHER 1 A OCCURS 6
*
FILE OFILE1 FB(184 0)
O1-REC 1 184 A
*
WS-ALC1 W 6 N
WS-ALC1-A WS-ALC1 1 A OCCURS 6
*
IX S 2 N 0
IY S 2 N 0
*-------------------------------------
JOB INPUT(IFILE1)
WS-ALC1 = 0
IX = 1
IY = 1
*
* INDEX OF SPACE TO IX
*
DO WHILE I1-OTHER-A(IX) NOT SPACE AND IX <= 6
IX = IX + 1
END-DO
*
* IX : WS-ALC1 INDEX OF FIRST NUM IY : INDEX OF I1-OTHER FROM FIRST
*
IX = 7 - ( IX - 1 )
IY = 1
*
* MOVE NUM DATA AS RIGHT JUSTIFICATION
*
DO WHILE IX <= 6
WS-ALC1-A(IX) = I1-OTHER-A(IY)
IX = IX + 1
IY = IY + 1
END-DO
*
WS-ALC1 = WS-ALC1 + 10
DISPLAY 'WS-ALC1 : ' WS-ALC1
<Output results>
WS-ALC1 : 000019
WS-ALC1 : 070010
WS-ALC1 : 000040