|
Later Vern
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 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.