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


  • Subject: How to write a C program, that is to be called from RPG?
  • From: "Jevgeni Astanovski" <jevgeni@xxxxxxxxx>
  • Date: Tue, 26 Sep 2000 11:26:02 +0200 (EET)


The system, I work with, contain a set of RPG programs (not ILE, I
think).

When I write my ILE/C program, I call them for example like that :

#pragma map(theirapi, "THEIRPROG")
#pragma linkage(theirapi, OS)

void theirapi  ( char *,         /* ERCOD  */ 
              char *,         /* ERPRM  */ 
              char *,         /* empty  */ 
              char *,         /* DSAIF  */ 
              char *,         /* DSAIR  */ 
              char *,         /* BEGIN  */ 
              decimal(5,0) *, /* NOREQ  */ 
              decimal(5,0) *  /* NORET  */ 
                );

int main (int argc, char *argv)
{
char          DSAIF[3000];                 
char          DSAIR[3000];                 
char          ERCOD[2];                    
char          ERPRM[10];                   
char          BEGIN;                       
char          DUMMY[14] = "              ";
decimal(5,0)  NOREQ;                       
decimal(5,0)  NORET;

/* Some initialization */
........

/* ------------------- */

theirapi (ERCOD, ERPRM, DUMMY, DSAIF, DSAIR, &BEGIN, &NOREQ, &NORET);

 return(0) ;
}

But these programs are also called from inside the system from other
RPG modules (sources unavailable). Now what I want to do, is to write
my own C program, that can substitute completely one of original
programs - thus being undestinctable from the viewpoint of calling RPG
program. My question is, how should the program access the parameters?
I normally write 

int main (int argc, char *argv)

So are there any formal rules for obtaining arguments in C program,
when they are passed from RPG?

Any help will be apreciated,
TIA,

Eugene Astanovsky.




Jevgeni Astanovski, 
IT Hooldusosakonna juhataja                                
Optiva Pank.
+---
| This is the C/400 Mailing List!
| To submit a new message, send your mail to C400-L@midrange.com.
| To subscribe to this list send email to C400-L-SUB@midrange.com.
| To unsubscribe from this list send email to C400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: bob@cstoneindy.com
+---

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.