|
' ' is not found in your string, so n is zero.
so, you are blowing up on %subst(NW_sascnt:1:n-1), which is translated to:
%subst(NW_sascnt:1:-1) which is obviously illegal.
Change to something like
' ' scan NW_sascnt n
If n > 0
Eval nwcs_nm_f = %subst(NW_sascnt:1:n-1)
Eval nwcs_nm_l = %subst(NW_sascnt:n+1)
Else
*** Error here, ' ' not found, or ignore or whatever makes sence to
your code ***
EndIf
Regards,
Jim Langston
a b wrote:
> This might sound a bit elementary, but I'm desperately
> seeking help... I have an triggered application that
> continues to blow up with the following error:
>
> Message . . . . : Length or start position is out of
> range for the string operation
> Cause . . . . . : One of the following has occurred
> in RPG procedure TRG_APGM in program BLAHLIB/TRG_APGM
> at statement 382:
> -A numeric length or start position is less than 1 or
> too large for the string operation.
> -The search-argument parameter of the %SCAN built-in
> function has zero length or is longer than the
> source-string parameter.
> -The maximum-length parameter of the %STR built-in
> function is not a value
> between 1 and 32767.
>
> This is what my code looks like...
> if contact name /customer name is company name
>
> IF NW_sascnt <> *Blanks
> ' ' scan NW_sascnt n
> Eval nwcs_nm_f = %subst(NW_sascnt:1:n-1)
> Eval nwcs_nm_l = %subst(NW_sascnt:n+1)
>
> Any help would greatly be appreciate.
>
> Thanks
> AB
>
> __________________________________________________
> Do You Yahoo!?
> Kick off your party with Yahoo! Invites.
> http://invites.yahoo.com/
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: david@midrange.com
> +---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.