Joined: 06 Jun 2008 Posts: 8280 Location: Dubuque, Iowa, USA
1. The length of a single item is limited to 32763 bytes. If you are attempting to write out more than 32763 bytes, split the queue record into multiple items and write each separately. If you have to use TS queues, you cannot exceed this limit.
2. ITEMERR means you've written 32767 items (or you are attempting to write an item number greater than 32767 at least). Keep the number of items on a TS queue under 32768, period. If you have more to write, use another queue name!
Joined: 14 Jan 2008 Posts: 2504 Location: Atlanta, Georgia, USA
There was a method to my madness regarding the length of an ITEM. You could define an array copybook -
03 TSQ-COPYBOOK-SUB PIC 9(04) COMP VALUE ZERO.
03 TSQ-COPYBOOK-SUB-MAX PIC 9(04) COMP VALUE ZERO.
03 TSQ-COPYBOOK-ITEM-NBR PIC 9(08) COMP VALUE ZERO.
05 TSQ-COPYBOOK-ARRAY-ITEM OCCURS 655 TIMES PIC X(50).
DIVIDE LENGTH OF TSQ-COPYBOOK-ARRAY-REC BY LENGTH OF TSQ-COPYBOOK-ARRAY-ITEM (1)
As you add an item to the ARRAY-ITEM TABLE, you bump COPYBOOK-SUB by 1, providing that COPYBOOK-SUB-MAX has not been exceeded and you issue a WRITEQ or WRITEQ REWRITE. If COPYBOOK-SUB has exceeded COPYBOOK-SUB-MAX, then you're finished with that ITEM (let's say, number 1) and now you use the COPYBOOK to build ITEM number 2 and so on and so on.
Subsequently, you could wind up with the max of 32767 items/records which (in this example) are each 32758 bytes long (655 * 50) + 8.
Always define the TSQ-COPYBOOK-ITEM-NBR as a binary-fullword (as illustrated) so you can avoid all high-order truncation as you would with a binary-halfword, which could truncate (depending on the TRUNC option) when the value exceeds 9999.
However, you may not need the TSQ-ITEM-NBR but, I thought I'd throw it in for good measure.