-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of John McKown
Sent: Tuesday, June 25, 2013 8:16 AM
To: [email protected]
Subject: z/OS subroutine in assembler, used in both batch & CICS , making 
re-entrant

IMO, this is a rather involved problem.

background:
This is in CICS/TS 4.1, z/OS 1.12. We have a few highly used assembler 
subroutines which are statically linked into both CICS and batch COBOL 
programs. These programs are very old (20+ years). They use an "in line"
save area, and so they are not RENT. We are having a problem with some other 
program (nobody can figure out which one) in which that program sometimes 
overlays  a CICS application program. Some time thereafter, when this overlaid 
program is invoked, it abends (surprise, suprise!). We are running 
RENTPGM=PROTECT. However, none of our programs are linked as RENT and so they 
are not protected. We use CA-Endevor to do all our compiles.
The Endevor person changed the Endevor setup to have the RENT parm in all 
CICS/COBOL links. Unfortunately, this resulted in programs which use this 
assembler subroutine abending ASRA (S0C4-4) when the subroutine tried to modify 
its save area (in the CSECT). I don't know why the binder requires the RENT 
parameter to mark a program object as RENT if all the input CSECTs are COBOL 
which is compiled with the RENT compiler option. Maybe somebody could explain? 
Nobody here really understands CA-Endevor.

Bottom line: I need to change the assembler program to be RENT. And it still 
needs to be callable by both CICS and COBOL programs. And I cannot have a batch 
version vs. a CICS version. So I really do need it to truly be RENT. So I have 
some questions.

This has worked for me in the past:

                   DFHAFCD TYPE=LOCATE      ADDRESS AFCB
                   LTR   R15,R15                         Are we BATCH?
                   BZ     BATCH00                         YES Do Batch
                  CLC   0(3,R15),=CL3'AFC'      Is It CICS?
                  BE     CICS00                             Yes, Do CICS
BATCH00 DS    0H
                  Batch Stuff
CICS00     DS   0H
                  CICS Stuff


1) Can I use a BAKR instruction in CICS successfully. This would put the 
caller's registers in the z/OS stack. Since the program runs on the QR TCB and 
does not do any CICS work, there should not be any concern about a CICS task 
switch causing the program stack to be modified.

2) Convert the assembler code to be LE compliant. I think that the LE prologue 
is the same for both CICS and batch. I am familiar with writing LE enabled 
assembler main routines.

3) Convert the assembler to COBOL. This would be a royal PITA to code and I am 
concerned about the CPU impact. This is highly used code. And, apologies to Tom 
Ross, the COBOL code generation seems to be designed to stress test the entire 
instruction set.

4) What about not using a save area at all? It might be poor design, but what 
about using the high full word of each register as a save area for the lower 
full word? I don't think that CICS or COBOL uses the full 64 bit registers. I 
think that the start up code could "save" each register with a RLLG Rn,Rn,32 to 
rotate bits 32-64 into 0-31 before using bits 32-64 for other purposes. Then 
"restore" the register(s) with the exact same instruction to rotate the bits in 
0-31 back into bits 32-64. I _assume_ that bits 0-31 at entry are not important 
and need not be saved/restored.

5) What about using the access registers as a save area? I could do a series of 
SAR Rx,Rx at the front of the code and then EAR Rx,Rx instructions at the end. 
I don't think that the Access Registers are used in CICS application code and I 
doubt their values are assumed to be anything specific in CICS management 
routines. I.e. they should be available without saving.

I have more or less ordered these in my "most to least" desirable order.
Oh, rewriting into C is not an option. We don't have a C compiler. Actually all 
we have is HLASM and COBOL.


--
This is a test of the Emergency Broadcast System. If this had been an actual 
emergency, do you really think we'd stick around to tell you?

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected] with the message: INFO IBM-MAIN

==========================
This email, and any files transmitted with it, is confidential and intended 
solely for the use of the individual or entity to which it is addressed. If you 
have received this email in error, please notify the system manager. This 
message contains confidential information and is intended only for the 
individual named. If you are not the named addressee, you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this message by mistake and delete 
this e-mail from your system. If you are not the intended recipient, you are 
notified that disclosing, copying, distributing or taking any action in 
reliance on the contents of this information is strictly prohibited.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to