I think this is what happening...
CRTBNDC creates program with activation group *NEW.
If program with activation group *NEW terminates , the activation group is
In a job with ALWMLTTHD(*YES), termination of any activation group leads to
job termination.
Either change your job to ALWMLTTHD(*NO) or change program to run in

    Alexei Pytel
expressing my own opinion

                      "Simon Coulter"
                      <shc@flybynight.c        To:       C400-L@midrange.com
                      om.au>                   cc:
                      Sent by:                 Subject:  [C400-L] Called C 
program  kills caller on return
                      c400-l-admin@midr         when job has ALWMLTTHD(*YES) 

                      05/02/2002 06:48
                      Please respond to

Hi Guys,

I have an interesting problem.  A C program calls another C program in a
batch job with ALWMLTTHD(*YES) specified.  The call is successful but on
return to the caller, the calling program is blown out of the water and
the entire job ends.  No unusual error messages are in the joblog.

If the calling C program calls a non-C program it functions as expected
with no errors!

NOTE: The job is capable of running multiple threads but it is only
running a single thread.

This problem is occurring on VRM440.  Here is some example code.  Could
some of you try this on other OS versions and let me know the results?  I
would be interested in any comments you may have on solving this problem.
(Jon Paris:  I thought I'd steal your idea!)

/* Calling C program - CALL_C */
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#pragma linkage(DUMMYC,OS,nowiden)
void DUMMYC( void );
int main ()
   printf("Made it back from the call OK!\n");

/* Called C program - DUMMYC */
int main()

Compile both programs with CRTBNDC using the standard command default
values.  Then submit a job using:


Two spooled files will be created:  QPJOBLOG and QPRINT.  The QPRINT file
will contain the text "Made it back from the call OK!"

Now submit a job using:


This time only one spooled file will be created:  QPJOBLOG.  The printf
statement in the caller was not executed as can be verified if you step
through the call process in debug.

I could not find any information about this problem at
www.as400service.ibm.com nor any information in the manuals about this
behaviour when a job is capable of multiple threads.

I modified the calling C program and called non-C dummy programs and they
worked as expected.  In all cases the printf code ran after the call
returned control to the caller so it is not an ILE vs. OPM problem, just
a C problem.

/* Called CLP program - DUMMYCL */

/* Called CLLE program - DUMMYCLLE */

/* Called RPG program - DUMMYRPG */
     C                     SETON                     LR

/* Called RPGLE program - DUMMYRPGLE */
     C                   SETON                                        LR

Do you have any ideas as to why this might be occurring and what I can do
about it?  This problem stops any C program from calling another C
program via dynamic call in a multithread capable job.

Simon Coulter.

   FlyByNight Software         AS/400 Technical Specialists

   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175   mailto: shc@flybynight.com.au   \ /
                 ASCII Ribbon campaign against HTML E-Mail  / \

This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/c400-l
or email: C400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.

This thread ...

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

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