× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Hi Aaron

The code referenced an older version of the QMHLJOBL API so I had to modify the code slightly (i.e. add dMicroSecSnt to dJLMsg data structure) - I am compiling to V5R3.

The reason you had to modify it is because the code was written improperly. Here's the data structure you posted:


    d dJLMsg          ds
    d  dOfsNext                     10i 0
    d  dOfsFrtn                     10i 0
    d  dNumRtn                      10i 0
    d  dMsgSvty                     10i 0
    d  dMsgId                        7
    d  dMsgType                      2
    d  dMsgKey                       4
    d  dMsgFile                     10
    d  dMsgLib                      10
    d  dDateSnt                      7
    d  dTimeSnt                      6
    d  dMicroSecSnt                  6

-- up to this point, it's correct --


    d  dReserve1                     2
    d  dOfsNFldR                    10i 0
    d  dLngFldRt                    10i 0
    d  dIdnFld                      10i 0
    d  dDataType                     1
    d  dDataSts                      1
    d  dReserve2                    14
    d  dDataLng                     10i 0
    D  dData                      1024

Bzzt... this part is wrong. The length of "dReserve1" can vary. It can change at any time without notice. You can't hard-code it to be 2 characters long and expect your code to always work!

You can call it one day and the API will tell you it's 2 this time around. Then you can say to yourself "hey, it's two! I'll hard-code that in my program." But then what happens if it's 10 the next time you call it? Or 14? Or any other number you can think of?

The length of the field varies. Because it varies, the starting position of all of the fields that come after it will also vary.

The only reason this program broke when you ran it on V5R3 is because the original programmer (Vadim Rozen, apparently) ignored the field (dOfsFrtn) that tells him where the dOfsNFldR field should start. If you used that field, the code would still work today on the latest release of i5/OS without changes.

Sigh... would you like a better example? It'd be easier for me to write the code from scratch than it would be to fix this one.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.