Does Purebasic have an equivalent to the "CHAIN" statement
Does Purebasic have an equivalent to the "CHAIN" statement
I am in the process of choosing a Windows GUI development tool and have started looking at Powerbasic and Purebasic. Although I have substantial experience developing ERP related applications in procedural BASIC using character based environments, event driven GUI development is completely different and difficult to evaluate for newcomers like me. So far I have reached the opinion that modern GUI BASIC implementations have far more in common with "C" than the older BASIC dialects. To a certain extent this is unfortunate given that I particularly dislike "C". In my opinion "C" is not particularly well suited to database orientated business applications development. It also seems to me that each GUI BASIC implementation has many differences (e.g. Powerbasic and Purebasic seem very different to one another). My current preference favours Purebasic, although this is mainly related to the advantage of "try before you buy" which does not exist for Powerbasic. Also, the Purebasic community seems generally more content than their Powerbasic counterparts.
Although I have not yet tried either Purebasic or Powerbasic, I have been reading about these products online and I'm hoping some experienced current users might help answer some of the questions I have before taking the plunge.
I currently need to understand how (or if) control can be passed from one program to another automatically. I am used to using the "CHAIN" statement to do this in traditional BASIC and have no idea how this concept is handled in Purebasic. Any comments on this would be appreciated.
Thanks
Although I have not yet tried either Purebasic or Powerbasic, I have been reading about these products online and I'm hoping some experienced current users might help answer some of the questions I have before taking the plunge.
I currently need to understand how (or if) control can be passed from one program to another automatically. I am used to using the "CHAIN" statement to do this in traditional BASIC and have no idea how this concept is handled in Purebasic. Any comments on this would be appreciated.
Thanks
Re: Does Purebasic have an equivalent to the "CHAIN" statement
CHAIN is useless on a modern os with virtuell memory.
Greetings
Thomas
Greetings
Thomas
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Does Purebasic have an equivalent to the "CHAIN" statement
Have a look at the docs for RunProgram() and see if it will meet your needs. Imho it probably will.
BERESHEIT
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
Re: Does Purebasic have an equivalent to the "CHAIN" statement
I thought the SQL Tools library in PowerBasic was an addon feature? That is why I decided to write my POS application in Purebasic.
That and there was support from such kindly people who have already answered this thread!
Have you looked at GLBasic as well? LibertyBASIC?
http://www.thefreecountry.com/compilers/basic.shtml
OR ALSO
http://basic.mindteq.com/index.php/full ... -list.html
That and there was support from such kindly people who have already answered this thread!
Have you looked at GLBasic as well? LibertyBASIC?
http://www.thefreecountry.com/compilers/basic.shtml
OR ALSO
http://basic.mindteq.com/index.php/full ... -list.html
Re: Does Purebasic have an equivalent to the "CHAIN" statement
Thank you all for the comments and assistance
NETMAESTRO
You are correct. RunProgram() appears to be very well suited to my needs. Thanks for your very precise help and expertise.
ROOK ZIMBABWE
Like you, I got the impression that using a relational database would be painful in Powerbasic, otherwise the additional SQL Tools package would not be required.
Your reference to "Support from kindly people" sums up the impression I had when attempting to gauge the way people view the Purebasic community. I could sense what appeared to be positive vibes in comparison to other products.
Yes, I did take a look at the other BASIC variants you mention when narrowing down my focus to Purebasic and Powerbasic. Realbasic was another significant contender. Nevertheless, I appreciate your suggestions - Thanks.
THOMAS
A CHAIN or equivalent facility is very useful in the context of ERP (Enterprise Resource Planning) applications, where hundreds of individual programs need to be used. Ease of user application identification and selection, programming code maintenance and multisession capabilities are all reasons to use such an approach. I am not concerned about memory limitations in any way, it is the organisation and clarity that I value.
NETMAESTRO
You are correct. RunProgram() appears to be very well suited to my needs. Thanks for your very precise help and expertise.
ROOK ZIMBABWE
Like you, I got the impression that using a relational database would be painful in Powerbasic, otherwise the additional SQL Tools package would not be required.
Your reference to "Support from kindly people" sums up the impression I had when attempting to gauge the way people view the Purebasic community. I could sense what appeared to be positive vibes in comparison to other products.
Yes, I did take a look at the other BASIC variants you mention when narrowing down my focus to Purebasic and Powerbasic. Realbasic was another significant contender. Nevertheless, I appreciate your suggestions - Thanks.
THOMAS
A CHAIN or equivalent facility is very useful in the context of ERP (Enterprise Resource Planning) applications, where hundreds of individual programs need to be used. Ease of user application identification and selection, programming code maintenance and multisession capabilities are all reasons to use such an approach. I am not concerned about memory limitations in any way, it is the organisation and clarity that I value.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Does Purebasic have an equivalent to the "CHAIN" statement
Hello Nigel
I'm new to PB myself. As a C programmer, I say yes, there are a few similarities, PB is procedural. In terms of churning out fast, reliable GUI supporting code quickly, PB is far better than C on the Windows platform. PB is easy to learn but perhaps it's greatest plus point is the knowledge and helpfulness of the forum experts. If there is a better forum on programming with any language, I have not seen it.
I'm new to PB myself. As a C programmer, I say yes, there are a few similarities, PB is procedural. In terms of churning out fast, reliable GUI supporting code quickly, PB is far better than C on the Windows platform. PB is easy to learn but perhaps it's greatest plus point is the knowledge and helpfulness of the forum experts. If there is a better forum on programming with any language, I have not seen it.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
-
- Enthusiast
- Posts: 469
- Joined: Sun Mar 16, 2008 9:18 am
Re: Does Purebasic have an equivalent to the "CHAIN" statement
You should explain what this mysterious "CHAIN" statement does, because I for one have no idea, so I can't help you. There may be an equivalent PureBasic command, but without knowing what "CHAIN" does, I can't say. From NM's comment it seems to be a command to launch another app? Is that right?nigel wrote:I currently need to understand how (or if) control can be passed from one program to another automatically. I am used to using the "CHAIN" statement to do this in traditional BASIC and have no idea how this concept is handled in Purebasic.
Re: Does Purebasic have an equivalent to the "CHAIN" statement
Hi,
since I also not knowing what CHAIN does, I googled a bit:
http://www.qbasicstation.com/index.php?c=t_adv&t=2
CHAIN itself can replaced with RunProgram(), but more interessting is the
COMMON SHARED instruction.
It looks like it generates a 'shared memory' which is accessible from both individual programs.
I think that's not directly possible PB commands.
(if you start EXE files with the CHAIN command)
But since I'm still a newbie, I don't know it exactly.
Bernd
since I also not knowing what CHAIN does, I googled a bit:
http://www.qbasicstation.com/index.php?c=t_adv&t=2
CHAIN itself can replaced with RunProgram(), but more interessting is the
COMMON SHARED instruction.
It looks like it generates a 'shared memory' which is accessible from both individual programs.
I think that's not directly possible PB commands.
(if you start EXE files with the CHAIN command)
But since I'm still a newbie, I don't know it exactly.
Bernd
Re: Does Purebasic have an equivalent to the "CHAIN" statement
Could you provide a little more information on the way you want to use 'chain'? Is it indeed the sharing of data you're looking at? If so, how much data?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: Does Purebasic have an equivalent to the "CHAIN" statement
CHAIN runs another program, like RUN "progname" in Business Basic, bringing the contents of all variables and opened files to the new loaded program.
I believe that you would like to run programs separately, for example starting with a menu, if one selects choice #2, it runs this program, and when finished it "chains" back to the menu.
Well, in PureBasic I do that this way:
The main procedure is the menu (menubar), and when one selects choice #2, it executes the procedure associated in a new window, and when finished, I close the window and leave the procedure, it comes automatically back to the menu.
I only need to include all the procedures once in the main program. This way you can write every procedure separately.
I do not chain to external programs, unless necessary (to run a third party program, like Excel or executing an EXE file which has command line options)...
I have also tested several languages before and PureBasic was my final choice, because PureBasic is easy to understand, well structured, actual, fast (memory addressing with pointers), and especially, there are excellent and kind people on this forum. Up to now I always had the solution to my programming problems in less than 24 hours thanks to the forum. A gold rule: always post a clever and simple example together with your problem, you will get the answer very quickly.
With PureBasic, you are making the right choice.
I believe that you would like to run programs separately, for example starting with a menu, if one selects choice #2, it runs this program, and when finished it "chains" back to the menu.
Well, in PureBasic I do that this way:
The main procedure is the menu (menubar), and when one selects choice #2, it executes the procedure associated in a new window, and when finished, I close the window and leave the procedure, it comes automatically back to the menu.
I only need to include all the procedures once in the main program. This way you can write every procedure separately.
I do not chain to external programs, unless necessary (to run a third party program, like Excel or executing an EXE file which has command line options)...
I have also tested several languages before and PureBasic was my final choice, because PureBasic is easy to understand, well structured, actual, fast (memory addressing with pointers), and especially, there are excellent and kind people on this forum. Up to now I always had the solution to my programming problems in less than 24 hours thanks to the forum. A gold rule: always post a clever and simple example together with your problem, you will get the answer very quickly.
With PureBasic, you are making the right choice.
- Windows 11 Home 64-bit
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Re: Does Purebasic have an equivalent to the "CHAIN" statement
Bringing the 'variables' across would only be possible with an interpreted or semi compiled language. I would rethink the application before thinking it will be an easy conversion. Maybe dragging the application suite (kicking and screaming) "as is" into the 21st century will be harder than you think.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
Re: Does Purebasic have an equivalent to the "CHAIN" statement
Yes, CHAIN is designed for DOS with small memory. See my first postDoubleDutch wrote:Bringing the 'variables' across would only be possible with an interpreted or semi compiled language. I would rethink the application before thinking it will be an easy conversion. Maybe dragging the application suite (kicking and screaming) "as is" into the 21st century will be harder than you think.

You can communicate between 2 or more programs but in a other way.
SharedMemorie, Environmentvariables, Network, Pipes ...
Greetings
Thomas
Re: Does Purebasic have an equivalent to the "CHAIN" statement
Thanks to all commenters.
I can already see how vibrant the Purebasic community is and I am mightily impressed with the quality of the posted responses. The numerous compliments made about this forum of Purebasic users are all well justified.
Although I am now pleased to know that the Runprogram() statement should meet my needs, I certainly owe more in the way of background explanation to my original question. Particularly as some respondents have offered details above and beyond my reasonable expectations. Some of the responses have addressed aspects of the question which I had not explicitly requested, indicating consideration of subtleties which may easily have added value to my understanding. I am impressed.
Most of my contemporary programming time has been spent using the OpenVMS operating system on HP server platforms where my language of choice is HP BASIC. At a hobbyist level back in the day, I also enjoyed using BASIC dialects like QUICKBASIC on the x86 platform. Most (Non-GUI) BASIC dialects included the CHAIN statement which permits automated transfer of control from one program to another.
I had long ago developed (and still currently maintain) a commercial menu driven character based ERP software package and currently plan on developing a version or subset of this using a GUI based client-server model in order to cater to a clientele who perceive GUI to be more desirable. I had even half-considered using web based development tools but abandoned this thought fairly quickly as the web cannot really cut it yet in all the important ways that matter for this category of applications.
My ERP application includes 12 business modules such as General Ledger, Accounts Payable, Inventory Control etc. not all of which are required by an individual client company. Each module has its own menu which offers up to 40 individual application selections. Currently these applications are launched individually by "CHAINING" from (and back to) a single Master Menu Program. The Menu program also handles the security aspects of deciding which users have access to individual applications. As some commenters have correctly and intelligently suspected, I do use a COMMON memory facility to pass information between the "CHAINING" programs although this consists only of security related information which does not need to be passed anywhere as long as the master menu program remains active (As opposed to being CHAINED back to). In the case of my applications there is no preservation of variable contents or opened files when CHAINING to a new loaded program.
The comment by charvista was interesting and although the method described by charvista would be practical (and superior) for smaller scale menu driven solutions, it is likely not well suited to cases like mine where over 400 programs are involved. As someone without any GUI BASIC experience, I could be completely wrong and there may be better ways to structure my applications.
Thank you all for the valuable input.
I can already see how vibrant the Purebasic community is and I am mightily impressed with the quality of the posted responses. The numerous compliments made about this forum of Purebasic users are all well justified.
Although I am now pleased to know that the Runprogram() statement should meet my needs, I certainly owe more in the way of background explanation to my original question. Particularly as some respondents have offered details above and beyond my reasonable expectations. Some of the responses have addressed aspects of the question which I had not explicitly requested, indicating consideration of subtleties which may easily have added value to my understanding. I am impressed.
Most of my contemporary programming time has been spent using the OpenVMS operating system on HP server platforms where my language of choice is HP BASIC. At a hobbyist level back in the day, I also enjoyed using BASIC dialects like QUICKBASIC on the x86 platform. Most (Non-GUI) BASIC dialects included the CHAIN statement which permits automated transfer of control from one program to another.
I had long ago developed (and still currently maintain) a commercial menu driven character based ERP software package and currently plan on developing a version or subset of this using a GUI based client-server model in order to cater to a clientele who perceive GUI to be more desirable. I had even half-considered using web based development tools but abandoned this thought fairly quickly as the web cannot really cut it yet in all the important ways that matter for this category of applications.
My ERP application includes 12 business modules such as General Ledger, Accounts Payable, Inventory Control etc. not all of which are required by an individual client company. Each module has its own menu which offers up to 40 individual application selections. Currently these applications are launched individually by "CHAINING" from (and back to) a single Master Menu Program. The Menu program also handles the security aspects of deciding which users have access to individual applications. As some commenters have correctly and intelligently suspected, I do use a COMMON memory facility to pass information between the "CHAINING" programs although this consists only of security related information which does not need to be passed anywhere as long as the master menu program remains active (As opposed to being CHAINED back to). In the case of my applications there is no preservation of variable contents or opened files when CHAINING to a new loaded program.
The comment by charvista was interesting and although the method described by charvista would be practical (and superior) for smaller scale menu driven solutions, it is likely not well suited to cases like mine where over 400 programs are involved. As someone without any GUI BASIC experience, I could be completely wrong and there may be better ways to structure my applications.
Thank you all for the valuable input.
Re: Does Purebasic have an equivalent to the "CHAIN" statement
By the sounds of it your trying to emulate a unix like paradigm with separate programs.
As long as the applications are written to receive command line parameters then there isn't really an issue apart from it not being a very secure method
There are various ways to enable inter process communications, memory mapping, named pipes, CopyData via send message.
Copydata is a good choice for passing in vars and mapped files are better for sharing resources and more secure than using a named pipe since a pipes can be exposed as a directory.
So you could use RunProgram passing in a hwnd then copydata to set the vars and use a mapped file or named pipe between the processes.
As long as the applications are written to receive command line parameters then there isn't really an issue apart from it not being a very secure method
There are various ways to enable inter process communications, memory mapping, named pipes, CopyData via send message.
Copydata is a good choice for passing in vars and mapped files are better for sharing resources and more secure than using a named pipe since a pipes can be exposed as a directory.
So you could use RunProgram passing in a hwnd then copydata to set the vars and use a mapped file or named pipe between the processes.
Re: Does Purebasic have an equivalent to the "CHAIN" statement
Another option is the use of mailslots, or good ol' fashioned <shudder> semaphore files....
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )