I am trying to learn ILE concepts in AS400. So i thought i'll create a module which contained a function written in C language and i tried calling it from a RPG program. The RPG program is calling the C function without any problems but it is passing incorrect values.
What im trying to do is have a main RPG program which will take a date from user and pass this date to the C function. In the C function im validating the date. But the C function is receiving incorrect values. I found out that RPG does pass by reference and C is pass by value by default.
Here are my code snippets
Main RPG program
Module written in C
Im passing 20080202(for 2008/02/02) from RPG program but the C module is receiving 8396847.
I would be glad if anybody can help me on this.
Thanks in advance
What im trying to do is have a main RPG program which will take a date from user and pass this date to the C function. In the C function im validating the date. But the C function is receiving incorrect values. I found out that RPG does pass by reference and C is pass by value by default.
Here are my code snippets
Main RPG program
Code:
HDftactgrp(*no) HBnddir('KARTHIK/SRVPROGRAM') HBnddir('QC2LE') Ddate_check Pr 1 Extproc('DATE_CHECK') D 8 0 Value C Eval Ch=Date_check(Date2)
Code:
#includechar DATE_CHECK(int i) int date_chk; date_chk = i;
I would be glad if anybody can help me on this.
Thanks in advance
Comment