ca.portal.admin

Re:Re: Get storage

Discussion created by ca.portal.admin on Jul 23, 2009
Kay,

The following program will allocate a variable length of storage, move a
literal into it and then issue a task snap. You can then use OLP and view
the task snap and find the piece of allocated storage.

You can compile it as is using COBOL=2 and link it just like any other
COBOL/LE program.

For what you need to do, if I have understood correctly, you would issue the
GET STORAGE, build the XML buffer as you want it and then issue a PUT
SCRATCH pointing at the constructed storage.

If your task is going to terminate immediately, then you can allow task
management to free the allocated storage. If your task is going to continue
executing, then you may want to code a FREE STORAGE after the PUT SCRATCH
returns to you. Of course, all this would be based upon successful
completion return codes from the IDMS interface.

Good Luck,
Chuck

*RETRIEVAL

*DMLIST

IDENTIFICATION DIVISION.
PROGRAM-ID. TCBLGSTG.
ENVIRONMENT DIVISION.
IDMS-CONTROL SECTION.
PROTOCOL.
MODE IDMS-DC DEBUG.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 FILLER PIC X(16) VALUE 'WORKING STORAGE'.
01 PROGRAM-WORK-FIELDS.
05 WS-COMMAND-LENGTH PIC S9(08) COMP VALUE ZERO.
05 WS-SQL-BUFFER-POINTER USAGE POINTER.
05 WS-EDITED-NUMBER PIC 9(08) USAGE DISPLAY.
01 COPY IDMS SUBSCHEMA-CTRL.
LINKAGE SECTION.
01 SQL-COMMAND.
05 SQL-BUFFER-LENGTH PIC S9(04) COMP.
05 SQL-COMMAND-STRING.
10 SQL-COMMAND-CHAR PIC X(01)
OCCURS 0 TO 10000 TIMES
DEPENDING ON WS-COMMAND-LENGTH.
PROCEDURE DIVISION USING
SQL-COMMAND.
MAIN-PROGRAM-ENTRY SECTION.
MAIN-ENTRY.
MOVE 50000 TO WS-COMMAND-LENGTH.
GET STORAGE FOR SQL-COMMAND
VALUE LOW-VALUE
LOCATION ANY.
MOVE WS-COMMAND-LENGTH TO SQL-BUFFER-LENGTH,
WS-EDITED-NUMBER.
MOVE SPACES TO SQL-COMMAND-STRING.
STRING 'THIS IS THE SQL COMMAND BUFFER' DELIMITED BY SIZE,
' AND IT IS ' DELIMITED BY SIZE,
WS-EDITED-NUMBER DELIMITED BY SIZE,
' BYTES LONG' DELIMITED BY SIZE
INTO SQL-COMMAND-STRING.
SNAP TASK.
DC RETURN.
GOBACK.
MAIN-EXIT. EXIT.
COPY IDMS IDMS-STATUS.
IDMS-ABORT SECTION.
IDMS-ABORT-EXIT. EXIT.

Outcomes