View previous topic :: View next topic
|
Author |
Message |
vickey_dw
New User
Joined: 10 Jun 2015 Posts: 51 Location: India
|
|
|
|
Hi All,
I have written a COBOL program which has three cursors.Requirement was to read data from one SQL(cursor1) and based on values retrieved from cursor1 read cursor2,cursor3 and the write data to output file after performing some Computations.
I have written logic to read first cursor1 and based on retrieved values read cursor2,perform computation, write output file for cursor 2 till end of cursor2. And then for same values of cursor1 read cursor3 till end and write simultaneously.
My program is working perfectly fine and i an getting expected output.
But in my shop before code moved to production it has to pass SONAR.
And this sonar report is saying this program this has complexity much higher that authorized.
I believe i am getting this complexity message because of loops involved in program.
It will be a great help if you can suggest me better ways to write this program and remove this high complexity problem.
Thanks
Vickey |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
And SONAR (whatever that is) does not identify what features of the program are excessively complex? I'd challenge it on those grounds; it's obviously in error. |
|
Back to top |
|
|
vickey_dw
New User
Joined: 10 Jun 2015 Posts: 51 Location: India
|
|
|
|
No unfortunately it doesn't point out which part are complex. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
You have only 2 alternatives, I think:
1. Locate the team responsible for SONAR and ask them to revise their criteria or to allow your program.
2. Simplify your program.
Edit:
3. Split your program into sub-routines. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
|
|
We use SONAR too.
When you search you program , it gives you blockers, critical messages and the corresponding impacted code.
So get the link of Sonar and search your module and see the error and fix it if you can't then explain it to responsible people why you can't do. |
|
Back to top |
|
|
venkatesh.nayak
New User
Joined: 07 Jan 2007 Posts: 3 Location: Bangalore
|
|
|
|
I would suggest you that use JOINS in place of retrieving data from Cursor 1 and then cursor2 AND later Cursor 1 and then cursor3.
JOIN Cursor1 Query with Cursor2 Query and execute it as single cursor. This would atleast saves upper level looping performing twice and can release hold resources as well |
|
Back to top |
|
|
|