Feb 11, 2013

Convert a Double to String : M3

Since M3 java code is similar to RPG and use MvxString rather than String, here it is the code to convert/format numeric value to alpha value in M3.

   1:  this.PXNUM = dSUM;
   2:  this.PXALPH.clear();
   3:  SRCOMNUM.COMNUM();
   4:  WQT[tempIdx].moveRight(this.PXALPH);



In line number:


1. assign double value which is to be converted.
2. clear any previous value of PXALPH.
3. actual conversion . The SRCCOMNUM is an object of cSRCOMNUM class declared in mvx.app.util
4. gets converted alphanumeric value.


Let, dSUM= 38.05580 and if we want



  • to display dSUM with 2 decimal:

   1:  this.PXNUM = dSUM; 
   2:  this.PXALPH.clear();   
   3:  this.PXDCCD = 2; // setting number of decimals.
   4:  SRCOMNUM.COMNUM(); 
   5:  WQT[tempIdx].moveRight(this.PXALPH);




Output> 38.05






  • to display negative value: Here we have a option, to which character to be used for negative representations. (i.e. –38.05, (38.55), 38.05- etc)

   1:  this.PXNUM = dSUM; 
   2:  this.PXALPH.clear();   
   3:  this.PXDCCD = 2; 
   4:  SRCOMNUM.PXPNVB='('; // Left character if negative
   5:  SRCOMNUM.PXPNVA=')'; // Right character if negative
   6:  SRCOMNUM.COMNUM(); 
   7:  WQT[tempIdx].moveRight(this.PXALPH);






Output> (38.05)

MEC: How to Set Message Counter for EDI Message

When you sending/creating EDI messages it is necessary to include unique message interchange number. This is to ensure each message that we ...