× 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 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 ()
{
   DUMMYC();
   printf("Made it back from the call OK!\n");
   return;
}

/* Called C program - DUMMYC */
*************
int main()
{
return;
}

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

SBMJOB CMD(CALL PGM(CALL_C)) JOB(TEST_CALL) LOG(4 0 *SECLVL) +
       ALWMLTTHD(*no)

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:


SBMJOB CMD(CALL PGM(CALL_C)) JOB(TEST_CALL) LOG(4 0 *SECLVL) +
       ALWMLTTHD(*yes)

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 */
pgm
endpgm

/* Called CLLE program - DUMMYCLLE */
pgm
endpgm

/* 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.

Regards,
Simon Coulter.

--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists
   http://www.flybynight.com.au/

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



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.