I'm assuming you want to write custom data, not just the lines executed (which is sadly all you get from PBDEBUG; I've always wanted a custom data write to a PBDEBUG trace, but I've never been able to convince anyone at Sybase to add this to the product).
PFC
PFC offers a Debug service that does this, but if you haven't built your app with PFC already, it may require a moderate effort to adapt it to your infrastructure. If you've got a PFC-based app, all you have to do is
of_SetDebug (TRUE)
in the pfc_Open event of the Application Manager (or some other appropriate place), then start peppering your code with
IF IsValid (gnv_App.inv_Debug) THEN gnv_App.inv_Debug.of_Message (...)
This way, you can just remove the of_SetDebug() to turn off the messaging, without having to remove all the messages' code. (OK, in theory this will slow down your app a little, checking to see if IsValid () all the time.) I even put in code so that I can turn on the Debug Service with a command line option (that I don't tell the users about). That way, I can do this style of troubleshooting at the end-users' workstations (assuming I've anticipated the data I need to write).
Other
If I'm stuck with a non-PFC app, I'm afraid I'm usually too rushed (read: too lazy) to adapt the PFC debug service, so I just create a global function that does a FileOpen, FileWrite and FileClose on a hard-coded file name, writing the message passed in as a parameter. Then I load my code with calls to this function. In theory you could make this an empty function when it's time to deploy, but I have usually removed all the calls instead.