Re: Calling RPGILE program from C
Tim Bronski <[email protected]>
| Newsgroups | gmane.comp.lang.as400.c |
|---|---|
| Message-ID | <[email protected]> |
Try this:
#include <decimal.h>
#include <stdlib.h>
#pragma map(trigger,"RGTRIGCNTL")
#pragma linkage(trigger, OS)
void trigger (char [80], decimal(10,0) *);
int main(int argc, char *argv[])
{
char *triggerInfo;
decimal (10,0) *triggerLen;
triggerInfo = argv[1];
triggerLen = (decimal (10,0) *) argv[2];
trigger (triggerInfo, triggerLen);
}
On 10/29/2014 12:15 PM, Tony Cate wrote:
> Marc,
>
> I made all the changes you did. I still get: CZP1404: The parameter "OS"
> specified for "pragma linkage" is not valid. The pragma is ignored.
>
> On Tue, Oct 28, 2014 at 4:40 PM, marc <marc-G5HfMHItY0AlJZD/[email protected]> wrote:
>
>> I got this to 'work':
>>
>> #include <stdio.h>
>> #include <string.h>
>>
>> #include <decimal.h>
>> #include <stdlib.h>
>>
>> void RGTRIGCNTL(char[80], decimal(10,0));
>>
>> #pragma map(RGTRIGCNTL, "TESTPGM")
>> #pragma linkage(RGTRIGCNTL, OS)
>>
>> int main(int argc, char *argv[])
>> {
>> char *triggerInfo;
>> decimal (10,0) triggerLen;
>>
>> triggerInfo = argv[1];
>> triggerLen = 12; //argv[2];
>>
>> RGTRIGCNTL(triggerInfo, triggerLen);
>> }
>>
>> - Added a map for the external program name
>> - hardcoded the triggerLen to bypass type conversion
>> - dropped the typedef
>> - dropped the ref on the second parm of the actual call - to match
>> prototype
>> - I'm at v7r1 but compiled back to v5r4
>>
>> HTH,
>>
>> Marc
>>
>>
>> On 10/28/2014 1:02 PM, Tony Cate wrote:
>>
>>> First the code:
>>>
>>> *#include <stdio.h>*
>>> *#include <string.h>*
>>>
>>> *#include <decimal.h>
>>> #include <stdlib.h>
>>>
>>> typedef void RGTRIGCNTL(char[80], decimal(10,0));
>>>
>>> #pragma linkage(RGTRIGCNTL,fetchable)
>>>
>>> int main(int argc, char *argv[])
>>> {
>>> char *triggerInfo;
>>> decimal (10,0) triggerLen;
>>>
>>> triggerInfo = argv[1];
>>> triggerLen = argv[2];
>>>
>>> RGTRIGCNTL(triggerInfo, &triggerLen);
>>> }*
>>>
>>> *What's going on: trying to write a small C program to attach to file
>>> triggers.*
>>>
>>> Problems:
>>>
>>> pragma linkage won't allow 'OS' for a parameter. Everything I've read
>>> indicates that's what I want. The only "ID' compiler didn't barf on is
>>> 'fetchable', which is why its there.
>>>
>>> It compiles, but nothing happens when I try to step into RGTRIGCNTL.
>>>
>>> The Dev box is V5R4 (long story).
>>>
>>> The questions:
>>>
>>> Why can't I use 'OS' in linkage? Why isn't my program getting called?
>>>
>>> The last time I wrote a C program was in college, a looong time ago.
>>>
>> --
>> This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L)
>> mailing list
>> To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected]
>> To subscribe, unsubscribe, or change list options,
>> visit: http://lists.midrange.com/mailman/listinfo/c400-l
>> or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
>> Before posting, please take a moment to review the archives
>> at http://archive.midrange.com/c400-l.
>>
>>
>
--
Need secure FTP? Download your native sFTP solution here:
www.arpeggiosoftware.com
--
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.