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



Hi Edmund,

Firstly, I am selecting specific sections of code to format. If I try to use c-s-f without selecting some code I get an infinite loop and need to kill RDi.

Here is the code that I get a SQL formatting error on (I've snipped out a purely RPG section in the middle of the loop just to make this a little easier to view):

For w#bkno = 0 To 1;
processedCount = 0;

emailingGroups = *OFF;
EXEC SQL
OPEN rcd_filecsr1;

// Get first record
EXEC SQL
FETCH rcd_filecsr1 INTO :rcd_mlgrup;

// Loop through all records in cursor
DOW SQLCOD <> 100;

[snip]

// Get next record
EXEC SQL
FETCH rcd_filecsr1 INTO :rcd_mlgrup;

// If processedCount > 5;
// SQLCOD = 100;
// EndIf;
ENDDO;

// Close the cursor
EXEC SQL
CLOSE rcd_filecsr1;

rcd_MLGRUP.Group = *BLANKS;
ExSr ProcessedLast;
EndFor;

If I use the mouse to select that lot, then press c-s-f, I get the "Formatting failed due to "null"" message (maybe because there is nothing needing formatting?)

If I press ALT-L when on the first "For" line, then SHIFT-DOWN to the "EndFor" then press c-s-f, I get the following:
For w#bkno = 0 To 1;
processedCount = 0;

emailingGroups = *OFF;
EXEC SQL
OPEN rcd_filecsr1;

// Get first record
EXEC SQL
FETCH rcd_filecsr1 INTO :rcd_mlgrup;

// Loop through all records in cursor
DOW SQLCOD <> 100;

[snip]

// Get next record
EXEC SQL
FETCH rcd_filecsr1 INTO :rcd_mlgrup;

// If processedCount > 5;
// SQLCOD = 100;
// EndIf;
ENDDO;

// Close the cursor
EXEC SQL
CLOSE rcd_filecsr1;

rcd_MLGRUP.Group = *BLANKS;
ExSr ProcessedLast;
EndFor;

If you display this post with a fixed font you can see the formatting changes.

I noticed that the "For" was not dragged back to column 6 this time, so maybe that was just a week-long glitch... :-S

Checking my settings I can tell you that "preserve relative indentation of continued lines" is ticked, SQL's "Automatic Formatting" is unticked, but SQL's "Automatic Indent" and "Automatic Uppercasing" is ticked. Looking at the preview in the settings page for free-form SQL formatting, c-s-f is formatting the SQL almost correctly (everything except the second FETCH in the code above), but I am expecting/hoping it to format like that in the first code section above (i.e. automatic indenting). I'm so confused! I can't repeat all the initial problems I reported, but there still are some!


-Paul.


-----Original Message-----
From: WDSCI-L [mailto:wdsci-l-bounces@xxxxxxxxxxxx] On Behalf Of Edmund Reinhardt
Sent: 15 October 2015 22:24
To: Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries
Subject: Re: [WDSCI-L] Formatting RPGLE /FREE code strangements


Hi Paul
I was trying to reproduce the issue of conflict between the SQL formatter and the RPG formatter.
First of all, without my fix to prevent the hang, I don't see how you could do anything. Thankfully my hang fix is working will be available as a test fix soon.
Secondly, even with my hang fix, the only way I could reproduce the issue is to
a) turn off SQL formatting
b) turn off "preserve relative indentation of continued lines" on the RPG Formatting preferences (which is NOT the default)
c) run Ctrl-Shift-F - which now indents all of the continued SQL at the same level
d) turn back on SQL formatting
e) touch the SQL.

BTW I don't recommend (b) to avoid this type of scenario where you may have formatted the continued line the way you like.

If there is some other way, I would love to know about it.
Maybe you want to wait until the test fix is available for the hang, because otherwise, this would be extremely frustrating.

Edmund





From: Edmund Reinhardt/Toronto/IBM@IBMCA
To: Rational Developer for IBM i / Websphere Development Studio
Client for System i & iSeries <wdsci-l@xxxxxxxxxxxx>
Date: 10/14/2015 09:10 AM
Subject: Re: [WDSCI-L] Formatting RPGLE /FREE code strangements
Sent by: "WDSCI-L" <wdsci-l-bounces@xxxxxxxxxxxx>




Thanks Paul,

The infinite loop happens if there is embedded SQL. There is an APAR for that. I am actively working on a fix.
But the conflicting formatting of SQL is something that needs to be considered. Thanks for bringing it up. I would accept a PMR on that.

The shifting of FOR lines to column 6. I have a fixed APAR for when any line has an end of line comment that extends beyond column 80. But the particular code that you pasted in here, formats correctly for me.

An error after hitting format twice. I have not seen that. Unless the first format caused the shift to column 6 bug above. If it is unrelated, I would really like to see a PMR so that I can fix that. I want to focus on clean up the bugs with Ctrl-Shift-F in the next fix pack, so please open PMRs on it now.

Thanks,
Edmund



From: Paul Bailey <PaulBailey@xxxxxxxxxx>
To: wdsci-l <wdsci-l@xxxxxxxxxxxx>
Date: 10/14/2015 07:13 AM
Subject: [WDSCI-L] Formatting RPGLE /FREE code strangements
Sent by: "WDSCI-L" <wdsci-l-bounces@xxxxxxxxxxxx>



Hi,

I have been using the CTRL-SHIFT-F formatting option introduced with RDi 9.5, and it works well apart from a few little things.

If you do not select any code lines then press CTRL-SHIFT-F, RDi goes into some infinite loop and needs killing. I think this was mentioned before, but I thought I would note it just in case.

If you format the code and there is embedded SQL in there, the formatted SQL changes so that the second line (after the exec sql) is not indented.
If you type in the SQL line then the standard formatter rearranges it according to SQLRPGLE preferences, but if you use CTRL-SHIFT-F (intentionally on the SQL lines, or otherwise) it then rearranges it to its own preferences.

If you format some code with a FOR (RPGLE) statement in it, the FOR is sometimes dragged back to column 6 and RDi then insists the line is an F-spec for fixed format RPG, even though the lines around it are free-format and formatted correctly. See this snippet:

(Select these lines)
----> // Send emails as well, if applicable If w#SendEmails = *ON;
----> For w#bkno = 0 To 1;
----> processedCount = 0;
...
----> EndFor;
----> EndIf;
(then press CTRL-SHIFT-F)
----> // Send emails as well, if applicable If w#SendEmails = *ON;
!!!!>For w#bkno = 0 To 1;
----> processedCount = 0;
...
----> EndFor;
----> EndIf;

(first 5 columns are just my notes and are not in the actual source)

Finally, if you try to format the same lines of code twice, you get an error above the LPEX command-line: "Formatting failed due to "null"".
Usually I can work around this by changing the selected lines, but sometimes it then formats a couple of unselected lines below the selection.

Has anyone else seen any of this? (RDi 9.5 on Win7x64, over IBM i v6.1)


-Paul.
---------------------------------------------------------------------------------------


Important This email transmission and any files with it are strictly confidential to the intended recipient and may be legally privileged. Any views or opinions presented are solely those of the author and do not necessarily represent those of BHSF. If you are not the intended recipient, you must not copy, disclose or distribute its contents in any way.
If you have received this email in error, please notify the sender and delete the email from your system. We have taken steps to ensure this email and attachments are free from any virus but do not accept any responsibility once this e-mail has been transmitted. You should scan any attachments for viruses. No contract may be concluded on behalf of BHSF Group Limited or its subsidiary companies by email.
Registered Office: BHSF Group Limited, Gamgee House, 2 Darnley Road, Birmingham B16 8TE. Registered in England number 04767689. BHSF is authorised and regulated by the Financial Conduct Authority and Prudential Regulation Authority.

This email has been scanned for email related threats and delivered safely by Mimecast. For more information please visit https://www.mimecast.com
---------------------------------------------------------------------------------------


--
This is the Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries (WDSCI-L) mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/wdsci-l.


--
This is the Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries (WDSCI-L) mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/wdsci-l.


--
This is the Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries (WDSCI-L) mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/wdsci-l.
---------------------------------------------------------------------------------------
Important This email transmission and any files with it are strictly confidential to the intended recipient and may be legally privileged. Any views or opinions presented are solely those of the author and do not necessarily represent those of BHSF. If you are not the intended recipient, you must not copy, disclose or distribute its contents in any way.
If you have received this email in error, please notify the sender and delete the email from your system. We have taken steps to ensure this email and attachments are free from any virus but do not accept any responsibility once this e-mail has been transmitted. You should scan any attachments for viruses. No contract may be concluded on behalf of BHSF Group Limited or its subsidiary companies by email.
Registered Office: BHSF Group Limited, Gamgee House, 2 Darnley Road, Birmingham B16 8TE. Registered in England number 04767689. BHSF is authorised and regulated by the Financial Conduct Authority and Prudential Regulation Authority.

This email has been scanned for email related threats and delivered safely by Mimecast. For more information please visit https://www.mimecast.com
---------------------------------------------------------------------------------------

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.