Announcement

Collapse
No announcement yet.

%EDITC question.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scott Klement
    replied
    As far as I can tell, this is the exact same question and discussion as the one in the following thread:
    http://www.code400.com/forum/forum/i...a-packed-field

    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.

    Leave a comment:


  • tomliotta
    replied
    Originally posted by dcutaia View Post
    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
    That doesn't seem to be a packed value since packed values contain neither "P"s nor decimal points, so it's not clear what you mean by "packed". It's also not clear what you mean by "send". How are you intending to "send" a value to a field?

    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:


  • jackc
    replied
    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:


  • Brian Rusch
    replied
    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:


  • dcutaia
    replied
    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
    DO 18
    C W14
    (XIFEQ ' '
    C W14(XOREQ '-'
    C W14(XOREQ '.'
    C SUB 1 X
    ELSE
    C MOVE W14(XD14A(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:


  • DeadManWalks
    replied
    I don't think you can do this in one statement as N will not give you leading zeros .

    https://publib.boulder.ibm.com/iseri...c092508416.htm

    Leave a comment:


  • dcutaia
    started a topic %EDITC question.

    %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
Working...
X