× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



So, I finally went with Chris'/Jon's suggestion, and implemented a sub-proc
in the program that will call it. Works great.

I am trying to introduce service programs in this shop, which has met with
resistance. (Fortunately, we have a new manager who has given me the
go-ahead to start with something simple.) I started with the program (not
service program) I pasted in the OP to have a working example to convert to
a service program, but I couldn't get past the different parameter sizes.

I needed to have this working by 3:00 today. Although I took a decent stab
at a service program, and created one, I couldn't get the calling program
to compile, with CPD5D02 (Definition not found for symbol 'CA9804R'.) So,
this will have to be investigated in my free time.

Rob, I actually found the CREATE MASK earlier, but the security
implications required much more study than this project would allow. We're
also only at v7r1, but moving to v7r2 soon, so there's that as well.

Thanks to everyone who made suggestions!

- Dan

On Wed, May 17, 2017 at 11:43 AM, Hiebert, Chris <
chris.hiebert@xxxxxxxxxxxxxx> wrote:

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 thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.