× 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.



I am trying to make use of the QMHLJOBL API so I can output a job log to a
file in the IFS.  I seem to be having troubles calling some sample code I
found on the net (http://www.mcpressonline.com/ftp/prog/99/990303.txt).  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.
 
Anyways, I am getting junk data (i.e. dDataLng=1077952576) and from what I
understand means that blanks are being placed in that integer field.  Below
is the url for QMHJOBL and the datastructure I have created to match it.
<http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/apis
/QMHLJOBL.htm>
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/apis/
QMHLJOBL.htm  (LJOB0100 Format)
 
     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
     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
 
 
 
Can anybody see where I may have gone wrong in the above data structure?
Aaron Bartell
 
 
 
Here is the whole program for reference purposes.
 
      ***********************************************************
      * BEGIN MEMBER RCVJLMSG, TYPE RPGLE
      ***********************************************************
      *===============================================================
      * Module ID     -   RCVJLMSG
      * Module Name   -   Receive Job Log Messages
      * Programmer    -   Vadim Rozen, Mitsubishi Caterpillar forklift
      *===============================================================
      * This program receives messages from a job log.
      *===============================================================
      * To compile:
      *
      *      CRTRPGMOD  MODULE(AARONLIB/RCVJLMSG) SRCFILE(AARONLIB/COX)
DBGVIEW(*ALL)
      *
      *===============================================================
 
     h  Debug
      * ********************************************************************
      * Main Procedure prototype
      * *Entry Parameter List
      * ********************************************************************
      /copy cox,rcvjlmsgp
      *
     d RCVJLMSG        pi
     d  iJob                         26
     d  iAction                      10
     d  iDirection                    1
     d  oMessage                   1126
     d  oReturn                      10
      * ********************************************************************
      * Work fields
      * ********************************************************************
     d UsrSpc          s             20
     d USText          s             50
     d USpSize         s             10i 0 inz(1024)
     d ExtAttr         s             10    inz('FFINFO')
     d IntValue        s              1
     d Authority       s             10    inz('*ALL')
     d Replace         s             10    inz('*YES')
     d Offset          s             10i 0
     d Size            s             10i 0
     d Exit            s              1n
     d Error           s              1n
     d CurMsg          s              2  0
     d SavMsgKey       s              4
      * Format name
     d Format1         s              8    inz('LJOB0100')
      * Message selection information
     d dRcvInfo        ds
     d  dMaxMsgReq                   10i 0 inz(11)
     d  dListDir                     10    inz('*NEXT')
     d  dJob                         26    inz
     d   dJobName                    10    overlay(dJob:1)
     d   dUserName                   10    overlay(dJob:11)
     d   dJobNum                      6    overlay(dJob:21)
     d  dIntJobId                    16    inz
     d  dStrMsgKey                    4    inz(X'00000000')
     d  dMaxMsgL                     10i 0 inz(1024)
     d  dMaxMHlpL                    10i 0 inz(0)
     d  dOffset                      10i 0 inz(84)
     d  dNumFldRtn                   10i 0 inz(1)
     d  dOfsMsgQNm                   10i 0 inz(88)
     d  dLngMsgQNm                   10i 0 inz(1)
     d  dIndRtn                      10i 0 inz(302)
     d  dMsgQuName                   10    inz('*')
      * Size of Message selection information
     d MSLng           s             10i 0 inz(%size(dRcvInfo))
      * Format of message selection information
     d Format2         s              8    inz('JSLT0100')
      * Error data structure
     D dError          ds
     D  dBytPrv                      10i 0 inz(116)
     D  dBytAva                      10i 0
     D  dErrMId                       7
     D  dErr##                        1
     D  dErrDta                     100
      *
      * User Space Header offset, length and data structure
     d Position        s             10i 0 inz(125)
     d Length          s             10i 0 inz(%size(dHeader))
      *
      * List Header
     d dHeader         ds
     d  dUSOffset                    10i 0
     d  dUSLSize                     10i 0
     d  dUSNumEnt                    10i 0
     d  dUSElmSize                   10i 0
      *
      * Job Log Message
     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
     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
 
     d temp            s           1126    inz
      *
************************************************************************
      * Prototypes
      * ********************************************************************
      *
      * Create User Space
     d CrtUsrSpc       pr                  ExtPgm('QUSCRTUS')
     d                               20
     d                               10
     d                               10i 0
     d                                1
     d                               10
     d                               50
     d                               10
     d                              116
      *
      * Receive List of Job Log Messages
     d JobLogMsg       pr                  ExtPgm('QMHLJOBL')
     d                               20
     d                                8
     d                               80
     d                               10i 0
     d                                8
     d                              116
      *
      * Get User space Header
     d GetUsSpc        pr                  extpgm('QUSRTVUS')
     d                               20
     d                               10i 0
     d                               10i 0
     d                               16
     d                              116
      * ********************************************************************
      * Constants
      * ********************************************************************
      * User space name and text
     d C#UsrSpc        c                   CONST('JOBLOGMSG QTEMP     ')
     d C#USpText       c                   const('Job Log Messages')
     d C#Max           c                   const(5)
      *
************************************************************************
      * Main Line
      *
************************************************************************
      *
     c                   If        Error = *Off
     c                   ExSr      Sb1000
     c                   EndIf
      *
      * End of program
     c                   ExSr      Sb9999
      *
     c                   Return
      *
************************************************************************
      * Main Process
      *
************************************************************************
     c     Sb1000        BegSr
      *
     c                   Eval      Exit = *Off
     c                   Eval      Error = *Off
     c                   Eval      dJob = iJob
     c                   Eval      oReturn = *Blank
      *
      * Receive C#Max messages into User Space
     c                   DoW       not Exit and not Error
     c                   If        iAction = '*NEW' or
     c                             CurMsg = C#Max
     c                   ExSr      Sb1100
      *
      * Receive User Space Header
     c                   If        not Error
     c                   ExSr      Sb1200
     c                   EndIf
     c                   EndIf
      *
      * Receive message details
     c                   If        not Error
     c                   ExSr      Sb1300
     c                   EndIf
     c                   EndDo
      *
     c                   EndSr
      *
************************************************************************
      * Receive 11 messages into User Space
      *
************************************************************************
     c     Sb1100        BegSr
      *
      * Receive Last Message First.
     c                   If        iAction = '*NEW' and iDirection = 'B'
     c                   Eval      dListDir  = '*PRV'
     c                   Eval      dStrMsgKey = *Blank
     c                   EndIf
      *
     c                   Callp     JobLogMsg(UsrSpc:Format1:dRcvInfo:
     c                                       MSLng:Format2:dError)
      * Go to error handling routine
     c                   If        dErrMId <> *Blank
     c                   Eval      oMessage = dErrMID + dErrDta
     c                   Eval      oReturn = '*ERROR'
     c                   Eval      Error = *On
     c                   Else
     c                   Eval      SavMsgKey = *Blank
     c                   EndIf
      *
     c                   EndSr
      *
************************************************************************
      * Receive User Space Header
      *
************************************************************************
     c     Sb1200        BegSr
      *
     c                   CallP     GetUsSpc(UsrSpc:Position:Length:
     c                                      dHeader:dError)
      * Go to error handling routine
     c                   If        dErrMId <> *Blank
     c                   Eval      oMessage = dErrMID + dErrDta
     c                   Eval      oReturn = '*ERROR'
     c                   Eval      Error = *On
     c                   EndIf
      *
      * Receive 1st Message from User Space
     c                   Eval      Size = %Size(dJLMsg)
     c                   Eval      Offset = dUSOffset + 1
     c                   Eval      CurMsg = 0
      *
     c                   EndSr
      *
************************************************************************
      * Receive message details
      *
************************************************************************
     c     Sb1300        BegSr
      *
     c                   Do
     c                   Eval      CurMsg = CurMsg + 1
     c                   CallP     GetUsSpc(UsrSpc:Offset:Size:
     c                                       dJLMsg:dError)
     c                   CallP     GetUsSpc(UsrSpc:Offset:Size:
     c                                      temp:dError)
      * Go to error handling routine
     c                   If        dErrMId <> *Blank
     c                   Eval      oMessage = dErrMID + dErrDta
     c                   Eval      oReturn = '*ERROR'
     c                   Eval      Error = *On
     c                   EndIf
      *
      * Last Message have been processed
     c                   If        CurMsg = C#Max
     c                   Leave
     c                   EndIf
      *
      * If message key is repeated - no more messages exist in job log
     c                   If        SavMsgKey = dMsgKey
     c                   Eval      Exit = *On
     c                   Eval      oReturn = '*ENDOFJLOG'
     c                   Eval      *InLr = *On
     c                   Leave
     c                   EndIf
      *
     c                   Eval      SavMsgKey = dMsgKey
     c                   Eval      dStrMsgKey = dMsgKey
      *
      * Exit, if required message types has been received.
     c                   Eval      Exit = *On
     c                   If        dDataLng > %Size(dData)
     c                   Eval      dDataLng = %Size(dData)
     c                   Eval      oReturn = '*OVERFLOW'
     c                   EndIf
 
     c                   Eval      oMessage = dJLMsg
      *
      * No more messages in user space
     c                   If        dOfsNext = 0
     c                   Leave
     c                   EndIf
      *
      *
      * Get next offset position
     c                   Eval      Offset = dOfsNext + 1
     c                   EndDo
      *
     c                   EndSr
      *
************************************************************************
      * End of program
      *
************************************************************************
     c     Sb9999        BegSr
      *
     c                   If        Error or
     c                             oReturn = 'ENDOFJLOG'
     c                   Eval      *InLr = *On
     c                   EndIf
      *
     c                   EndSr
      *
************************************************************************
      * Initialize variables
      *
************************************************************************
     c     *InzSr        BegSr
      *
     c                   Eval      UsrSpc = c#UsrSpc
     c                   Eval      USText = C#USpText
      *
      * Create User space
     c                   Callp     CrtUsrSpc(UsrSpc:ExtAttr:USpSize:IntValue
     c                                     :Authority:USText:Replace:dError)
      * Go to error handling routine
     c                   If        dErrMId <> *Blank
     c                   Eval      oMessage = dErrMID + dErrDta
     c                   Eval      oReturn = '*ERROR'
     c                   Eval      Error = *On
     c                   EndIf
      *
     c                   EndSr
      ***********************************************************
      * END MEMBER RCVJLMSG
      ***********************************************************   

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.