The example program found at ===>
http://www.mainframes360.com/2010/11/learning-assembler-language.html, was written for Batch and is non-reentrant. Of course, the DCB must be removed to execute in CICS as a "CALLED" sub-program. The easiest method to run in CICS is to pass reentrant storage (this is a necessity in a Threadsafe/OpenAPI environment) from the caller as a parameter. If this were running in Batch, using the CICS DFHAFCD Macro (expands into 3 "load" instructions) can tell you (see below) whether the run-environment is CICS or Batch. With that, if Batch, then the storage allocated can be non-reentrant and defined to the program itself (known as program-storage) or always pass the reentrant storage as a parameter from the Caller and then it doesn't matter.
DFHAFCD TYPE=LOCATE R15 is the default
LTR 15,15 Valid address?
BZ BATCH No, Batch environment
CLC =CL3'AFC',0(15) Target literal found?
BNE BATCH No, Batch environment
HTH....
Regards,
Bill (Grumpy Old Dinosaur)