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



Steve, thank you for your comprehensive reply. Automatic uppercasing is on
for keywords and BIF's; off for identifiers. Basically, I use every
option...and would like more. It would be cool to see RDi's SQL formatter
get a little smarter; a paper on attaching some of the SQL formatting
plug-in's to RDi would be useful as well. I've taken RDi code, pasted into
NotePad II, reformatted it there, and pasted it back. SQL code can get
pretty gnarly and source code appearance counts.

The code is clean and compiled before this problem cropped up. The code
compiles after the unexpected reformatting; it's just...ugly. Kent Beck
has "code smells", may I claim "ugly code"?

When is a new workspace beneficial? I don't remember hearing this in the
past. Should setting up a new workspace be an RDi best practice when
installing a release upgrade?

Thanks again for your comments. I will test.

On Wed, Aug 4, 2021 at 7:47 AM Steve Ferrell via WDSCI-L <
wdsci-l@xxxxxxxxxxxxxxxxxx> wrote:

The uppercase is an easy fix.

Go into preferences -> type "format" in the "type filter text" box ->
select the Free-form SQL Formatting -> then unselect the Automatic
uppercasing.

Does the program compile or verify? IE is the Exec SQL statement valid?

Also, is this an older workspace? IE was it used very early in the 9.6
versions? Could you try it in a new workspace after turning off the
Automatic uppercasing?

RDi no longer has a setting to MOVE the SQL comments, but perhaps your
workspace has a retained setting.

Steve Ferrell
w. www.helpsystems.com



-----Original Message-----
From: WDSCI-L <wdsci-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of x y
Sent: Tuesday, August 3, 2021 6:55 PM
To: Rational Developer for IBM i <wdsci-l@xxxxxxxxxxxxxxxxxx>
Subject: [WDSCI-L] Funny behavior in RDi/SQL formatter

External: Pause and review the sender's email address, any URLs before
clicking links, opening attachments, or following requests. When in doubt,
contact the Service Desk.


I start with a nice, clean piece of code in RDi 9.6.0.10 running on an
up-to-date Win10 Professional ThinkPad:

:ad1desc; --Description

if sqlstt = SQLGoodRead;
//Good read

qd1eff = zzr000_d8a(ad1eff);
qd1can = zzr000_d8a(ad1can);
qd1desc = ad1desc;

if %date >= ad1eff
and (%date <= ad1can or ad1can = d'0001-01-01');
*in52 = *on;
else;
*in52 = *off;
endif;

s01rrn = s01rrn + 1;
//Subfile RRN

write r90wd01;

else;
//Otherwise

*in35 = *on;
// Turn off "More...

endif;

enddo;

And press Ctrl+Shift+F and get this dog's breakfast of weird indenting and
upper-cased opcodes:

:ad1desc; --Description

IF sqlstt = sqlgoodread; //Good read
qd1eff = zzr000_d8a(ad1eff);
qd1can = zzr000_d8a(ad1can);
qd1desc = ad1desc;
IF %date >= ad1eff
AND (%date <= ad1can
OR ad1can = d'0001-01-01')
;
*in52 = *ON;
ELSE;
*in52 = *off;
endif;
s01rrn = s01rrn + 1; //Subfile RRN
WRITE r90wd01;
ELSE; //Otherwise
*in35 = *ON; // Turn off "More...
endif;
enddo;

EXEC SQL
CLOSE gpr90w_gpp090_cursor;

qpos01 = 1;

q_format = 'tag400';
leave;

enddo;

The behavior is intermittent. The code is straightforward to the point of
being boring and without any hinky formatting in previous lines. The
problem is not resolved by a reboot. I have received messages indicating
"indenting past column 80 not allowed" and that message appears to end the
reformatting process (that problem was caused by a 3rd party conversion
tool's problem with handling comments and indented code).

My guess is that the formatter doesn't know to quit when the last line of
the program variables list has a comment, like this:
:ad1desc; --Description

Almost all of my SQL code is machine-generated and my programs may have
broken a rule by having an SQL comment *after* the semicolon. Let's see if
that's the cure.
--
This is the Rational Developer for IBM i (WDSCI-L) mailing list
To post a message email: WDSCI-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/wdsci-l.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
--
This is the Rational Developer for IBM i (WDSCI-L) mailing list
To post a message email: WDSCI-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/wdsci-l.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.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.