In program block , using task which declared outside

In reply to peter:

By the way , are there methods to do this without using program block?

Use a
module
instead of a
program
.