|
I agree with Jon here, the easiest solution is to use Varchar fields.
It's must easier, especially since the Procedure just returns the value.
For example:
Dcl-Proc Maskaccount#;
Dcl-Pi Maskaccount# Varchar(20);
Accountnbr Varchar(20) CONST OPTIONS( *VARSIZE );
End-Pi;
Dcl-S Waccountnbr Varchar(20);
Dcl-S Length Packed(3);
Dcl-S #Ofasterisks Packed(3);
Dcl-S I Packed(3);
Waccountnbr = %TRIMR( Accountnbr );
Length = %LEN( Waccountnbr );
If Length > 1;
If Length >= 8;
#Ofasterisks = Length - 4; // Mask all but last 4 digits
Else;
#Ofasterisks = Length / 2; // Mask half of the digits
Endif;
%SUBST( Waccountnbr : 1 : #Ofasterisks) = *ALL'*';
Endif;
Return Waccountnbr;
End-Proc Maskaccount#;
Chris Hiebert
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.