Calling external executable program



Help for C/C++ for MVS, OS/390 C/C++, z/OS C/C++ and C/C++ Productivity Tools for OS/390

Calling external executable program

Postby mcna » Thu Sep 20, 2007 4:39 pm

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
mcna
 
Posts: 20
Joined: Tue Jul 31, 2007 7:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling external executable program

 

Re: Calling external executable program

Postby mcna » Mon Sep 24, 2007 9:41 pm

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
:(
mcna
 
Posts: 20
Joined: Tue Jul 31, 2007 7:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling external executable program

Postby CICS Guy » Mon Sep 24, 2007 9:44 pm

Thanks for reposting the answer, it sure had me stumped.......
CICS Guy
 
Posts: 246
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: Calling external executable program

Postby mcna » Mon Sep 24, 2007 9:52 pm

it was in the C/C++ programming guide for zos v1r6.0

under redirecting streams under zos, just really luck i found it
mcna
 
Posts: 20
Joined: Tue Jul 31, 2007 7:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling external executable program

Postby mcna » Tue Sep 25, 2007 5:05 pm

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
mcna
 
Posts: 20
Joined: Tue Jul 31, 2007 7:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling external executable program

Postby mcna » Tue Sep 25, 2007 8:24 pm

This is drivin me mad,

y is it so difficult, to run a program from another
mcna
 
Posts: 20
Joined: Tue Jul 31, 2007 7:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling external executable program

Postby dick scherrer » Wed Sep 26, 2007 11:55 pm

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 :?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Calling external executable program

Postby mcna » Fri Oct 05, 2007 7:12 pm

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
mcna
 
Posts: 20
Joined: Tue Jul 31, 2007 7:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling external executable program

Postby mcna » Fri Oct 05, 2007 7:14 pm

this should work "call 'prefix.program' 'arg1' 'arg2' 'arg3'

and so on.
'prefix.program'
can also be 'prefix.dataset(program)'
mcna
 
Posts: 20
Joined: Tue Jul 31, 2007 7:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling external executable program

Postby dick scherrer » Fri Oct 05, 2007 9:55 pm

Thank you for posting your solution :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to C, C++

 


  • Related topics
    Replies
    Views
    Last post