The QMHSNDM API uses the relative invocation to send messages. IBM probably
should have created a new set of APIs that were procedure invocation aware
rather than "break" the good old program-aware message APIs, but that's just
wishful thinking. 

So when you call the API from main() the message is sent to the prior
program invocation, if you call it from a function/procedure, it is sent to
main(). If you call it from a nested function/procedure, it is sent to the
calling function--same as when it is called from main().

-----Original Message-----
[] On Behalf Of
Sent: Monday, February 07, 2005 12:00 PM
To: c400-l@xxxxxxxxxxxx
Subject: C400-L Digest, Vol 3, Issue 13

Send C400-L mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific
than "Re: Contents of C400-L digest..."

Today's Topics:

   1. Memory usage of process (kapil  gupta)
   2. QMHSNDM question (Pierre-Henry Deliege)


message: 1
date: 7 Feb 2005 13:57:43 -0000
from: "kapil  gupta" <guptakapilg@xxxxxxxxxxxxxx>
subject: [C400-L] Memory usage of process

I have a process(root) which spawns other processes to get its work done.
These children in turn may spawn more processes and so on. I want to obtain
the memory used by all of these processes at a point of time from the root
process(very 1st process).
So, I neeed 2 things:

First is to obtain all the process handles of this process tree.
So, Is there a way to find all the child processes for a particular process.
Right now I am using "CreateToolhelp32Snapshot" to obtain a snapshot of all
the processes in the system and then looking for the processes which have
root process as their parent. Doing this recursively to obtain the whole
process tree.
Is there a better approach available for doing this?

Secondly, get the memory used by process. Is there an API available to do
this? Can not use "PSAPI" as its not for Win95, 98.



message: 2
date: Mon, 7 Feb 2005 17:05:41 +0100
from: "Pierre-Henry Deliege" <phdeliege@xxxxxxxxxxxxxxxxx>
subject: [C400-L] QMHSNDM question

Dear all,


Within a C program under my AS/400, I'm trying to send messages to different
message queues.

First of all, I'm really new in C programming under OS/400, I used to work
only on Unix platform.


I'm using the command QMHSNDM included in a specific function called sndmsg:


void sndpgmmsg (char *msg_id, char *msg_data)


char *err_code;

char msg_key[4];

char tmp_msg_id[7];

typedef struct qual_name_struct


   char  name[10];

   char  libr[10];

  } qual_name_struct;


qual_name_struct  MsgQList[2];  


strncpy(MsgQList[0].name,"PHDMSGQ   ",10);

strncpy(MsgQList[1].name,"QSYSOPR   ",10);


strncpy(MsgQList[1].libr,"QSYS      ",10);


memset(&err_code, 0, sizeof(err_code));

memcpy(tmp_msg_id, msg_id, sizeof(tmp_msg_id));





         "*INFO     ",








When I call this function within the main() function, I have no problem,
everything is working fine.

But when I call it in an other function called by main, my program stop
without error at the call of QMHSNDM !!!


Do you have any idea of the problem ?

Also, I tried to find the cause of the error in the log (using dsplog) but
it says terminating with RC = 0 !!! Is there any other place to look for
errors reporting ?


I thank you in advance for your help.

Pierre-Henry DELIEGE



This is the C programming iSeries / AS400 (C400-L) digest list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives

End of C400-L Digest, Vol 3, Issue 13

This thread ...

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

This mailing list archive is Copyright 1997-2019 by 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].