Code Comments
Programming Forum and web based access to our favorite programming groups.I'm sorry to bother people with these, but I have not been able to find sensible answers to them by searching documentation. 1) Given variable which is to contain a string to be printed as several lines, how are the line breaks of the string to be indicated? I have tried "\n" and "^J", neither of which work. What's the right way? 2) The content of this variable would be RETURNed to the parent of the script. Because I do not have access to the parent right now, I am trying to simulate this by the output of a series of commands like "LINEOUT(outfile,singleline)". (I am not sure that this is a good emulation.) But even for the single-line case, I receive the following error: ***** sh: 0: command not found 67 *-* LINEOUT(outfile,singleline) +++ RC=127 +++ ***** although the content of singleline is transferred correctly to outfile. If the command works, why is it reported as unfound? -- yusakhar
Post Follow-up to this messageyusakhar wrote: > I'm sorry to bother people with these, but I have not been able to find > sensible answers to them by searching documentation. > > 1) Given variable which is to contain a string to be printed as several > lines, how are the line breaks of the string to be indicated? I have > tried "\n" and "^J", neither of which work. What's the right way? > > 2) The content of this variable would be RETURNed to the parent of the > script. Because I do not have access to the parent right now, I am trying > to simulate this by the output of a series of commands > like "LINEOUT(outfile,singleline)". (I am not sure that this is a good > emulation.) But even for the single-line case, I receive the following > error: > > ***** > sh: 0: command not found > 67 *-* LINEOUT(outfile,singleline) > +++ RC=127 +++ > ***** > > although the content of singleline is transferred correctly to outfile. If > the command works, why is it reported as unfound? > Actually, the interprer is NOT complaining about LINEOUT but what happens afterward. Assuming the line in your program is exactly what shows in the traceback - LINEOUT(outfile,singleline) - here is what happens. The expression is evaluated (which causes the contents of singleline to be appended to outfile) and the function returns a 0 indicating success. Now Rexx tries to evaluate that return code - 0 - which it does not recognize as a Rexx statement so it passes it to the operating system. It, too, doesn't recognize 0 as a valid command, hence the message. Your syntax should be either: call LINEOUT outfile,singleline or: throw_away_the_return_code = LINEOUT(outfile,singleline) Hope that helps! -- Gil Barmwater
Post Follow-up to this messageOn Wed, 26 Mar 2008 14:02:15 +0200 yusakhar <some.user@some.domain> wrote: :>I'm sorry to bother people with these, but I have not been able to find :>sensible answers to them by searching documentation. :>1) Given variable which is to contain a string to be printed as several :>lines, how are the line breaks of the string to be indicated? I have :>tried "\n" and "^J", neither of which work. What's the right way? Break it up into multiple SAY statements. :>2) The content of this variable would be RETURNed to the parent of the :>script. Because I do not have access to the parent right now, I am trying :>to simulate this by the output of a series of commands :>like "LINEOUT(outfile,singleline)". (I am not sure that this is a good :>emulation.) But even for the single-line case, I receive the following :>error: :>***** :>sh: 0: command not found :> 67 *-* LINEOUT(outfile,singleline) :> +++ RC=127 +++ :>***** :>although the content of singleline is transferred correctly to outfile. If :>the command works, why is it reported as unfound? Since you didn't assign the results of LINEOUT to a variable, it was passed to the current environment. You can also CALL lineout. -- Binyamin Dissen <bdissen@dissensoftware.com> http://www.dissensoftware.com Director, Dissen Software, Bar & Grill - Israel Should you use the mailblocks package and expect a response from me, you should preauthorize the dissensoftware.com domain. I very rarely bother responding to challenge/response systems, especially those from irresponsible companies.
Post Follow-up to this messageGil Barmwater wrote: > yusakhar wrote: > > Actually, the interprer is NOT complaining about LINEOUT but what > happens afterward. Assuming the line in your program is exactly what > shows in the traceback - LINEOUT(outfile,singleline) - here is what > happens. The expression is evaluated (which causes the contents of > singleline to be appended to outfile) and the function returns a 0 > indicating success. Now Rexx tries to evaluate that return code - 0 - > which it does not recognize as a Rexx statement so it passes it to the > operating system. It, too, doesn't recognize 0 as a valid command, > hence the message. Your syntax should be either: > > call LINEOUT outfile,singleline > > or: > > throw_away_the_return_code = LINEOUT(outfile,singleline) > > Hope that helps! It does. Thanks. I hope someone will address the question about multiline strings, which would make the script work as intended. -- yusakhar
Post Follow-up to this messageBinyamin Dissen wrote: > On Wed, 26 Mar 2008 14:02:15 +0200 yusakhar <some.user@some.domain> wrote: > > :>I'm sorry to bother people with these, but I have not been able to find > :>sensible answers to them by searching documentation. > > :>1) Given variable which is to contain a string to be printed as several > :>lines, how are the line breaks of the string to be indicated? I have > :>tried "\n" and "^J", neither of which work. What's the right way? > > Break it up into multiple SAY statements. I had hoped to avoid that. I was mistaken in thinking that there is an alias for newline for this case. Thanks for correcting me. -- yusakhar
Post Follow-up to this messageOn Wed, 26 Mar 2008 13:24:06 UTC, yusakhar <some.user@some.domain> wrote: > Binyamin Dissen wrote: > > > I had hoped to avoid that. I was mistaken in thinking that there is an ali as > for newline for this case. Thanks for correcting me. /* */ CRLF = '0a0d'X stuff = hello||crlf||world rc = lineout(STDOUT, stuff) HTH -- Regards Dave Saville NB Remove nospam. for good email address
Post Follow-up to this messageOn Wed, 26 Mar 2008 15:24:06 +0200, yusakhar wrote: > Binyamin Dissen wrote: > > I had hoped to avoid that. I was mistaken in thinking that there is an ali as > for newline for this case. Thanks for correcting me. newline window$ + OS/2, or newline linux? Jonesy -- Marvin L Jones | jonz | W3DHJ | linux 38.24N 104.55W | @ config.com | Jonesy | OS/2 *** Killfiling google posts: <http://jonz.net/ng.htm>
Post Follow-up to this messageIt's great that people provide solutions quickly. Here is my blog especially for mainframe professionals and why dont we share the knowledge globally? Please subscribe and post your issues/topics/ articles/polls here to get spread across.. Thanks Vivin On Mar 26, 5:02=A0pm, yusakhar <some.u...@some.domain> wrote: > I'm sorry to bother people with these, but I have not been able to find > sensible answers to them by searching documentation. > > 1) Given variable which is to contain a string to be printed as several > lines, how are the line breaks of the string to be indicated? I have > tried "\n" and "^J", neither of which work. What's the right way? > > 2) The content of this variable would be RETURNed to the parent of the > script. Because I do not have access to the parent right now, I am trying > to simulate this =A0by the output of a series of commands > like "LINEOUT(outfile,singleline)". (I am not sure that this is a good > emulation.) But even for the single-line case, I receive the following > error: > > ***** > sh: 0: command not found > =A0 =A0 67 *-* LINEOUT(outfile,singleline) > =A0 =A0 =A0 =A0+++ RC=3D127 +++ > ***** > > although the content of singleline is transferred correctly to outfile. If=[/color ] > the command works, why is it reported as unfound? > > -- > yusakhar
Post Follow-up to this messageHere is the blog: http://legacymainframe.wordpress.com. Thanks Vivin On Mar 26, 5:02=A0pm, yusakhar <some.u...@some.domain> wrote: > I'm sorry to bother people with these, but I have not been able to find > sensible answers to them by searching documentation. > > 1) Given variable which is to contain a string to be printed as several > lines, how are the line breaks of the string to be indicated? I have > tried "\n" and "^J", neither of which work. What's the right way? > > 2) The content of this variable would be RETURNed to the parent of the > script. Because I do not have access to the parent right now, I am trying > to simulate this =A0by the output of a series of commands > like "LINEOUT(outfile,singleline)". (I am not sure that this is a good > emulation.) But even for the single-line case, I receive the following > error: > > ***** > sh: 0: command not found > =A0 =A0 67 *-* LINEOUT(outfile,singleline) > =A0 =A0 =A0 =A0+++ RC=3D127 +++ > ***** > > although the content of singleline is transferred correctly to outfile. If=[/color ] > the command works, why is it reported as unfound? > > -- > yusakhar
Post Follow-up to this messageDave Saville wrote: > On Wed, 26 Mar 2008 13:24:06 UTC, yusakhar <some.user@some.domain> > wrote: > > > /* */ > > CRLF = '0a0d'X > > stuff = hello||crlf||world > > rc = lineout(STDOUT, stuff) > > HTH > Yeah, it's another one of those REXX warts, like needing an external shared library in order to delete a file...I have a standard setup function I use in all my nontrivial scripts that uses PARSE VERSION and returns the current platform's idea of newline, environment, unlink(), and so on, as global.7newline, global.7unlink,.... Annoying but not fundamental. (Needing the sevens is another minor REXX wart--lots of people use zeroes, but to me '7' is the least alphabetic-looking numeral, which helps reduce hard-to-find typos.) BTW on Windows and OS/2, that should be crlf = '0d0a'x. Cheers, Phil Hobbs
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.