* Program :·EditWR
* Description :·%EditW() Example
*
* Syntex :
*
* %EditW(Non-float numeric expression : Edit word)
*
* Output :·String representing edited value
*
* Note :
*
* >·if '0' or '*' is used in edit word
* >>·first '0' or '*' will be considerd as Ends Zero Suppression, will be clear with
* examples. after first '0' or '*' other given '0' or '*' will be considered as
* constants.
*
*=====================================================
*
D Var1 S 5P 2 Inz(123.45)
D Str C '$ Cents '
D IntDate S 6P 0 Inz(010112)
D DateEditW C ' / / '
D Str1 S 30A
C
/Free
Str1 = 'I have ' + %EditW(Var1 : Str) ;
Dsply Str1 ; // I have $123Cents45
Str1 = 'Today''s Date' + %EditW(IntDate : DateEditW) ;
Dsply Str1 ; // Today's Date 1/01/12
Str1 = %EditW(00142.20 : ' $0. ') ;
Dsply Str1 ; // DSPLY $142.20
// '0' as end zero suppressor
Str1 = %EditW(0001 : ' 0 ') ;
Dsply Str1 ; // DSPLY 1
Str1 = %EditW(0001 : ' 0 ') ;
Dsply Str1 ; // DSPLY 01
Str1 = %EditW(0001 : '0 ') ;
Dsply Str1 ; // DSPLY 001
// only first '0' will be considerd as zero suppressor & will be replaced by given
// string, second '0' onwards it will be treated as constant & will not be replaced
Str1 = %EditW(0001 : '00 ') ;
Dsply Str1 ; // DSPLY 0001
// '*' as end zero suppressor
Str1 = %EditW(0001 : ' * ') ;
Dsply Str1 ; // DSPLY ***1
Str1 = %EditW(0001 : ' * ') ;
Dsply Str1 ; // DSPLY **01
Str1 = %EditW(0001 : '* ') ;
Dsply Str1 ; // DSPLY *001
// only first '*' will be considerd as zero suppressor & will be replaced by given
// string, second '*' onwards it will be treated as constant & will not be replaced
Str1 = %EditW(0001 : '** ') ;
Dsply Str1 ; // DSPLY **001
/End-Free
C SetOn LR
No comments:
Post a Comment