Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Some ignorant questions about text handling
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

Report this thread to moderator Post Follow-up to this message
Old Post
yusakhar
03-26-08 01:19 PM


Re: Some ignorant questions about text handling
yusakhar 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


Report this thread to moderator Post Follow-up to this message
Old Post
Gil Barmwater
03-26-08 01:19 PM


Re: Some ignorant questions about text handling
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.

:>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.

Report this thread to moderator Post Follow-up to this message
Old Post
Binyamin Dissen
03-26-08 01:19 PM


Re: Some ignorant questions about text handling
Gil 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

Report this thread to moderator Post Follow-up to this message
Old Post
yusakhar
03-26-08 01:19 PM


Re: Some ignorant questions about text handling
Binyamin 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

Report this thread to moderator Post Follow-up to this message
Old Post
yusakhar
03-27-08 12:57 AM


Re: Some ignorant questions about text handling
On 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

Report this thread to moderator Post Follow-up to this message
Old Post
Dave Saville
03-27-08 12:57 AM


Re: Some ignorant questions about text handling
On 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>

Report this thread to moderator Post Follow-up to this message
Old Post
Allodoxaphobia
03-27-08 12:57 AM


Re: Some ignorant questions about text handling
It'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


Report this thread to moderator Post Follow-up to this message
Old Post
legacymainframe@gmail.com
03-27-08 12:57 AM


Re: Some ignorant questions about text handling
Here 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


Report this thread to moderator Post Follow-up to this message
Old Post
legacymainframe@gmail.com
03-27-08 12:57 AM


Re: Some ignorant questions about text handling
Dave 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

Report this thread to moderator Post Follow-up to this message
Old Post
Phil Hobbs
03-27-08 12:57 AM


Sponsored Links




Last Thread Next Thread Next
Pages (3): [1] 2 3 »
Search this forum -> 
Post New Thread

Rexx archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 11:11 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.