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



It's not just a matter of scanning for '*' in position 7.  We have some
free-format RPG here, and the '//' can appear just about anywhere.  CL has
the same issue.  Also, I know in CL that the '/*' and the '*/' can appear
on different lines.

Right now, I'm playing around with an idea to use CMPPFM and compare source
members I want to scan against an empty source member.  CMPPFM has
*OMT***CMT options.  Specify an outfile, end up with code without
comments.  That would handle the toughest part of getting clean uncommented
code.  If successful, then scanning for something in "live" code becomes a
much easier task.

I set up a couple of test source members.  The CLLE:

/* This is only a test to see if CMPPFM can accurately omit comments +
    using the *OMTCLCMT option, like this comment here, which spans +
    3 lines. */
             pgm

             dsplibl    /* how will it handle this one? */
        /*   dsplibl    /* how will it handle this one? */

             endpgm

The output from CMPPFM when comparing the above member to an empty member:
ID      SOURCE LINES
   ----+----1----+----2----+----3----+----4----+----5-
I -             pgm
I -             dsplibl
I -             endpgm

Very nice.

RPGLE was not as flexible.  In fact, it didn't treat *any* '//' as a
comment.  Only lines that had a '*' in column 7 were omitted.  The original
source:
         Eval *inLR = *on ;  // alksdjf laksdj flksjd
+
     c*
alksdjfklasjdklfjskd
     c                   move      'a'           test
           TestComment
         // this line should be
omitted

(In case the mailing list folds 'TestComment' to a new line, it is actually
in the text area of the 'C' statement.)
The output from CMPPFM when comparing the above member to an empty member:
----+----1----+----2----+----3----+----4----+----5----+---
         Eval *inLR = *on ;  // alksdjf laksdj flksjd +
     c                   move      'a'           test
         // this line should be omitted

As you can see, CMPPFM omitted the second source line with 'c*' in columns
6-7.  It also omitted the 'TestComment' in the comment area of the 'move'
statement.  But it ignored all instances of '//'.  It seems to me that
CMPPFM should handle these, seeing as it has no problems with the comment
variations in CL.

- Dan


On Mon, May 18, 2015 at 2:53 PM, Roger Harman <roger.harman@xxxxxxxxxxx>
wrote:

> www.jcrcmds.com  has a source scan for multiple strings with several
> options but I don't believe it has a "*NOT contains" option.  Should be
> easy to modify though.
>
> You could also whip up something pretty easily with CL & SQL.  Just need
> to use an alias for the member.  I did this a few years ago but don't have
> the code at hand anymore.
>
> Roger Harman
> COMMON Certified Application Developer – ILE RPG on IBM i on Power
> OCEAN User Group
>

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.