Moving a piece of open_and_process_routine() into a new function sp_acquire_routine()
Moving a piece of open_and_process_routine() into a new function sp_acquire_routine()

Reason:
- avoid huge functions
- sp_acquire_routine() will be reused for Oracle-style packages soon

natsys/mariadb_10.2,natsys/mariadb_10.2,natsys/mariadb_10.2,natsys/mariadb_10.2,natsys/mariadb_10.2,natsys/mariadb_10.2,natsys/mariadb_10.2,natsys/mariadb_10.2,natsys/mariadb_10.2,natsys/mariadb_10.2,natsys/mariadb_10.2