PL1 type CHAR's largest length is 32767, but I need define a string
type which largest length is 4M bytes to store MQ messages.
I tried use AREA type, but I also need use SUBSTR and INDEX and
other functions to find/process sub strings from MQ messages, is
there any solution for this problem?
Thank you in advance!
dcl 1 mqdata(125),
3 mqchar char(32000);
an parse it with PLISAXA or PLISAXC and forget about INDEX and SUBSTR.
Jessica
Ricky WU schrieb:
I don't thinks it's XML type.
The MQ message send to mainframe, it's largest length is 4M bytes and
store in a queue,
each time we fetch from queue will get a buffer which largest length
is 4M's
So we can't separate the message into any pieces, maybe a truncation
will happen when cut tags, like:
1.. 32000 32001 32002 ...
X...S T A R T
if we store into a char(32000), the START will be truncate.
I hope you got my point.
Rgds!
That limit is, of course, in IBM's compilers.
There is no limit in the PL/I language per se.
| but I need define a string
| type which largest length is 4M bytes to store MQ messages.
| I tried use AREA type, but I also need use SUBSTR and INDEX and
| other functions to find/process sub strings from MQ messages, is
| there any solution for this problem?
For IBM compilers, you can define an array of size 4M of single characters.
Use the STRING function to treat the array as a 4Mb string.
Then you can use SUBSTR and INDEX.
String functions such as INDEX, etc, return a FIXED BINARY (31)
result.
This was covered in a PL/I Newsletter (I think last year).
http://members.dodo.com.au/~robin51/pli-n10.htm
| Thank you in advance!
Can you use the ALLOCATE builtin - not the allocate statement,
Enterprise PL/I only. I think the limit is 4GB. To process long
strings like that I use a BASED nonvarying string of some useful length,
and just "float" it over the long string using pointer arithmetic, but
you could also use the PLIMOVE and COMPARE builtins.
Yes, I tried this:
DCL SYSPRINT FILE OUTPUT STREAM
PRINT;
OPEN FILE
(SYSPRINT);
DCL 01 INREC
(132),
03 LONG CHAR
(32000);
DCL RICKY CHAR
(10);
RICKY = SUBSTR(STRING(INREC),
1,10);
PUT SKIP EDIT(RICKY)
(A);
CLOSE FILE(SYSPRINT);
Compile with AMODE(31),RMODE(ANY),but got:
CEE0813S Insufficient storage was available to satisfy a get storage
I tried ALLOCATE built in, but compiler raise CHAR will be truncated
to size 32767 when allocation. :(
I should post an example of MQ messages:
|BGNMSG|CRLF
|RECORD|CRLF
|ENTRY1|CRLF
|RECORD|CRLF
|RECORD|CRLF
|ENTRY2|CRLF
|RECORD|CRLF
....
|ENDMSG|CRLF
ENTRYs are up to 100 per buffer, CRLF means one byte is carriage
return and line feed. All the buffer store in 4M byte(1024*1024*4).
If I use a BASED non varying string of some useful length, truncation
will be occurred, that not allowed.
I tested again with REGION=8M, it work now, thank you very much!
Yes, I tried this:
This is unrelated to this technique. You need to request run-time stack storage.
The default is insufficient.
On the PC, we use the STACK option.
Yes, on mainframe, I need change default REGION size larger than 4M.