As far as I can tell, this is the exact same question and discussion as the one in the following thread:
I would suggest reading both threads before replying so as not to duplicate what has already been said. Also, in the future, please consider only posting the question once.
Announcement
Collapse
No announcement yet.
%EDITC question.
Collapse
X
-
Originally posted by dcutaia View PostDoes anyone know how I can send a negative sign(minus) sign to a packed field that is 18.2.
For example instead of 0000000000000014.4P
I want -000000000000014.43
I'm guessing that maybe you are asking about either displaying or printing numeric values with separate sign characters, but it would help if you could clarify what you're trying to accomplish. Can you describe the process?
Leave a comment:
-
If you're really adventurous, you could roll your own custom edit mask and call the QECEDT API.
I've used this API to display edited numeric values retrieved using dynamic SQL, so the mask has to be built at runtime based on the attributes of the field. Could be built at compile time in your case.
Leave a comment:
-
How about:
Code:A18a = %Trim(%EDITW(%ABS(MIN1IP):'0 . ')); // edit mask is a 0, 16 spaces, decimal point, 2 spaces If MIN1IP < *zero; %subst(A18a:1:1) = '-'; Endif;
Leave a comment:
-
Ok ,
Here is my solution to my problem.
First create an array to zero fill the field
PHP Code:*
D D14A S 1 DIM(18)
D DS
D RECORDTST 1 18
D W14 1 18
D DIM(18)
D OFF S 18 INZ(*blanks)
*
if MIN1IP < 0; if invoice payment is less than zero; credit amount
A18a=%char(MIN1IP); convert to character example(-14.47 )
RECORDTST = A18a; move character into variable for subroutine
Exsr zerofil; call subroutine
A18a= off; move array value back to variable
else;
A18a=%Trim(%EDITC(MIN1IP:'X')); //INV PAYMENT /5 invoice amount is positive
endif;
PHP Code:C zerofil begsr
C MOVE *ZEROS D14A
C Z-ADD 18 X 3 0
C Z-ADD 18 Y 3 0
C DO 18
C W14(X) IFEQ ' '
C W14(X) OREQ '-'
C W14(X) OREQ '.'
C SUB 1 X
C ELSE
C MOVE W14(X) D14A(Y)
C SUB 1 X
C SUB 1 Y
C END
C ENDDO
C MOVE '-' D14A(1)
C MOVEA D14A OFF
C*
C endsr
Last edited by jamief; June 9, 2016, 03:43 PM.
Leave a comment:
-
I don't think you can do this in one statement as N will not give you leading zeros .
Leave a comment:
-
%EDITC question.
Does anyone know how I can send a negative sign(minus) sign to a packed field that is 18.2.
For example instead of 0000000000000014.4P
I want -000000000000014.43
with this code :
A18a=%Trim(%EDITC(MIN1IP:'X')); //INV PAYMENT /5
I am getting:
0000000000000014.4P
if I need it -000000000000014.43
should I try this %EDITC
A18a=%Trim(%EDITC(MIN1IP:'N')); //INV PAYMENT /5
Tags: None
Leave a comment: