Page 1 of 1

Calling external executable program

PostPosted: Thu Sep 20, 2007 4:39 pm
by mcna
Help,

okay, i have a program which in somecase will call another external c++ program,
i just dont know how to do this.
Both of my program are in my CHRISM.LOADLIB (my user)

reading the zos manuals, system() should do the job. there are two different ways i can format the system() command

sprintf(line,"PGM=PROGRAM2,PARM='%s'",Passed);
rc = system(line);

sprintf(line,"PROGRAM2 %s",Passed);
rc = system(line);

do i need to put something in the JCL, or do i need to do a program linkage
extern "REFERENCE" {
void PROGRAM2(char *);
}

Any help would be good.
Many thxs

Re: Calling external executable program

PostPosted: Mon Sep 24, 2007 9:41 pm
by mcna
Dont worry everyone, i have done it myself

i used system(), but i used

"call 'prefix.program' 'arg1' 'arg2' 'arg3'

and so on.
'prefix.program'
can also be 'prefix.dataset(program)'

a thread with only me
:(

Re: Calling external executable program

PostPosted: Mon Sep 24, 2007 9:44 pm
by CICS Guy
Thanks for reposting the answer, it sure had me stumped.......

Re: Calling external executable program

PostPosted: Mon Sep 24, 2007 9:52 pm
by mcna
it was in the C/C++ programming guide for zos v1r6.0

under redirecting streams under zos, just really luck i found it

Re: Calling external executable program

PostPosted: Tue Sep 25, 2007 5:05 pm
by mcna
Spoke 2 soon,

it allows me to use this to call from ispf command shell, but not if i pass it 2 system()

so any help would be nice

Re: Calling external executable program

PostPosted: Tue Sep 25, 2007 8:24 pm
by mcna
This is drivin me mad,

y is it so difficult, to run a program from another

Re: Calling external executable program

PostPosted: Wed Sep 26, 2007 11:55 pm
by dick scherrer
Hello,

y is it so difficult, to run a program from another
I suspect that it is not difficult once you know how. . .

What error are you getting?

What resources are available to the "shell" that are not available to the run with problems? I suspect there may be one or more datasets missing from the batch run?

but not if i pass it 2 system()
I do not understand what this means :?

Re: Calling external executable program

PostPosted: Fri Oct 05, 2007 7:12 pm
by mcna
i found the problem,
this will work normal but
my environment i am using. i am using one of the adcd from ibm

with posix(ON) so the system() doesnt pass the command to the tso shell, but it passes it to the unix shell so it fails

Re: Calling external executable program

PostPosted: Fri Oct 05, 2007 7:14 pm
by mcna
this should work "call 'prefix.program' 'arg1' 'arg2' 'arg3'

and so on.
'prefix.program'
can also be 'prefix.dataset(program)'

Re: Calling external executable program

PostPosted: Fri Oct 05, 2007 9:55 pm
by dick scherrer
Thank you for posting your solution :)

d