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

PL1 CHAR limit is 32767, but I need more long string type

791 views
Skip to first unread message

Ricky WU

unread,
Jan 6, 2010, 5:11:33 AM1/6/10
to
Hi All

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!

Jessica Colman

unread,
Jan 6, 2010, 6:42:12 AM1/6/10
to
Is the MQ message of type XML? In this case I would recommend you define
an array like this

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:

Ricky WU

unread,
Jan 6, 2010, 7:01:35 AM1/6/10
to
On 1月6日, 下午7时42分, Jessica Colman <jessica.col...@augustakom.net>
wrote:

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!

robin

unread,
Jan 6, 2010, 10:06:19 AM1/6/10
to
"Ricky WU" <rich...@live.com> wrote in message
news:0d5bed67-7c15-49bb...@a21g2000yqc.googlegroups.com...

| Hi All
|
| PL1 type CHAR's largest length is 32767,

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!


Peter Flass

unread,
Jan 6, 2010, 7:33:06 PM1/6/10
to

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.

Ricky WU

unread,
Jan 7, 2010, 12:40:52 AM1/7/10
to

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

Ricky WU

unread,
Jan 7, 2010, 12:50:36 AM1/7/10
to
On Jan 7, 8:33 am, Peter Flass <Peter_Fl...@Yahoo.com> wrote:
>
> 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.

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.

Ricky WU

unread,
Jan 7, 2010, 1:30:51 AM1/7/10
to
On Jan 6, 6:11 pm, Ricky WU <richi...@live.com> wrote:

I tested again with REGION=8M, it work now, thank you very much!

robin

unread,
Jan 7, 2010, 9:59:45 AM1/7/10
to
"Ricky WU" <rich...@live.com> wrote in message news:d00e977a-5d76-4d3d...@j1g2000vbm.googlegroups.com...

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.


Ricky WU

unread,
Jan 8, 2010, 1:28:41 AM1/8/10
to
On 1月7日, 下午10时59分, "robin" <robi...@bigpond.com> wrote:
> "Ricky WU" <richi...@live.com> wrote in messagenews:d00e977a-5d76-4d3d...@j1g2000vbm.googlegroups.com...

Yes, on mainframe, I need change default REGION size larger than 4M.

0 new messages