000419 CALL "M$ALLOC" USING IMG-ROW-SIZE, 000420 IMG-ROW-PTR, 000421 SET ADDRESS OF IMG-ROW TO IMG-ROW-PTR,Where IMG-ROW is an array in the linkage section.
id division.
program-id. malloctest.
data division.
working-storage section.
77 img-row-ws pic x(50).
77 img-row-ptr usage handle.
linkage section.
01 img-row.
03 filler pic x occurs 50.
procedure division.
main-logic.
set address of img-row to address of img-row-ws.
move "Message 1" to img-row.
display img-row.
move "Message 2" to img-row.
display img-row-ws.
move "Message 3" to img-row-ws.
display img-row.
move "Message 5" to img-row-ws.
CALL "M$ALLOC" USING length of img-row,
IMG-ROW-PTR,
SET ADDRESS OF IMG-ROW TO IMG-ROW-PTR,
move "Message 4" to img-row.
display img-row.
display img-row-ws.
move "Message 6" to img-row-ws.
move "Error" to img-row.
display img-row-ws.
The output of program is:
Article ID: 60
Created: August 31, 2009
Last Updated: August 31, 2009
Author: Support KB Author
Online URL: https://support.veryant.com/phpkb/article.php?id=60