I usually find that it is better to say what you are trying to do first. Maybe your approach is not optimal? As in tell us:
"I need to contact an http server at http:// and retrieve xyz" Whereas here you are assuming your approach is the correct one, then saying it isn't working. we should probably work out why you are seeing what you seem to be seeing, but it may well be that your approach is incorrect. The compiler will not generate bad code for GOSUB and RETURN - if it did, a lot more people would be complaining ;). It tends to make me think that you are not executing the binary that you think you are. Maybe run from a command line instead of jsh for instance. Also, when executing external scripts, you would likely be better specifying EXECUTE with CHAR(255):"<shell indicator":"curl ....." - not specifying a shell may well be why EXECUTE of your command line is not working. You should also use the additional clauses in EXECUTE to capture exit codes and errors etc. Your code is just assuming that it works, which is never a good idea. I would also recommend Linux over Windows, but that's just a preference. Things always seem to work better. So, what are you actually trying to do here? There are probably 20 different ways if we know what you are doing. Jim On Mon, Jun 7, 2021 at 12:00 AM Johan Liebenberg <[email protected]> wrote: > jBASE 5.2.31 on Windows Server 2012. > > Yes thanks I saw the jCURL command and I will investigate in future to do > a switch over. Anyway, I got the batch file thing to work by not calling > the subroutine and instead calling the same code in 3 different places. > More cleanup to do later. > > Thanks :) > > On Friday, June 4, 2021 at 11:37:37 PM UTC+10 pfalson wrote: > >> What version of jBASE are you using? We support curl natively now >> >> >> https://docs.zumasys.com/jbase/miscellaneous/jcurl/#additional-helper-functions >> >> Sent from my iPhone >> >> On Jun 4, 2021, at 5:29 AM, Johan Liebenberg <[email protected]> wrote: >> >> >> >> Building a small batch file to run on a Window jBase server. >> >> Batch file executes a curl command build inside the jBase program. >> >> I 1st tried to EXECUTE the curl command CAPTURING RESULTS, but the remote >> server returns an error. I filtered all the illegal character out of the >> curl command just in case. No luck.This happens to work flawlessly on a >> Linux server. >> >> So the next approach is to create a DOS batch file and execute the batch >> file with the curl command inside the batch file. Works 1st time but then >> the trouble starts: >> >> So I have a GOSUB RUNCMD that calls the sub below with the curl command >> inside the CMD variable: >> >> RUNCMD: >> >> OSDELETE 'temp.bat' >> >> EXECUTE 'touch temp.bat' CAPTURING JUNK >> >> OSOPEN 'temp.bat' TO TEMPDOSFILE THEN >> >> OSBWRITE CMD ON TEMPDOSFILE AT 0 >> >> OSCLOSE TEMPDOSFILE >> >> EXECUTE 'temp.bat' CAPTURING RESULTS >> >> END >> >> OSDELETE 'temp.bat' >> >> RETURN >> With the debugger turned on, outside RUNCMD sub, I can follow the >> progress through the sub line by line, everything works and the remote >> server receives the curl command correctly and returns the correct data in >> the RESULTS variable. All good. When the execution gets to the RETURN >> command, one expects it to jump back to the 1st line after the GOSUB >> RUNCMD, but instead it jumps back to the RUNCMD: label and it repeats the >> sub over and over in a loop that you can not break out of. >> >> Surely I am very tired because it is late and I am missing something >> really really obvious. Thanks for looking :) >> >> -- >> -- >> IMPORTANT: T24/Globus posts are no longer accepted on this forum. >> >> To post, send email to [email protected] >> To unsubscribe, send email to [email protected] >> For more options, visit this group at >> http://groups.google.com/group/jBASE?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "jBASE" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jbase/64144341-a743-4e2b-9824-8cfda8f609f9n%40googlegroups.com >> <https://groups.google.com/d/msgid/jbase/64144341-a743-4e2b-9824-8cfda8f609f9n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> -- > -- > IMPORTANT: T24/Globus posts are no longer accepted on this forum. > > To post, send email to [email protected] > To unsubscribe, send email to [email protected] > For more options, visit this group at > http://groups.google.com/group/jBASE?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "jBASE" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jbase/df6af11c-1987-4d92-a718-8e87378be89cn%40googlegroups.com > <https://groups.google.com/d/msgid/jbase/df6af11c-1987-4d92-a718-8e87378be89cn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- -- IMPORTANT: T24/Globus posts are no longer accepted on this forum. To post, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jBASE?hl=en --- You received this message because you are subscribed to the Google Groups "jBASE" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/CAGPPfg8LDAs%3DQh7rSckx%3D3L6vfVaYK%3DRq2vp8JvwavCyNzULJw%40mail.gmail.com.
