I don't know of any examples but I should imagine it's as simple of starting POSIX C stub threads that call COBOL programs. If you want to use shared data structures and use mutexes or condvars in the COBOL programs then you will have to either create COBOL records to map the DSECTS or write some assembler routines to call the BPX services.

#pragma runopts(posix(on))

#define _UNIX03_THREADS

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <pthread.h>

void COBPGM();

#pragma linkage(COBPGM,COBOL)

void * runThread( void * arg )
{
    COBPGM(); // call the COBOL program
}

#define NUM_THREADS 5

int main( int argc, char * argv[] )
{
    pthread_t threads[NUM_THREADS];

    // start the threads
    for ( int i = 0; i < NUM_THREADS; i++ )
    {
        pthread_create( &threads[i], NULL, runThread, NULL );
    }

    // wait for the threads to complete
    for ( int i = 0; i < NUM_THREADS; i++ )
    {
        pthread_join( threads[i], NULL );
    }

    return 0;
}



On 9/11/2012 5:57 AM, Scott Ford wrote:
All:
Can someone point me to an example of a C program runing POSIX threads calling a COBOL thread ?


Scott J Ford
Software Engineer
http://www.identityforge.com/

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to