
GETMAIN limitations in COBOL??
You've Acquired 10000 Bytes via the GETMAIN but, the COBOL Compiler is going
to generate an In-Line MVCL for 10000000 Bytes or even possibly issue a BALR
to a COBOL Run-Time Routine. The Compiler doesn't know you've only Acquired
10000 bytes ! Therefore, when the microcode hits byte 10001, you're going
down with a S0C4 (Protection Exception), because you don't have
addressability past byte 10000. My advice is to define an S9(09) BINARY
field, move 10000 to it (or LENGTH OF FIELD-1 or FIELD-2), issue the
GETMAIN's using this fullword and then perform the MOVE, using the fullword
as the length-portion of a REFERENCE-MODIFICATION move.
03 WS-FLENGTH PIC S9(09) BINARY VALUE +10000.
getmain done here....
MOVE FIELD-1 TO FIELD-2 (1:WS-FLENGTH).
You won't need the reference modification in the sending field if you're
starting at byte-01.
Unless you have a good reason NOT to Acquire Storage above the line, use the
FLENGTH parameter in the GETMAIN.
HTH....
WOB
Quote:
> I am using CICS supplied GETMAIN/FREEMAIN commands to dynamically
> allocate and release memory in my programs.
> I ran into the following problem and did not know what caused it,
> my linkage section has two fields defined like this
> LINKAGE SECTION
> 01 FIELD-1 PIC X(10000000).
> 01 FIELD-2 PIC X(10000000).
> PROCEDURE DIVISION
> .
> .
> ** i did EXEC CICS GETMAIN on the 2 fields for 10000 bytes each.
> **(which means only 10000 bytes of each of the fields are addressable
> **then subsequently i coded this.
> MOVE FIELD-1 TO FIELD-2
> *While I tested this code in XPEDITOR CICS suspended my task
> indefinitely on the above 'MOVE'
> Looked to me like CICS (or COBOL or XPEDITOR) was attempting to move
> the whole of 10000000 declared in the picture clause from FIELD-1 TO
> FIELD-2 instead of the 10000 bytes that I acquired thru. GETMAIN ( and
> since it could not get the 10 megabytes of storage it just suspended
> the task??)
> I had to bounce the CICS region before we could execute any other
> transaction in the region.
> Any light into this topic is appreciated.
> krishna.
> Sent via Deja.com http://www.deja.com/
> Before you buy.