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



Hello, Carel:

If you do a DSPPGM QLICKOBJ, you will see that it is meant
to be run in *SYSTEM state, with *SYSTEM domain. Therefore,
this is NOT one of the "open APIs" that IBM allows you to call
directly from your *USER state, *USER domain programs.

Just write a very small CL wrapper, you can use CLLE, and then
"bind" your little CL wrapper into your program, as needed, or
you can call an external OPM CLP program, either way.

Something like this:

    CHKOBJ:    PGM    PARM(&LIB &OBJ &TYP &EXISTS)
            DCL &LIB *CHAR 10
            DCL &OBJ *CHAR 10
            DCL &TYP *CHAR 10
            DCL &EXISTS *CHAR 1 /* indicator 0=false, 1=true */
            CHGVAR VAR(&EXISTS) VALUE('1') /* default=true */
            CHKOBJ OBJ(&LIB/&OBJ) OBJTYPE(&TYP)
            MONMSG MSGID(CPF0000) EXEC(DO)
                RCVMSG PGMQ(*SAME (*)) MSGTYPE(*EXCP) +
                        MSGKEY(*NONE) WAIT(0) RMV(*YES)
                CHGVAR VAR(&EXISTS) VALUE('0') /* false */
                ENDDO
            RETURN
            ENDPGM

Then, you just call this little routine, pass the arguments, and test
the result indicator.  This is the documented and supported way
to invoke ANY CL command, from within a HLL program. And,
by the way, in many cases, this is actually better than doing it via
QCMDEXC, because this little bit of code is "pre-compiled".

Why do you want to do this "the hard way"? You obviously went
to a lot of trouble to figure out the name of the CPP for CHKOBJ,
and the parameters to pass, etc., and for what? To try to save a few
microseconds?

Regards,

Mark S. Waterbury

----- Original Message -----
From: "Carel Teijgeler" <coteijgeler@chello.nl>
To: <midrange-l@midrange.com>
Sent: Tuesday, August 27, 2002 10:42 AM
Subject: CHKOBJ in RPG IV programme


All,

Before I start: excuses for the long post and I am on OS-release V4R5M0.

Recently I tried to implement a CHKOBJ like in RPG. To do that I used the
CPP of the CHKOBJ command and wrapped it in a procedure.

When I run a testprogramme and check for an existing object and an
nonexisting one I got a service dump with the test on the existing object,
with the non existing object the programme works as it is supposed to.

The joblog shows this (sorry for the Dutch language, it runs on my machine):

call testchk
Space offset X'00000000' or teraspace offset X'0000000000000000' is outside
current limit for object QPADEV0024ASQPGMR   117246.
Dump output directed to spooled file 3.
Functiefout opgetreden. MCH0601 niet voorzien door QSYCNV bij
programma-instructie *N, systeeminstructie X'000B'.
DSPLY  CPF9999
Object testpgm in bibliotheek *LIBL is niet gevonden.
DSPLY  CPF9801

The same error occurs, when you call the CPP directly in CL and do not use
the CDO of CHKOBJ.

Why does the CPP of CHKOBJ dumps on a test for an existing object and works
properly on non existing ones?
Should this not occur when using the CDO of CHKOBJ as well?

Below follows the source of my test programme. (Testing for %error gives the
same result, I tested that later).

TIA,
Carel Teijgeler

Source:

     H DFTACTGRP(*NO)
****************************************************************************
******************
     D ChkObj          PR             7
     D   Object                      10    CONST
     D   ObjType                      7    CONST
     D   Member                      10    CONST
      *
     D MsgID           S              7
****************************************************************************
******************
      * API Error Data structure
****************************************************************************
******************
     D APIErr          DS
     D   ErrBPrv               1      4B 0          INZ(148)
      *                                             Bytes Provided
     D   ErrBAvl               5      8B 0
      *                                             Bytes Available
     D   ErrMsgID              9     15
      *                                             Exception Id
     D   ErrRsv1              16     16
      *                                             Reserved
     D   ErrMsgDta            17    148
      *                                             Message Text
****************************************************************************
******************
     C                   Eval      MsgID = ChkObj('ARBS':'FILE':'*FIRST')
      *
     C     MsgID         DsPly
      *
     C                   Eval      MsgID = ChkObj('testpgm':'PGM':'*NONE')
      *
     C     MsgID         DsPly
      *
     C                   Return
****************************************************************************
******************
      *
****************************************************************************
******************
     P ChkObj          B
      *
     D ChkObj          PI             7
     D   Object                      10    CONST
     D   InType                       7    CONST
     D   InMember                    10    CONST
      *
     D FullObj         S             20    INZ('          *LIBL     ')
     D Aut             S             10    INZ('*NONE')
     D ObjType         S              7
     D Member          S             10
****************************************************************************
******************
      * Change Exception Message - Prototype
****************************************************************************
******************
     D ChgExcMsg       PR                  EXTPGM('QMHCHGEM')
     D   MsgInvPtr                     *   CONST
     D   MsgCallStC                   9B 0 CONST
     D   MsgMsgKey                    4    CONST
     D   MsgModOpt                   10    CONST
     D   MsgRpyTxt                    1    CONST
     D   MsgRpyLen                    9B 0 CONST
     D   APIErr                     148
****************************************************************************
******************
      * Receive Programme Message - Prototype
****************************************************************************
******************
     D RcvPgmMsg       PR                  EXTPGM('QMHRCVPM')
     D   MsgMsgInf                 3308    OPTIONS(*VARSIZE)
     D   MsgInfLen                    9B 0 CONST
     D   MsgMsgFmt                    8    CONST
     D   MsgCallStE                  16    CONST
     D   MsgCallStC                   9B 0 CONST
     D   MsgMsgType                  10    CONST
     D   MsgMsgKey                    4    CONST
     D   MsgWait                      9B 0 CONST
     D   MsgMsgAct                   10    CONST
     D   APIErr                     148
****************************************************************************
******************
      * Receive Programme Message - Paremeter definities
****************************************************************************
******************
     D MsgMsgInf       DS          3308      INZ
     D   MsgBRtn               1      4B 0
     D   MsgBAvl               5      8B 0
     D   MsgSever              9     12B 0
     D   MsgIDMsg             13     19
     D   MsgMsgTypR           20     21
     D   MsgMsgKeyR           22     25
     D   MsgMsgFl             26     35
     D   MsgMsgFLib           36     45
     D   MsgLibUsed           46     55
     D   MsgSndJob            56     65
     D   MsgSndUsPf           66     75
     D   MsgJobNbr            76     81
     D   MsgSndPgm            82     93
     D   MsgPgmIns            94     97
     D   MsgsndDt             98    104
     D   MsgSndTm            105    110
     D   MsgRcvPgm           111    120
     D   MsgRcvIns           121    124
     D   MsgSndType          125    125
     D   MsgRcvType          126    126
     D   MsgReserve          127    127
     D   MsgCCSIDD           128    131B 0
     D   MsgCCSIDT           132    135B 0
     D   MsgAlert            136    144
     D   MsgCCSIDM           145    148B 0
     D   MsgCCSIDR           149    152B 0
     D   MsgLenRRtn          153    156B 0
     D   MsgLenRAvl          157    160B 0
     D   MsgLenMsgR          161    164B 0
     D   MsgLenMsgA          165    168B 0
     D   MsgLenHlpR          169    172B 0
     D   MsgLenHlpA          173    176B 0
     D   MsgMsg              177   3176
     D MsgInfLen       S              9B 0 INZ(3308)
     D MsgMsgFmt       S              8    INZ('RCVM0200')
     D MsgCallStE      S             16    INZ('*')
     D MsgCallStC      S              9B 0 INZ(0)
     D MsgMsgType      S             10    INZ('*LAST')
     D MsgMsgKey       S              4
     D MsgWait         S              9B 0 INZ(0)
     D MsgMsgAct       S             10    INZ('*OLD')
****************************************************************************
******************
      * Change Exception Message - Parameter definities

****************************************************************************
******************
     D MsgInvPtr       S               *   INZ(*NULL)
     D MsgModOpt       S             10    INZ('*HANDLE')
     D MsgRpyTxt       S              1    INZ
     D MsgRpyLen       S              9B 0 INZ(0)

****************************************************************************
******************
     C                   MoveL     Object        FullObj
      *
     C                   Call(E)   'QLICKOBJ'
     C                   Parm                    Fullobj
     C                   Parm      InType        ObjType
     C                   Parm      InMember      Member
     C                   Parm                    Aut
      *
     C                   CallP    ChgExcMsg(MsgInvPtr:MsgCallStC:MsgMsgKey:
     C                               MsgModOpt:MsgRpyTxt:MsgRpyLen:APIErr)
      *
     C                   CallP    RcvPgmMsg(MsgMsgInf:MsgInfLen:MsgMsgFmt:
     C                               MsgCallStE:MsgCallStC:MsgMsgType:
     C                               MsgMsgKey:MsgWait:MsgMsgAct:APIErr)
      *
     C                   Return    MsgIDMsg
      *
     P ChkObj          E



_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.