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?
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) -
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) -
Code:
LH R7,0(,R3)
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:
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.
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