Hi Dieter,
Thank you for your response. What you describe is exactly what I used to do when reading from and writing to user spaces. PCML is not that bad for what I used it for, so far.
On the other hand, it might be quite meaningful, that I could not find real live PCML files in the RDi plugins. All I could find there were the well known examples:
QGYOLAUS
QSYRUSRI
QZNFRTVE
Plus another demo that I did not yet know:
TIME
Only these two entries seems to be real life examples:
ITLM
QRBUTIL
But of course these two PCML files do not use the "offset" attribute.
Too bad. Maybe that I should post the question again to the WDSCI-L mailing list.
Anyway have some nice Christmas days.
Regards,
Thomas.
-----Ursprüngliche Nachricht-----
Von: JAVA400-L [mailto:java400-l-bounces@xxxxxxxxxxxx] Im Auftrag von D*B
Gesendet: Sonntag, 30. November 2014 09:10
An: java400-l@xxxxxxxxxxxx
Betreff: Re: PCML how to properly call the QMHRDQM API
Hi Thomas,
I don't use PCML, (last time I've had a look to it, it allowed only int as return parm),
maybe the problem might be, that RQD0100 Format is using a dynamic structure (some sort of chained list) for the message data (each message has its own length).
My aproach is to use PORDS2POJO (plain old RPG datastructure [AKA binary huddle] to plain old java object) Beans.
For RQD100 it looked like:
<hint: as I only needed the header data, you would have to write another PORDS2POJO for the message entrie with its getters> <additional hint: these PORDS2POJO are only one way. bidirectional beans would have getHuddle() and setters for all needed components> <last hint: DataStructure is a convinience object used as a Facade for the strange (you could throw in all you want and it will burst, if you want to get it back) and ugly jt400 stuff>
best regards Dieter
public class RDQD0100Format extends DataStructure {
private byte[] huddle;
private int bytesReturned;
private int bytesAvailable;
private int messageLength;
private int keyLength;
private String sequence;
private String includeSenderId;
private String forceIndicator;
private String typeOfDataQ;
private String automaticReclaim;
private String description;
private int numberOfMessages;
private int numberOfEntriesAllocated;
private String dataQName;
private String dataQLibName;
private int maximumNumberOfEntriesAllowed;
private int initialNumberOfEntries;
private int maximumNumberOfEntriesSpecified;
public RDQD0100Format(byte[] huddle) {
super(500);
setHuddle(huddle);
}
public String getAutomaticReclaim() {
return automaticReclaim;
}
public int getBytesAvailable() {
return bytesAvailable;
}
public int getBytesReturned() {
return bytesReturned;
}
public String getDataQLibName() {
return dataQLibName;
}
public String getDataQName() {
return dataQName;
}
public String getDescription() {
return description;
}
public String getForceIndicator() {
return forceIndicator;
}
public String getIncludeSenderId() {
return includeSenderId;
}
public int getInitialNumberOfEntries() {
return initialNumberOfEntries;
}
public int getKeyLength() {
return keyLength;
}
public int getMaximumNumberOfEntriesAllowed() {
return maximumNumberOfEntriesAllowed;
}
public int getMaximumNumberOfEntriesSpecified() {
return maximumNumberOfEntriesSpecified;
}
public int getMessageLength() {
return messageLength;
}
public int getNumberOfEntriesAllocated() {
return numberOfEntriesAllocated;
}
public int getNumberOfMessages() {
return numberOfMessages;
}
public String getSequence() {
return sequence;
}
public String getTypeOfDataQ() {
return typeOfDataQ;
}
public void setHuddle(byte[] huddle) {
byte[] work;
this.huddle = huddle;
bytesReturned = aS400Bin4ToInt(huddle, 0);
bytesAvailable = aS400Bin4ToInt(huddle, 4);
messageLength = aS400Bin4ToInt(huddle, 8);
keyLength = aS400Bin4ToInt(huddle, 12);
work = new byte[1];
work[0] = huddle[16];
sequence = aS400TextToString(work);
work[0] = huddle[17];
includeSenderId = aS400TextToString(work);
work[0] = huddle[18];
forceIndicator = aS400TextToString(work);
work[0] = huddle[69];
typeOfDataQ = aS400TextToString(work);
work[0] = huddle[70];
automaticReclaim = aS400TextToString(work);
work = new byte[50];
System.arraycopy(huddle, 19, work, 0, 50);
description = aS400TextToString(work);
numberOfMessages = aS400Bin4ToInt(huddle, 72);
numberOfEntriesAllocated = aS400Bin4ToInt(huddle, 76);
work = new byte[10];
System.arraycopy(huddle, 80, work, 0, 10);
dataQName = aS400TextToString(work);
System.arraycopy(huddle, 90, work, 0, 10);
dataQLibName = aS400TextToString(work);
maximumNumberOfEntriesAllowed = aS400Bin4ToInt(huddle, 100);
initialNumberOfEntries = aS400Bin4ToInt(huddle, 104);
maximumNumberOfEntriesSpecified = aS400Bin4ToInt(huddle, 108);
}
}
--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/java400-l.
--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the
intended recipient only. Access, disclosure, copying, distribution, or
reliance on any of it by anyone else is prohibited and may be a criminal
offence. Please delete if obtained in error and email confirmation to the sender.
As an Amazon Associate we earn from qualifying purchases.