Joined: 05 Feb 2007 Posts: 199 Location: Sri Lanka
Hi,
I have a bit of code that I am trying to understand.
Code:
DIV ACCESS,ID=VTOKEN,MODE=READ,SIZE=VSIZEP OPEN THE OBJECT
LA R2,2 ERROR CODE
LTR R15,R15 ACCESS WORK OK ?
BZ LCLOSE1 * GOOD
CL R15,=F'4' RC=4
BNE CODE8
CLM R0,B'0011',=X'0037' REASON SHROPTIONS (1,3) THEN OK
BE GSHR CONTINUE
B LERROR ERROR
GSHR LA R2,4
B LERROR
CODE8 LA R2,8 ERROR CODE
LERROR ABEND (R2),DUMP TAKE A DUMP
When I run the program for an LDS dataset, I know that after DIV Access R15 has value 4 which is verified by statement CL R15,=F'4'
Now I also know that BE following CLM branches GSHR because abend is with U0004 RC.
Following is from abend dump.
Code:
IEA995I SYMPTOM DUMP OUTPUT 301
USER COMPLETION CODE=0004
TIME=11.24.29 SEQ=13538 CPU=0000 ASID=009A
PSW AT TIME OF ERROR 078D1000 80007D54 ILC 2 INTC 0D
ACTIVE LOAD MODULE ADDRESS=00007BF8 OFFSET=0000015C
NAME=MYDIV1
DATA AT PSW 00007D4E - 00181610 0A0D0000 00000000
AR/GR 0: 00000000/00000000_80000000 1: 00000000/00000000_80000004
2: 00000000/00000000_00000004 3: 00000000/00000000_00AD89D4
4: 00000000/00000000_00AD89B0 5: 00000000/00000000_00AFF5E8
6: 00000000/00000000_00ABFFE0 7: 00000000/00000000_FD000000
8: 00000000/00000000_00AFCAE8 9: 00000000/00000000_00AFF210
A: 00000000/00000000_00000000 B: 00000000/00000000_80007BF8
C: 00000000/00000000_87CB2CFA D: 00000000/00000000_00007D54
E: 00000000/00000000_80FDCAD8 F: 00000001/00000010_00000004
END OF SYMPTOM DUMP
My questions are,
1. For CLM instruction as seen from above dump, R0's right most two bytes with x'0000' are compared with a value x'0037' and they are not equal. So why does the BE next transfers control to GSHR location?
2. Where can I find possible return codes such as what register is populated with what value for DIV service calls? I am looking into assembler service guide that describes DIV but it doesn't say there about return codes in registers.
Joined: 05 Feb 2007 Posts: 199 Location: Sri Lanka
I can provide the entire program if anybody needs to see it.
In the mean time I found some answers to the 2nd question which is, DIV erros end with system code 08B and register 15 contains reason code. Last two bytes of reason code determine what the error is and their description with S08B is in MVS System codes pdf.
I am still looking for answers to the first question though.
Also looks like DB2 doesn't use DIV to read LDS. I wonder what technique DB2 uses.
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
I've looked anbd the only thing I can see is something like the literal X'0037' being overlaid by low values...
Or reg 2 already had a 4 in it and the BE did not branch but the B to LERROR did.
Should "CODE8 LA R2,8 ERROR CODE" be between the two branches?
Joined: 05 Feb 2007 Posts: 199 Location: Sri Lanka
Hi,
Sorry for late reply, I got held up in something.
Anyway, Cicsguy I don't understand how this is possible,
Quote:
"reg 2 already had a 4 in it and the BE did not branch but the B to LERROR did.
"
I tried adding "CODE8 LA R2,8 ERROR CODE" between two branches but it gave same error and logic flow.
Bill,
CHI works. But I since this is not my code and I am trying to understand someone else's code, I need to know why CLM doesn't. That will tell me what kind of values DIv access returns.
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
As hindsight is always 20/20, perhaps the "BE" pneumonic condition-code, does not apply to a "CLM" instruction, whereas, I known that a "BE" applies to "CHI", "CH", "CL" and "C" instructions. If this is true, then that's the reason the logic fell thru to the ABEND.
I lent my friend my handy-dandy instruction-set pamphlet and the dirty rat still has it. Thanks for reminding me about it.
You should review the "Principles of Operation" manual and the "CLM" instruction and associated CC's.
Joined: 05 Feb 2007 Posts: 199 Location: Sri Lanka
Bill,
Coverting X'0037' to X'00000037' does make it work as CHI. and it dumps with RC=2
I suppose when you said,
Quote:
it should follow the "BE" logic path.
you meant it should not follow "BE" logic path.
Because it followed BE path with X'0037' before. Thats why in code in post in top abended with RC=04 as seen in dump.
About the existing code, it does work. Following is the cut-paste from the original code.
Code:
DIV ACCESS, X
ID=GWA_ID, ADDRESS OF ID-TOKEN X
SIZE=GWA_BLKS, SIZE OF DATASET IN BLOCKS X
MF=(E,LWI_ACC)
STM R15,R1,GWA_DVRC
LTR R15,R15 ZERO ?
BZ INIT0790 YES, CONTINUE
CL R15,=F'4' RC=4
BNE INIT0720
CLM R0,B'0011',=X'0037' REASON SHROPTIONS (1,3) THEN OK
BE INIT0790 CONTINUE
B INIT0780 ERROR
As seen, his intention is, if DIV Access ends with 0 in R15 then its OK or if R15 has 04 then if SHROPTIONS (1,3) on the LDS dataset which I guess puts some values in R0 then OK. This second condition he checks using CLM.
Following is what the POp book says on CLM
Quote:
The COMPARE LOGICAL CHARACTERS UNDER
MASK (CLM) instruction provides a means of comparing
bytes selected from a general register to a
contiguous field of bytes in storage. The M3 field of
the CLM instruction is a four-bit mask that selects
zero to four bytes from a general register, each mask
bit corresponding, left to right, to a register byte. In
the comparison, the register bytes corresponding to
ones in the mask are treated as a contiguous field.
The operation proceeds left to right.
...
Because the selected bytes are equal, condition
code 0 is set.
I am not sure why CLM works with BE in exactly opposite way than what above quote describes.