Program (ABC.SCB) Branch () Line XXX at the wrong place M

3 Posts
2 Users
0 Likes
17 Views
KASI
 KASI
(@k-simanjalamarcinfo-com)
Posts: 134
Estimable Member
Topic starter
 

Hello,

This is for sharing, I am not sure if this information is mentioned anywhere or not.

I started encountering errors like the one below and was unable to load my program. It took more than half an hour to debug, then finally found the cause using the elimination method.

Program (ADDUSERROLE.SCB) Branch () Line 127
      at the wrong place M

The cause of this error is that I had declared some SCADA basic lines before the first DIM statement. The error message did not indicate at all what is the actual cause of the error.

Sub SetVisibilityBit()
   AddString("b", "aa");
   
   Dim hBuf as long;
   Dim lngbuffer1 as long;
   dim sSepColumn as str;
   TRACE("TRACE", AddString("Start processing visibility bit for ", @User));
End Sub

I did not see also mentioned in PcVue help, that the DIM statements must always be the top lines in each sub before any other instruction, can somebody clarify in case I missed it?

 
Posted : 09/08/2023 7:17 pm
LM
 LM
(@l-micaudarcinfo-com)
Posts: 383
Member Admin
 

Hello Kantha,

It is written in the help and in the training courses:

We can hope it will be easier to detect in the next Scada Basic environment.

Ludo

 
Posted : 09/08/2023 7:59 pm
KASI
 KASI
(@k-simanjalamarcinfo-com)
Posts: 134
Estimable Member
Topic starter
 

Hi Ludo. In the urgency, my eyes were trying to scan for the word DIM everywhere and I didn't find it. Thanks for correcting me wrong.

 
Posted : 09/08/2023 8:05 pm