fixed a bunch of minor issues with zero-length items leading to a stacktrace
Please also have a look at the missing handling of a NULL
address.
For a possible testcase:
DATA DIVISION.
WORKING-STORAGE SECTION.
01 DYNBUFFER-LEN USAGE BINARY VALUE ZERO.
LINKAGE SECTION.
01 DYNBUFFER.
05 FILLER OCCURS UNBOUNDED
DEPENDING ON DYNBUFFER-LEN
PIC X.
*> cp DYNBUFFER here, should raise an error
MOVE 12345 TO DYNBUFFER-LEN
*> cp DYNBUFFER here, should raise an error
ALLOCATE LENGTH OF DYNBUFFER CHARACTERS RETURNING DYNBUFFER
*> cp DYNBUFFER here, should be fine
MOVE 0 TO DYNBUFFER-LEN
*> cp DYNBUFFER here, should print an empty string