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



Thanks that worked. I did not realizt that i had to include *CWIDEN in the 
EXTPROC definition.

On 4/20/05, Scott Klement <c400-l@xxxxxxxxxxxxxxxx> wrote:
> 
> Hello,
> 
> On Wed, 20 Apr 2005, Scott Klement wrote:
> >
> > IMHO, it would make more sense to return a character than to return a
> > pointer! That way, you won't have to worry about the memory being freed 
> up.
> >
> 
> Reading back my message, I don't think I made it very clear what I
> recommended. I recommend the following as the solution to your problem:
> 
> D Pr_ChkDigit PR 1A ExtProc(*CWIDEN: 'Pr_ChkDigit')
> D str * value options(*string)
> 
> D Wrk_Str s 36A
> D Wrk_ChkDigit s 1A
> 
> /free
> Wrk_ChkDigit = Pr_ChkDigit('70500607050AEI02x');
> dsply Wrk_ChkDigit;
> *inlr = *on;
> /end-free
> 
> Or, if you prefer to put the number into a variable:
> 
> /free
> Wrk_Str = '70500607050AEI02x';
> Wrk_ChkDigit = Pr_ChkDigit(%trimr(WrkStr));
> dsply Wrk_ChkDigit;
> *inlr = *on;
> /end-free
> 
> And the C function should look like this:
> 
> char Pr_ChkDigit(const char *str)
> {
> char chkdigit;
> chkdigit = reverse_map(c1,c2);
> return chkdigit;
> }
> 
> Actually, there doesn't seem to be any point to using a variable for the
> check digit. You could just do this:
> 
> char Pr_ChkDigit(const char *str)
> {
> return reverse_map(c1,c2);
> }
> 
> Anyway, hope that helps.
> 
> _______________________________________________
> This is the C programming iSeries / AS400 (C400-L) mailing list
> To post a message email: C400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/c400-l
> or email: C400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/c400-l.
> 
> 


-- 
Krish Thirumalai

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.