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



HI all this what the status as of now

As I (MARK)mentioned before, a C main program is not really meant to be
able to be called multiple times ,and retain any "memory" of local
variables ,etc. from call to call. So, if this is what is happening, it
is totally "dumb luck" that this ever worked, and perhaps now it is no
longer working because IBM may have made some subtle changes in how
storage is allocated and managed within the heap, in each activation
group, etc.

Also,

So currently the activation group for the C programis *CALLER. And If
change the activation group *NEW it is working fine.

Can you confirm that *NEW activation group will be reclaimed
automatically as soon as the program returns to the caller. If not, for
each and evry call NEW activation group will be created and which is
over head.

Is there any disadvantages with other than overhead at invoking the C
program (creating a new activation group).

-------------
If *NEW activation group is not suggestible I am thinking of going for a
NAMED activation group and reclaim every time after returning from the
called program (C program). Note: Caller is RPGLE running in QILE, calls
C program.


-----Original Message-----
From: c400-l-bounces+bhargava.gangasani=broadridge.com@xxxxxxxxxxxx
[mailto:c400-l-bounces+bhargava.gangasani=broadridge.com@xxxxxxxxxxxx]
On Behalf Of Schmidt, Mihael
Sent: Wednesday, May 26, 2010 7:12 PM
To: C programming iSeries / AS400
Subject: Re: [C400-L] MCH0601 and MCH6902 issues

AFAIK the program must be an ILE program for this to work.

-----Original Message-----
From: c400-l-bounces+mihael.schmidt=rossmann.de@xxxxxxxxxxxx
[mailto:c400-l-bounces+mihael.schmidt=rossmann.de@xxxxxxxxxxxx] On
Behalf Of Schmidt, Mihael
Sent: Wednesday, May 26, 2010 3:29 PM
To: C programming iSeries / AS400
Subject: Re: [C400-L] MCH0601 and MCH6902 issues

You can allocate the memory using a user defined heap. After you
finished your work, you can dispose of the user defined heap and the
system will free all memory taken from that heap. You don't have to
store any pointers to the memory.

http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/apis/ile8a
1TOC.htm

It is not a garbage collector but may help you.

-----Original Message-----
From: c400-l-bounces+mihael.schmidt=rossmann.de@xxxxxxxxxxxx
[mailto:c400-l-bounces+mihael.schmidt=rossmann.de@xxxxxxxxxxxx] On
Behalf Of Gangasani, Bhargava
Sent: Wednesday, May 26, 2010 3:22 PM
To: C programming iSeries / AS400
Subject: Re: [C400-L] MCH0601 and MCH6902 issues


Thank you.

This is very old program and can not catch author.

I am checking for the null character availability while doing string
copy .

Sorry about free(): After returning from the program I think I must free
the memory right. If not I am keep on executing malloc and not freeing
the memory, Is itn't cause a problem. Do we have something similar to
GARBAGE collector (java), which frees memory when it there is no pointer
pointing to it.



-----Original Message-----
From: c400-l-bounces+bhargava.gangasani=broadridge.com@xxxxxxxxxxxx
[mailto:c400-l-bounces+bhargava.gangasani=broadridge.com@xxxxxxxxxxxx]
On Behalf Of Dennis Lovelady
Sent: Wednesday, May 26, 2010 5:59 PM
To: 'C programming iSeries / AS400'
Subject: Re: [C400-L] MCH0601 and MCH6902 issues

/***Declaration ***/
crtsub wwcsub;
crtsub *csub_pt; /** where CRTSUB is a data structure.**/
In the code I have two statements one after the other
csub_pt =
malloc(sizeof (crtsub));
csub_pt = &wwcsub;
Note: it is #include <sys/errno.h> //// What is the
perpose
of it???

Its looks like strange , cusb_pt is getting overridden by the address
of the variable. So what is the point of malloc.

I doubt anyone here can tell you why there are consecutive assignments
for
csub_pt. Have you spoken with the author?

So I commented this like (malloc ), but then got the issue below after
20 calls to this program in the same job.

At end of the program I have
free(csub_pt); --------- This is failing saying

Yes, of course! Since csub_pt does not contain the address of storage
that
you have malloc()'d you should get this error.

In your post to RPG400-L you showed an instruction that was failing, and
it
included at least three pointers. (One was a pointer that was
redirected
from another pointer.) Given the above, and assuming that nothing else
has
changed csub_pt along the way, it is likely that csub_pt is not your
issue.

Again, you have not provided enough information for any diagnosis of
what
might be wrong. One that I did not point out on the RPG400-L list is
that
even if your pointers are all OK, the strcpy() instruction can result in
this error if it doesn't find an end of string (x'00') before the
storage
extent is reached (on the Source or the Dest side).

Answers to other questions in that original post: You must not free
storage
that you still need; you should (spelled m-u-s-t) free storage that you
don't need. Failure to allocate memory (you've used too much - if
that's
even possible ?!?!) would manifest itself differently - the malloc()
would
fail.


Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
Life would be so much easier if we could just look at the source code.




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.