× 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.



This is just a guess. I use the 'system' function from RPG to run OS/400
commands. I thought that the 'system' function is a C function. I'm not
exactly sure about that though. I'm also not sure how it would work in
C. In RPG it's coded as follows:

     H BNDDIR('QC2LE')
     D ExecCommand     PR            10I 0 EXTPROC('system')
     D  Cmd                            *   Value OPTIONS(*STRING)
                                                            
     D Command         S            256A
     D RC              S             10I 0
     
      /Free
       Command = 'CALL SOMELIB/SOMEPGM';
       RC = ExecCommand(Command);
      /End-Free   

Maybe it would be something like this in C:
#include the necessary library

int system (Cmd s);
char command;
int RC;
command = 'CALL SOMELIB/SOMEPGM';
RC = system(command);
  

-----Original Message-----
From: Walt Fles [mailto:wfles@xxxxxxxxxxx] 
Sent: Monday, May 24, 2004 10:30 AM
To: Midrange Systems Technical Discussion
Subject: Call a command from C on as400

All,
Im trying to use spawn to call a command without having to specify a 
complete path, ie
without having to say "/qsys.lib/mylib.lib/mypgm.pgm"
Is there something I have to set up in my environment?

also, how do I call from within C commands such as "dspusrprf", or do a:
"call pgm(mylib/mypgm)" from within C.  I've already did a 
putenv("PATH=%LIB%")
but that does not seem to help.

I am using WDS5722 on V5R2.


TIA!



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.