On Wed, Jun 9, 2021 at 6:55 PM Johan Liebenberg <[email protected]> wrote:
> Thanks for the reply. > Yes as I said, it works just fine on Linux. I am trying to send some data > to another server, just a few headers with values. The code does not need > to check status as it should not interrupt the current process if it fails > for any reason whatsoever. > I would probably not do this from jBASE at all then, just monitor a transfer directory and write the data to be transferred there and move on. Otherwise your main program will hang around waiting for the curl etc. I don't know if the receiving end is jBASE or something else, but message queues are your friend, or even something as simple as scp. Think in parallel terms. > I will pick it up on the remote server if the process did not call in > successfully. Anyway, taking the exact code out of the gosub fixed it. Same > code, just no gosub and no return. Works fine on Linux, does not work on > Windows. > Which is why you should work out what is going on with your subroutine and EXECUTE. You may have found a way to get around it by duplicating code, but that is more likely to be masking the actual problem, which may come back to bite you later. > > I will rewrite some of it when I start using the jCurl command. Will have > to figure out if it is available on the older versions of jBase. > But is using a form of curl really the correct way to do this? > > On Wednesday, June 9, 2021 at 3:13:46 PM UTC+10 [email protected] > wrote: > >> 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/1d86ca99-8725-4601-ae4e-2dbf51ea872dn%40googlegroups.com > <https://groups.google.com/d/msgid/jbase/1d86ca99-8725-4601-ae4e-2dbf51ea872dn%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/CAGPPfg_u4tomzcJTvdeP2e3fVox3rsFvsZ9CdiLo31q-TeVZVQ%40mail.gmail.com.
