Any help will be appreciated
Tissa
"T.Withana" wrote:
>
> How can you call a variable Program name in C.
> To have the Program Name in a variable and call it (like in RPG)
You can use the system() function, section 1.2.204 of "C/C++ Run-Time
Library Reference" SC09-2715-00 describes this function.
Regards, Erik
Clarification: the system() function will execute a CL command, so to
call a program you would pass it a command string such as "CALL
PGM(mylib/mypgm)". Also, if you need better error information when the
called program terminates abnormally, the QCMDEXC (Execute Command) or
QCAPCMD (Process Command) APIs can be used instead of system(). The
APIs let you monitor for exceptions caused/signalled by the called
program, or in the case of QCAPCCMD to check the Error Code parameter
after the called program returns. See the Program and CL Command APIs
section of the System API Reference manuual:
http://publib.boulder.ibm.com:80/cgi-bin/bookmgr/DOCNUM/SC41-5801-02
--
Karl Hanson
Patrick
"T.Withana" wrote:
>
> How can you call a variable Program name in C.
> To have the Program Name in a variable and call it (like in RPG)
>
> Any help will be appreciated
>
> Tissa
--
IBM AS/400 communications, FTP automation, and network security
software and consulting services.
Assuming you are trying to do something like this:
*-------------------------------------------------------------------
D Message S 20A INZ('Hello')
C *ENTRY PLIST
C PARM MyPgm 10
C CALL MyPgm
C PARM Message
C
C RETURN
*-------------------------------------------------------------------
...a rough equivilent in C would be:
/*-------------------------------------------------------------------*/
#include <miptrnam.h>
typedef char Char20 [ 20];
typedef void (MyPgmType) ( Char20 * );
#pragma linkage(MyPgmType,OS)
main(int argc, char *argv[])
{
MyPgmType *MyPgmPtr;
Char20 Message = "Hello";
MyPgmPtr = rslvsp( _Program, argv[1], "*LIBL", _AUTH_OBJ_MGMT );
MyPgmPtr( &Message ); /* Call the program */
return;
}
/*-------------------------------------------------------------------*/
hth,
Derek
T.Withana wrote in message <7a035i$ihk$1...@reader1.reader.news.ozemail.net>...