Strange
-
- User
- Posts: 62
- Joined: Thu Aug 28, 2014 9:02 pm
Strange
I've had pretty good luck bringing programs over from PowerBasic but I've encountered an
anomaly: I translated and compiled a program and ran it. It bombed without invoking the
error routine. So, I inserted several MessageRequesters into the program to determine where
it failed. After recompiling, it ran fine and produced the correct results. If I comment out the
MessageRequesters, it bombs again.
All thought are welcome.
Thanks.
anomaly: I translated and compiled a program and ran it. It bombed without invoking the
error routine. So, I inserted several MessageRequesters into the program to determine where
it failed. After recompiling, it ran fine and produced the correct results. If I comment out the
MessageRequesters, it bombs again.
All thought are welcome.
Thanks.
-
- Enthusiast
- Posts: 334
- Joined: Mon Feb 04, 2013 5:28 pm
Re: Strange
Stack corruption ?
Your description is clearly not detailed enough (to put it kindly).
Probably by examining the code someone here could tell you why it happens.
If that is not possible try to reduce the code. Cut, cut, cut until it stops "bombing" (whatever that means) and then examine the delta of the two sources for clues.
Also you didn't say if it runs in debug mode in the IDE, if you tried the purifier, what PB version you are using, what O.S., if it's "bombing" right at the start or if you can use it for a while, ... think about all the useful things you could say (even if nothing beat what the source could say).
The usual stuff everyone should say when asking this kind of questions
Tell more (or start cutting) !
Your description is clearly not detailed enough (to put it kindly).
Probably by examining the code someone here could tell you why it happens.
If that is not possible try to reduce the code. Cut, cut, cut until it stops "bombing" (whatever that means) and then examine the delta of the two sources for clues.
Also you didn't say if it runs in debug mode in the IDE, if you tried the purifier, what PB version you are using, what O.S., if it's "bombing" right at the start or if you can use it for a while, ... think about all the useful things you could say (even if nothing beat what the source could say).
The usual stuff everyone should say when asking this kind of questions

Tell more (or start cutting) !
-
- User
- Posts: 62
- Joined: Thu Aug 28, 2014 9:02 pm
Re: Strange
Thank you, DontTalkToMe.
When you mentioned stack corruption, it reminded me of problems I have had with
Select/Case. So, I changed the use of it to a sequence of If/ElseIf statements and the
program ran just fine.
As an aside, I'm using 5.31 on a Windows machine.
Thanks again.
When you mentioned stack corruption, it reminded me of problems I have had with
Select/Case. So, I changed the use of it to a sequence of If/ElseIf statements and the
program ran just fine.
As an aside, I'm using 5.31 on a Windows machine.
Thanks again.
Re: Strange
If you could reproduce it in a small snippet showing the bug, I would be glad to take a closer look.
-
- User
- Posts: 62
- Joined: Thu Aug 28, 2014 9:02 pm
Re: Strange
Fred,
I'll will try to cobble a working example but before I do, I wonder if the below code
might be involved. Note the use of If/EndIf within the case structure.
The program produces U.S. Medicare health care claims. The first claim is produced
as expected but the case that it falls in does not have an If/EndIf statement.
Production of the second claim fails and it falls in a case that has an If/EndIf
statement.
I'll will try to cobble a working example but before I do, I wonder if the below code
might be involved. Note the use of If/EndIf within the case structure.
The program produces U.S. Medicare health care claims. The first claim is produced
as expected but the case that it falls in does not have an If/EndIf statement.
Production of the second claim fails and it falls in a case that has an If/EndIf
statement.
Code: Select all
Case 2
HCD$ = Mid(PATREC, 3125, 2): HDTE1$ = Mid(PATREC, 3045, 6)
HDTE2$ = Mid(PATREC, 3051, 6): If HCD$ = " ": HCD$ = "70": EndIf
PCD$ = Mid(PATREC, 2890, 2): PDTE1$ = Mid(PATREC, 2892, 6)
PDTE2$ = Mid(PATREC, 2898, 6)
Case 3
Last edited by ANDY ANDERSON on Wed Sep 16, 2015 10:21 pm, edited 1 time in total.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Strange
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
-
- User
- Posts: 62
- Joined: Thu Aug 28, 2014 9:02 pm
Re: Strange
Sorry, I pasted it over from the PowerBasic code because I had already replaced the
Select/Case code in the PureBasic program with If/ElseIf statements. I changed all the
syntax except that one that I missed.
Is there a way to edit the post ?
Select/Case code in the PureBasic program with If/ElseIf statements. I changed all the
syntax except that one that I missed.
Is there a way to edit the post ?
Re: Strange
Yes - just look at your posting (bottom right) and click on theANDY ANDERSON wrote:Is there a way to edit the post ?

Two growing code-collections: WinApi-Lib by RSBasic ~ LinuxAPI-Lib by Omi
Missing a download-file on the forums? ~ check out this backup page.
Missing a download-file on the forums? ~ check out this backup page.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Strange
Hi Andy
Still not enough in that snippet to go on.
What is PATREC? A string? I ask because you are identifying other strings with $.
[/size]
What exactly is the failure? When you say the app 'bombs', what do you mean? App crashes off the screen? Locks up? Unexpected result?
Still not enough in that snippet to go on.
What is PATREC? A string? I ask because you are identifying other strings with $.
Code: Select all
LINE$ = "FKmPq66Bv66ScgBtmfuGPN24k9S4U9VhB7WR4K9eF6XH4g2fnbM3PvVZkwK6nn5NbSn6jn3P9Qe4X7928LTE7xm9SW552ZA3zMYH" ;100 chars
PATREC$ = ""
iTestCase.i = 2
For i = 1 To 32
PATREC$ = PATREC$ + LINE$
Next
Select iTestCase
Case 2
HCD$ = Mid(PATREC$, 3125, 2): HDTE1$ = Mid(PATREC$, 3045, 6)
HDTE2$ = Mid(PATREC$, 3051, 6): If HCD$ = " ": HCD$ = "70": EndIf
PCD$ = Mid(PATREC$, 2890, 2): PDTE1$ = Mid(PATREC$, 2892, 6)
PDTE2$ = Mid(PATREC$, 2898, 6)
Debug " HCD$-->" + HCD$ + "<--"
Debug "HDTE1$-->" + HDTE1$ + "<--"
Debug "HDTE2$-->" + HDTE2$ + "<--"
Debug " HCD$-->" + HCD$ + "<-- (after If)"
Debug " PCD$-->" + PCD$ + "<--"
Debug "PDTE1$-->" + PDTE1$ + "<--"
Debug "PDTE2$-->" + PDTE2$ + "<--"
Case 3
EndSelect
What exactly is the failure? When you say the app 'bombs', what do you mean? App crashes off the screen? Locks up? Unexpected result?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
-
- User
- Posts: 62
- Joined: Thu Aug 28, 2014 9:02 pm
Re: Strange
IdeasVacuum, thanks for your interest.
Yes, PATREC is a string (Define.S PATREC). It's just a quaint convention of mine
to leave off the $ for variables that hold a record read from file. Helps me keep
things straight.
To explain the symptoms: This job stream has 4 programs. The first one accepts user
entries such as facility number (billing party) and period date (%MM%YY).
After ENTER is pressed, it shells to (RunProgram) and waits for 3 programs that do
the Medicare Part A claims, then Medicare Part B claims and then Medicare Part B
Therapy claims. Meanwhile, the original dialog stays presented with a small window
that indicates the claim set it is processing. When all 3 jobs are finished, control
returns to the original dialog.
What happens in this failure, is that the 1st of the 3 programs ends with no error
message even though I have an error routine and the monitor returns to the desktop.
A check on the output shows that only one claim was produced.
When I replaced the Select/Case statements with If/ElseIf ones, the job ran to a
successful completion with all claims generated. Since I had found out the hard way
that you can't use GoTo's within a Case structure, I thought that maybe you couldn't
use If/EndIf either.
Yes, PATREC is a string (Define.S PATREC). It's just a quaint convention of mine
to leave off the $ for variables that hold a record read from file. Helps me keep
things straight.
To explain the symptoms: This job stream has 4 programs. The first one accepts user
entries such as facility number (billing party) and period date (%MM%YY).
After ENTER is pressed, it shells to (RunProgram) and waits for 3 programs that do
the Medicare Part A claims, then Medicare Part B claims and then Medicare Part B
Therapy claims. Meanwhile, the original dialog stays presented with a small window
that indicates the claim set it is processing. When all 3 jobs are finished, control
returns to the original dialog.
What happens in this failure, is that the 1st of the 3 programs ends with no error
message even though I have an error routine and the monitor returns to the desktop.
A check on the output shows that only one claim was produced.
When I replaced the Select/Case statements with If/ElseIf ones, the job ran to a
successful completion with all claims generated. Since I had found out the hard way
that you can't use GoTo's within a Case structure, I thought that maybe you couldn't
use If/EndIf either.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Strange
Your switch from Select Case to If Else might not be a finite solution but if the code is actually working without any blips then why not stick with it? There is a possibility that the 2nd and 3rd programs will be interrupted by an Anti-virus app. Certainly true these days that a program that sets-off other exe files is considered suspicious. Since you are rebuilding in PB, you could have the entire task processed by one program instead of 4, using threads if necessary.
There isn't anything wrong with PB's Select Case, I use it all the time, it's robust. So, there is probably a fault in your logic, if so it will be right there staring back at you but you won't see it straight away!
There isn't anything wrong with PB's Select Case, I use it all the time, it's robust. So, there is probably a fault in your logic, if so it will be right there staring back at you but you won't see it straight away!

IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.