× 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: Re: SCAN in RPG
  • From: Scott Klement <klemscot@xxxxxxxxxxxx>
  • Date: Fri, 13 Apr 2001 10:03:19 -0500 (CDT)



On Thu, 12 Apr 2001, Richard Reeve wrote:

> All,
> 
>      I am having a problem using SCAN in an RPG
> program.  I am attempting to scan CL source members
> looking for certain library names and replacing those
> library names with a variable.  The library names are
> there but the SCAN isn't picking them up.  Can someone
> give me some pointers please?
> 
> Thanks.
> 
> =====

D Pointer1        S               *
D Pointer2        S               *
D Pointer3        S               *
D Pointer4        S               *

There.  I gave you some pointers.   (Sorry, I'm feeling whimsical today)

Seriously, though....   most likely your scan is looking for a library
name with trailing blanks -- and if the blanks aren't there, it wont
count as a match.

Err... I don't know if you're working in RPG III or RPG IV...

Here's a trivial example of what I mean....   this is RPG IV code, 
but the same exact thing should also work in RPG III (and I didn't
use any BIFs so that it would be easy to convert)

     D Lib             S             10A
     D String          S             80A
     D Pos             S              5I 0
     D Len             S              5I 0

     C*** This WONT work:
     C***   Pos will be zero, because even though String contains
     C***    'QGPL', it doesn't contain 'QGPL      '
     c                   eval      String = 'ADDLIBLE LIB(QGPL)'
     c                   eval      Lib = 'QGPL'
     c     Lib           scan      String        Pos
     c                   dsply                   Pos

     C*** This WILL work since we're only scanning for 'QGPL'
     c     ' '           checkr    Lib           Len
     c     Lib:Len       scan      String        Pos
     c                   dsply                   Pos

     c                   eval      *inlr = *on

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