There is no direct way of doing an autonomous transaction in SQLAnywhere.
You can get close to the same thing by triggering an event that will then perform the transaction.
Example:
create table error_log(
recorded timestamp default current timestamp,
details long varchar
);
create event ev_Log_Error
handler
begin
insert into error_log( details )
values( event_parameter( 'details' ) );
commit;
end;
create procedure Log_an_Error( in @details long varchar )
begin
trigger event ev_Log_Error( "details" = @details );
end;
Then you can add an error message to the log at any time by using:
call Log_an_Error( 'this is an error' );
Some things to note - the size of the parameters passed to the trigger is limited by the database page size. If you need to pass larger pieces of information, then it would be best to create a global temporary table non transactional shared by all and insert the data into this table and pass an "id" of the newly inserted row to the event - the event can then pull the data out of the temp table and do what it needs with it.
Your second requirement - waiting for the transaction to complete before proceeding is a bit more difficult. One method, but not really a decent one (for several reasons), would be to poll the above mentioned global temp table to wait for the row to be deleted and have the event delete the row once it has processed it.
A perhaps better method would be to use WAIT FOR WAITFOR AFTER MESSAGE BREAK statement to cause the main request to pause, and then have the event send a message using MESSAGE ... TO CONNECTION n to the main request to continue. (You can easily pass the connection ID of the main request to the trigger as another event parameter) The issue to be aware of here is that without care, this could cause a deadlock situation if there is not enough server workers to process the event.