HI, I am currently using AS400 adapter services to write message to the DataQueue to AS400 system and in return will read the response message from the DataQueue.

I am facing this difficulty: for both writeDataQ & readDataQ service, it is mandatory to provide the recordMetaData (DataName, DataType, DataLength) as the message definition.

For writting into Dataqueue is no issue. However, when reading the response message, I cannot pre-defined the data length that I will be reading. Because the response message could be of error message or other message format.

I tried to make if flexible by giving the bigger number of length but getting error ArrayIndexOutofBound.Exception. If I do not provide any length, the system complaint Manadatory field not fill.

Currently I always get the Error Response Message, which I believe is due to the data within header. I need to find a better approach for reading the incoming message . Anyone has any idea?