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

CPF code returned by QC2LE system procedure

749 views
Skip to first unread message

xyzzy

unread,
Feb 24, 2008, 5:17:05 PM2/24/08
to
Hi,

I'm using the system() function from QC2LE in an RPGLE to perform the
CRTDUPOBJ command. It works, however if the user is not authorised to
copy the object it returns CPF2130 in _EXCP_MSGID instead of CPF2189.
Why is this?

The joblog show both messages:

CPF2189 Not authorized to object BGR017CL in DEVAPP type *MODULE.
followed by
CPF2130 0 objects duplicated. 1 objects not duplicated.

Is there any way I can get it to return the first CPF code? My
program prints out the CPF code returned and CPF2130 does not explain
to the user why the object was not copied.

Cheers.

*** anti-spam email address - please reply to group ***

Denny

unread,
Feb 25, 2008, 12:40:19 PM2/25/08
to
CPF2189 is an info or diag message.
CPF2130 is the escape message.

Since CRTDUPOBJ can be run over *ALL or generic* you could have many
CPF2189 and other messages.

Denny

On Sun, 24 Feb 2008 14:17:05 -0800 (PST), xyzzy <ukp...@ic24.net>
wrote:

xyzzy

unread,
Feb 25, 2008, 4:50:40 PM2/25/08
to
On Feb 25, 5:40 pm, Denny <Denny.Pro...@gmail.com> wrote:
> CPF2189 is an info or diag message.
> CPF2130 is the escape message.

Hmmm. both appear to be diag messages:

Message ID . . . . . . : CPF2189
Severity . . . . . . . : 40
Message type . . . . . :
Diagnostic
Date sent . . . . . . : 21/02/08 Time sent . . . . . . :
16:04:40

Message ID . . . . . . : CPF2130
Severity . . . . . . . : 40
Message type . . . . . :
Diagnostic
Date sent . . . . . . : 21/02/08 Time sent . . . . . . :
16:04:40

> Since CRTDUPOBJ can be run over *ALL or generic* you could have many
> CPF2189 and other messages.

OK, I understand. One or more CPF2189's plus other error messages
followed up by the final CPF2130 stating n duplicated and n not
duplicated. Pity. I don't suppose there is an API that'll do the
copy object function and return the reason for the failure (if there
is one)?

Thanks.

CRPence

unread,
Feb 25, 2008, 5:38:31 PM2/25/08
to
QMHRCVPM to receive the previous diagnostic would normally be used,
but I can not recall how the messaging for system() functions.

The more recent post showing that /both are diagnostic/ messages,
does not show the /to-program/ information; that determines if the above
API generally & nicely assists. If the to-program is the program
performing the system(), and not the program implementing system(), then
just use the aforementioned API to receive and review preceding
diagnostic messages.

If the errors go to the program implementing system(), then IMO the
best resolution is to create a CLLE which encapsulates the CRTDUPOBJ
having received the necessary parameters, and has a defined interface to
return the desired completion and failure details. Otherwise the API
QCAPCMD and QCMDEXC do effect the messaging going back to the invoker;
one of those can be used in place of system().

Regards, Chuck
--
All comments provided "as is" with no warranties of any kind
whatsoever and may not represent positions, strategies, nor views of my
employer

xyzzy wrote:
> I'm using the system() function from QC2LE in an RPGLE to perform the
> CRTDUPOBJ command. It works, however if the user is not authorised to
> copy the object it returns CPF2130 in _EXCP_MSGID instead of CPF2189.
> Why is this?
>
> The joblog show both messages:
> CPF2189 Not authorized to object BGR017CL in DEVAPP type *MODULE.

Barbara Morris

unread,
Feb 25, 2008, 10:58:07 PM2/25/08
to
xyzzy wrote:
>
> Is there any way I can get it to return the first CPF code? My
> program prints out the CPF code returned and CPF2130 does not explain
> to the user why the object was not copied.
>

You can't get system() to do anything useful with messages. I hardly
ever use system() because of the way it removes some of the messages
from the joblog. It happens too often that you want more than just the
message id of the escape message; if something strange happens, you
usually want the replacement text too.

I think it's better to use API QCMDEXC or QCAPCMD, and let the command
put the messages in the joblog. Then you can receive the message(s)
from the joblog using API QMHRCVPM, and remove the ones you don't want.

xyzzy

unread,
Feb 26, 2008, 1:09:35 PM2/26/08
to

Barbara, Chuck, thanks for the comments.

I didn't realise system() removes messages - looks like I'll be
switching back to QCMDEXC. In the mean time I've got around the
problem with not getting CPF2189 (not authorised) messages by checking
the authority to the object being copied (using API QSYRUSRA).

Thanks again.

Karl Hanson

unread,
Feb 26, 2008, 1:57:51 PM2/26/08
to

Fyi - I don't believe system() actually "removes" any messages - in the
original post you stated: "The joblog show both messages:". Most likely,
messages are sent to (and remain on) a program message queue supporting
system(), such that they are not (conveniently) available to the caller
via APIs like QMHRCVPM. To verify, run the program to generate the
messages, and then use F1->F9 to see "To program" information.

--
Karl Hanson

Barbara Morris

unread,
Mar 19, 2008, 2:21:13 PM3/19/08
to
Karl Hanson wrote:
>
> Fyi - I don't believe system() actually "removes" any messages - in the
> original post you stated: "The joblog show both messages:". Most likely,
> messages are sent to (and remain on) a program message queue supporting
> system(), such that they are not (conveniently) available to the caller
> via APIs like QMHRCVPM. To verify, run the program to generate the
> messages, and then use F1->F9 to see "To program" information.
>

My experience with system() has always been that the last escape message
for the failing command no longer appears in the joblog. I'm surprised
that xyzzy says that the joblog showed both messages.

I have a CL program that sends a diag CPF9898 message and then an escape
CPF9897 message, both to *PRV.

If I call it from the command line, dspjoblog shows these messages:
diag msg (CPF9898)
escape msg (CPF9897)

If I run this program:
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
main()
{
system ("call testcl");
printf("%s\n", _EXCP_MSGID);
}

It prints "CPF9897" and dspjoblog shows this:
diag msg (CPF9898)

Maybe the message is still there somehow, but it sure seems like it was
removed.

xyzzy

unread,
Mar 19, 2008, 6:27:36 PM3/19/08
to
> My experience with system() has always been that the last escape message
> for the failing command no longer appears in the joblog. I'm surprised
> that xyzzy says that the joblog showed both messages.

Been away for a while so couldn't confirm what I'd originally posted.
Anyway, it is my mistake, system() does appear to remove messages. It
looks like I got some of my test results mixed up when I posted the
original message. I'll double check my facts before posting in
future.

Rather than re-code the app to use qcmdexec, we made use of another
api to first check the current users authority to an object before
trying to copy it.

Thanks for everyone's input.

0 new messages