Subject: | |
From: | |
Reply To: | |
Date: | Wed, 24 Jan 2007 18:14:07 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
I am looking to dynamically reduce memory usage for a calling program and a
sub-program. The calling program reads in an HTTP message from a socket
and it reads, and sets the MESSAGE-LENGTH value based upon the length of
the received transaction.
Here's the calling program specifics:
01 MESSAGE-LENGTH PIC S9(9) COMP VALUE 0.
01 SOCKET-BUFFER.
05 FILLER PIC X OCCURS 1 TO 5000000 TIMES
DEPENDING ON MESSAGE-LENGTH.
...
CALL "SUBPRG" USING MESSAGE-LENGTH, SOCKET-BUFFER.
Here's the sub-program specifics:
LINKAGE SECTION.
01 MESSAGE-LENGTH PIC S9(9) COMP.
01 READ-SOCKET-BUFFER.
05 FILLER PIC X OCCURS 1 TO 5000000 TIMES
DEPENDING ON MESSAGE-LENGTH.
PROCEDURE DIVISION USING
MESSAGE-LENGTH, READ-SOCKET-BUFFER.
Questions:
Does COBOL pass the buffer to the sub-program by memory reference? In
other words, all that is passed is a memory reference to the buffer that both
the calling program and sub-program access. I am thinking yes.
Does the DEPENDING clause and value in MESSAGE-LENGTH determine the
actual allocation of memory?
Or is memory allocated to the maxium in the OCCURS no matter what the value
of MESSAGE-LENGTH?
Perhaps there's another more efficent way to dynamically allocate the
memory. Any advice would be much appreciated.
TIA.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|