Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HELP: How to calculate Data Structure allocated memory size?

0 views
Skip to first unread message

kelvin

unread,
Nov 13, 2009, 3:55:40 AM11/13/09
to
>>>>>
DCL 1 CONTROL_BLOCK,
02 CALL_TYPE BIN FIXED (7) INIT (0),
02 CB_RESERVER BIN FIXED (7) INIT (0),
02 COMMAND_CODE CHAR (2) INIT (' '),
02 COMMAND_ID CHAR (4) INIT (' '),
02 FILE_NUMBER BIN FIXED (15) INIT (1101),
02 RESPONSE_CODE BIN FIXED (15) INIT (0);
>>>>>

I want to look through the 'CONTROL_BLOCK' spec info in the memory,
and I can get the start memory address of 'CONTROL_BLOCK' by the way
of addr(CONTROL_BLOCK), but i do not know where is end of memory
address.

Is there any function to calculate 'CONTROL_BLOCK' structure allocated
memory size?

Many Thanks,
Kelvin

Tim E. Sneddon

unread,
Nov 13, 2009, 11:05:05 AM11/13/09
to

The BYTESIZE built-in should do the trick. Maybe something like:

PUT SKIP LIST('The size of CONTROL_BLOCK is', BYTESIZE(CONTROL_BLOCK));

Tim.

Peter Flass

unread,
Nov 13, 2009, 4:58:23 PM11/13/09
to

I usually stick something like "02 end_of_control_block char(0);" as the
last item, both to give me the end address and also to have all the
"real" declarations end with a comma, to avoid a silly syntax error if I
want to add something at the end and forget to change the ';" to a "'"
on the preceeding item.

Tim's "BYTESIZE" builtin is probably "STORAGE" or "SIZE" if this is IBM,
or you could compute it using "addr(end_of_control_block) -
addr(control_block)"

Peter Flass

unread,
Nov 13, 2009, 4:58:59 PM11/13/09
to

I usually stick something like "02 end_of_control_block char(0);" as the

kelvin

unread,
Nov 16, 2009, 3:33:05 AM11/16/09
to

It is very useful.

Thanks guys!

Best regards,
Kelvin

0 new messages