× 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 for the reminder, Sam, of that utility. I don't remember, does it also align vertically things like the various parameters of a DCL?

There've been various suggestions for CL "pretty-print" over the years. They're all intended for clarity when scanning source. Things like putting each parameter on its own line come to mind. I can think of something like indenting additional lines of a long string to form a block beginning in the string's starting position.

That'd be fun with REXX, and not too hard, I think. Just tedious loops and lots of tokenizing, which is simple in that language.

Of course, we can get into holy wars over what to do with IF statements. Do we omit the parameter names because it scans nicely, without interrupting the flow? Or do we line up ENDDO with the IF or put the DO on the next line, indented, and align the ENDDO with it?

Please, that was not a challenge! ;-)

Later
Vern

At 08:02 PM 5/28/2004, you wrote:
Vern said:  "I go back and forth on this. I try to do nice indents and other
"pretty-print" stuff, and, of course, that's wiped out if you prompt in SEU.
So I give up on "pretty-print". But then the structure is harder to follow."

I do a fair amount of CL coding, but I still rely heavily on F4 in SEU.
(Why overload my brain with details when command prompting is one of the
great facilities of OS/400?)  I hate the default formatting that results.

Fortunately, many years ago Ernie Malaga (?sp) wrote a CL formatter for
Midrange Computing.  I like and have grown used to the indented source it
creates.  If I destroy the formatting by prompting it takes just a couple of
seconds to reformat the whole program.

It's a REXX program that is quite nippy on RISC machines.  It relies on
fully prompted CL code, but for me that isn't an issue, though I know some
people consider some command keywords as "noise".

I run Ernie's command as a PDM user option.  Works great for me, since I do
most CL programming in SEU because I find the LPEX prompting too slow.  I do
tidy up and comment the code in LPEX.  (In theory I suppose I could run the
indenter from RSE as long as the member isn't open in LPEX.)

The formatter will stop working at V5R3 when new opcodes are introduced to
CL, but I suspect it could be upgraded, though I'm not a REXX expert.

Seems to me that something similar could/should be put into the LPEX editor
for CL, but auto indenting of RPG Free is probably more important.

Sam

FWIW, here's a sample of the resulting indented codel:

   /* If not *ALL, process member immediately */
   IF COND(&SRCMBR *NE '*ALL') THEN(DO)
      RTVMBRD FILE(&SRCFLIB/&SRCF) MBR(&SRCMBR) SRCTYPE(&SRCTYPE)
      IF COND(&SRCTYPE *NE 'CL' *AND &SRCTYPE *NE 'CLP' *AND +
         &SRCTYPE *NE 'CLP38') THEN(DO)
         SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Member' +
            *BCAT &SRCMBR *BCAT 'is not a CL source member') +
            MSGTYPE(*ESCAPE)
         RETURN
      ENDDO
      ELSE CMD(DO)
         CALL PGM(INDCLC2) PARM(&SRCMBR &SRCF &SRCFLIB &CVTCASE +
            &INDRMKS &OUTPUT &SAVOLDSRC &BGNCOL &INDCOL &INDCONT)
         MONMSG MSGID(CPF0000) EXEC(DO)
            RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
               MSGF(&MSGF) MSGFLIB(&MSGFLIB)
            SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
               MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)
            RETURN
         ENDDO
      ENDDO
   ENDDO



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.