Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

omitting optional command parameter with RTNVAL keyword ==> runtime error!

111 views
Skip to first unread message

Michael Hellriegel

unread,
Jul 11, 2002, 9:42:45 AM7/11/02
to
Hi,

I'm working on an user-defined „select object“ command that can
optionally return up to 5 separate parameter values on a selected object.
The command prompt looks like this (in German, but keyword are standard
abbreviations ;-):

________________________________________________________
Objekt selektieren (SELOBJ)

Auswahl eingeben und Eingabetaste drücken.

Objektname . . . . . . . . . . . OBJ
Bibliothek . . . . . . . . . . *LIBL
Objekttyp . . . . . . . . . . . OBJTYPE *ALL
+ für weitere Werte
Objektattribut . . . . . . . . . OBJATR *ALL
Anzeige-Überschrift . . . . . . TITEL

CL-Var. f. Objektname (A10) RTNOBJNAM
CL-Var. f. Objektbibl. (A10) RTNOBJLIB
CL-Var. f. Objekttyp (A10) RTNOBJTYP
CL-Var. f. Objektattr. (A10) RTNOBJATR
CL-Var. f. Fehlercode (A7) RTNERRCOD

The command works in *IPGM mode (requirement für RTNVAL) and the command
processing program (CPP) is written in CL.

When the command is issued with all RTNxxx parameters specified by
variables no problem occurs. Example:

selobj obj( QSYS/*ALL )
objtype(*LIB)
rtnobjnam(&RtnObj)
rtnobjlib(&RtnLib)
rtnobjtyp(&RtnObjTyp)
rtnobjatr(&RtnObjAtr)
rtnerrcod(&RtnFeCd)
titel(&titel)

However, calling the command with one or more of the RTNxxx parameters
omitted (rtnobjtyp and rtnobjatr in the following example)

selobj obj( QSYS/*ALL )
objtype(*LIB)
rtnobjnam(&RtnObj)
rtnobjlib(&RtnLib)
rtnerrcod(&RtnFeCd)
titel(&titel)

will result in runtime error MCH3601 („Zeiger für angegebene Position
nicht gesetzt“ which might translate to „pointer .. not set“). The CL
Programming book states that in this case a null pointer is returned to
the CPP.

Question 1: how can I check for a nullpointer in the CPP before actually
adressing the variable?

Somewhere else within the book it is recommended to monitor for MCH3601
when adressing the variable for the first time and then taking
appropriate action. However the CHGVAR command which adresses the
variable at the beginning of the CPP for initialization of the return
values does not permit to monitor the MCH3601.

Question 2: how can I possibly monitor the MCH3601

Any comments or suggestions on how to handle these problems would be
greatly appreciated.

--
Michael Hellriegel
Germany

thomas....@gfd.de

unread,
Jul 11, 2002, 10:19:11 AM7/11/02
to
Hi Michael,

I have no idea what might be wrong with your program. My little sample
program (shown below) works fine for me. No problem monitoring MCH3601.

PGM (&I_VAR1 &I_VAR2)

DCL VAR(&I_VAR1 ) TYPE(*CHAR) LEN( 10 )
DCL VAR(&I_VAR2 ) TYPE(*CHAR) LEN( 10 )

SET_VAR1:
CHGVAR VAR(&I_VAR1) VALUE('TEST_1')
MONMSG MSGID(MCH3601) EXEC(DO)
SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA('&I_VAR1 +
not passed to program!') TOPGMQ(*PRV +
(*PGMBDY))
GOTO CMDLBL(SET_VAR2)
ENDDO

SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA('Value +
of &I_VAR1: ' *CAT &i_VAR1) TOPGMQ(*PRV +
(*PGMBDY))

SET_VAR2:
CHGVAR VAR(&I_VAR2) VALUE('TEST_2')
MONMSG MSGID(MCH3601) EXEC(DO)
SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA('&I_VAR2 +
not passed to program!') TOPGMQ(*PRV +
(*PGMBDY))
GOTO CMDLBL(END_PGM)
ENDDO

SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA('Value +
of &I_VAR2: ' *CAT &I_VAR2) TOPGMQ(*PRV +
(*PGMBDY))

END_PGM:
ENDPGM

The only disadvantage is that the MCH3601 message stays in the job log and
should be removed manually.

Thomas Raddatz

-------------------------
Original message (snip)
-------------------------

I'm working on an user-defined "select object" command that can

optionally return up to 5 separate parameter values on a selected object..

The command prompt looks like this (in German, but keyword are standard
abbreviations ;-):

Question 1: how can I check for a nullpointer in the CPP before actually
adressing the variable?

Michael Hellriegel

unread,
Jul 11, 2002, 11:37:39 AM7/11/02
to
Hi Thomas,

(another way to meet again ;-)

> I have no idea what might be wrong with your program. My little sample
> program (shown below) works fine for me. No problem monitoring MCH3601.

After taking off my blindfolds and strictly comparing Your code to mine I
found the answer to my own question:

> > Question 2: how can I possibly monitor the MCH3601

Simply monitor MCH3601 instead of CPF3601 - ARGGHHH!

I apologize to everyone who gave a thought to my problem.

Michael Hellriegel
Verl (Germany)


Michael Frilot

unread,
Jul 11, 2002, 2:10:53 PM7/11/02
to
I do this in a clp and monitor for the mch3601 message after my chgvar
command like so:

CHGVAR &MEMONTH &WRKMM
MONMSG MSGID(MCH3601) EXEC(RCVMSG MSGTYPE(*LAST))

Hope that helps.

it cleans up the joblog so people are not confused and think this is a
serious application error.

Michael

On Thu, 11 Jul 2002 13:42:45 GMT, Michael Hellriegel
<MHell...@T-Online.de> wrote:

>Hi,
>
>I'm working on an user-defined =84select object=93 command that can=20
>optionally return up to 5 separate parameter values on a selected object=
>.=20
>The command prompt looks like this (in German, but keyword are standard =
>
>abbreviations ;-):
>
>________________________________________________________
> Objekt selektieren (SELOBJ) =20
> =20
>Auswahl eingeben und Eingabetaste dr=FCcken. =20
> =20
>Objektname . . . . . . . . . . . OBJ =20
> Bibliothek . . . . . . . . . . *LIBL =20
>Objekttyp . . . . . . . . . . . OBJTYPE *ALL =20
> + f=FCr weitere Werte =20
>Objektattribut . . . . . . . . . OBJATR *ALL =20
>Anzeige-=DCberschrift . . . . . . TITEL =20
> =20
>CL-Var. f. Objektname (A10) RTNOBJNAM =20
>CL-Var. f. Objektbibl. (A10) RTNOBJLIB =20
>CL-Var. f. Objekttyp (A10) RTNOBJTYP =20
>CL-Var. f. Objektattr. (A10) RTNOBJATR =20
>CL-Var. f. Fehlercode (A7) RTNERRCOD =20
>
>The command works in *IPGM mode (requirement f=FCr RTNVAL) and the comma=
>nd=20


>processing program (CPP) is written in CL.
>

>When the command is issued with all RTNxxx parameters specified by=20


>variables no problem occurs. Example:
>

> selobj obj( QSYS/*ALL ) =20
> objtype(*LIB) =20
> rtnobjnam(&RtnObj) =20
> rtnobjlib(&RtnLib) =20
> rtnobjtyp(&RtnObjTyp) =20
> rtnobjatr(&RtnObjAtr) =20
> rtnerrcod(&RtnFeCd) =20
> titel(&titel) =20
>
>However, calling the command with one or more of the RTNxxx parameters=20=


>
>omitted (rtnobjtyp and rtnobjatr in the following example)
>

> selobj obj( QSYS/*ALL ) =20
> objtype(*LIB) =20
> rtnobjnam(&RtnObj) =20
> rtnobjlib(&RtnLib) =20
> rtnerrcod(&RtnFeCd) =20
> titel(&titel) =20
>
>will result in runtime error MCH3601 (=84Zeiger f=FCr angegebene Positio=
>n=20
>nicht gesetzt=93 which might translate to =84pointer .. not set=93). The=
> CL=20
>Programming book states that in this case a null pointer is returned to =
>
>the CPP.=20
>
>Question 1: how can I check for a nullpointer in the CPP before actually=
>=20
>adressing the variable?
>
>Somewhere else within the book it is recommended to monitor for MCH3601 =
>
>when adressing the variable for the first time and then taking=20
>appropriate action. However the CHGVAR command which adresses the=20
>variable at the beginning of the CPP for initialization of the return=20=


>
>values does not permit to monitor the MCH3601.
>
>Question 2: how can I possibly monitor the MCH3601
>

>Any comments or suggestions on how to handle these problems would be=20=
>
>greatly appreciated.
>
>--
>Michael Hellriegel =20
>Germany
>

SJ Lennon

unread,
Jul 11, 2002, 8:21:23 PM7/11/02
to
Not sure why you say you can't monitor for MCH3601.

Conceptually:

PGM PARM(&RETNAM)
CHGVAR &RETNAM 'A VALUE'
MONMSG MCH3601
RETURN

If no paramater is passed, nothing is returned. The MONMSG just eats up
the MCH3601 escape message.

Sam

"Michael Hellriegel" <MHell...@T-Online.de> wrote in message
news:20020711.13424...@PCMHServer2.MHVerl...

Michael Hellriegel

unread,
Jul 13, 2002, 5:55:12 AM7/13/02
to
> Not sure why you say you can't monitor for MCH3601.
> Conceptually:
> PGM PARM(&RETNAM)
> CHGVAR &RETNAM 'A VALUE'
> MONMSG MCH3601
> RETURN

and

> I do this in a clp and monitor for the mch3601 message after my chgvar
> command like so:
> CHGVAR &MEMONTH &WRKMM
> MONMSG MSGID(MCH3601) EXEC(RCVMSG MSGTYPE(*LAST))
> Hope that helps.

> it cleans up the joblog so people are not confused and think this is a
> serious application error.

Sam and Michael,
thanks for Your tips, of course You both are perfectly right.

I should simply monitor MCH3601 instead of CPF3601 as I did - ARGGHHH!


I apologize to everyone who gave a thought to my problem.

I like the subtle method of removing unwanted messages from the joblog,
too ;-)

Michael Hellriegel
Verl (Germany)I

0 new messages