|
View previous topic :: View next topic
|
| Author |
Message |
Douglas Allen
New User

Joined: 24 Jul 2012 Posts: 10 Location: United States
|
|
|
|
Ok, I've been programming COBOL 17 years. I have very little assembler exposure, but I have a situation requiring some assembler code. SO.....
I am moving some data to an area in DSECT OUTREC. I have coded this:
| Code: |
USING OUTREC,R11
LA R11,OUTREC
LA R6,OFIXEDR
LA R7,3004
LR R8,R3
LA R9,3004
MVCL R6,R8 |
And my DSECT is at the bottom of the program:
| Code: |
OUTREC DSECT
OFIXEDR DS 0H
OFXRDW DS H
DC H'0'
OFIXED DS CL3000
ODCTR DS CL250 |
When the program executes the MVCL, I get S0C4. Abendaid gives me nothing. I know it is the MVCL command from using Expeditor. Again, I've been working off of example and reading information on assembler programming from various sources. Thoughts?
Thanks in advance! |
|
| Back to top |
|
 |
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
- Your length registers are set to 3004, but the actual length - at least the length of the target - is 3000.
- The source address is in reg 3, which you copied to reg 8 before the MVCL. Is reg 3 correct??
- Look at the registers. What is in registers 7 and 9? Their contents will give you a good idea how far the MVCL progressed before the ABEND.
|
|
| Back to top |
|
 |
PeterHolland
Global Moderator

Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
@steve, 2 halfwords + 3000 = 3004
Your coding should be something like this:
| Code: |
load R11 with the adress of storage (getmained)
USING OUTREC,R11
LA R11,OUTREC remove this statement |
|
|
| Back to top |
|
 |
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
| PeterHolland wrote: |
@steve, 2 halfwords + 3000 = 3004 ...
|
Oops - my bad.
If Mr. Holland is correct, then move the actual length
| Code: |
LH 7,0(,3)
LR 9,7
or
LH 9,0(,3)
LA 7,3004 |
|
|
| Back to top |
|
 |
PeterHolland
Global Moderator

Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
This problem has nothing to do with lengths, but loading R11 with a DSECT address, and what is that?
And its not IF Mr. Holland is correct,it is OF COURSE. |
|
| Back to top |
|
 |
Bill O'Boyle
CICS Moderator

Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
FWIW to Mr. Allen, if the length exceeds 4095, you'll get an Assembly failure. Instead of a LA, use a LHI (Load Halfword Immediate), which has a maximum of 32767 and you'll be golden, unless the length exceeds 32767.
I've yet to find a Load Fullword Immediate in the POPS manual, then you could substitute this for both a LA and LHI.
The L' could also come in handy -
| Code: |
LHI R7,L'OFIXED+4
LR R9,R7
|
Or as Steve has posted (and this is a variable-length DSECT) -
HTH.... |
|
| Back to top |
|
 |
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
| Bill O'Boyle wrote: |
FWIW to Mr. Allen, if the length exceeds 4095, you'll get an Assembly failure. Instead of a LA, use a LHI (Load Halfword Immediate), which has a maximum of 32767 and you'll be golden, unless the length exceeds 32767.
I've yet to find a Load Fullword Immediate in the POPS manual, then you could substitute this for both a LA and LHI.
The L' could also come in handy -
| Code: |
LHI R7,L'OFIXED+4
LR R9,R7
|
Or as Steve has posted (and this is a variable-length DSECT) -
HTH.... |
- L'OFIXED = 2
- L reg,=A(length-value)
- We don't really know what reg 3 is pointing to. It seems to me the odds are it is a record read by a locate mode GET macro:
You see exactly that quite often in my code. |
|
| Back to top |
|
 |
PeterHolland
Global Moderator

Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Bill and steve, OUTREC has a length of 3004. Nothing variable here. But the TS does a LA of a DSECT in R11, so R11 will contain zero.
As far as I see it this will give a nice S0C4.
By the way loading a register with a fullword will bypass the 32767 limit.
And it would be nice if the TS showed some more code, so steve's question about R3 could be solved. |
|
| Back to top |
|
 |
Muralidhara V
New User
Joined: 10 Apr 2014 Posts: 1 Location: India
|
|
|
|
Hey Douglas,
MVCL R6,R8
This instruction moves data from the address pointed by R8 to the address pointed by R6. The values in R7 and R9 indicate the destination and source lengths respectively.
In this case, R6 doesn't seem to have a a proper virtual address.
LA R6,OFIXEDR will not load a proper address into R6. Because DSECT doesn't have a physical memory like any other working storage variables outside DSECT. The DSECTs are just the layouts without virtual storage allocated.
SOC4 occurs when we try to manipulate any part of the address space not available to user program. In this case, I guess R6 has 0, which is obviously the core system area of the address space, which your program should never manipulate.
Solution : GETMAIN a virtual storage of 3004 bytes (or a little more). Code the required parameter to get the allocated address directly into R6 (Please refer the syntax of GETMAIN for the same). Then code the following
USING OUTREC,R6 ** Map the address in R6 with a layout
LA R7,3004 ** Load destination length
LR R8,R3 ** Load source address
LR R9,R7 ** Load source length. Using LR as source length == Dest. length
MVCL R6,R8 ** Now move
Thanks.. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|