The simplest method would be to set logpass to empty string right after the CONNECT statement. You could encrypt it into a global variable in case you needed to connect again later.
The issue I see with this question is that the user typing in the password and the hacker are the same person so of course they recognize the password in the memory dump. A real hacker isn't going to recognize that string as a password or have knowledge about the internals of PowerBuilder or your app.
If you have a hacker in your network looking for passwords, installing a key logger would be easier than looking at memory dumps. To avoid a key logger, you'd have to use Windows Authentication or whatever Oracle calls it.
To avoid hackers you need to first make sure your network is secured and all users are well trained in how to avoid the hacker tricks.