Code Comments
Programming Forum and web based access to our favorite programming groups.Allodoxaphobia wrote: > On Wed, 26 Mar 2008 15:24:06 +0200, yusakhar wrote: > > newline window$ + OS/2, or newline linux? > > Jonesy The script is for use in a Linux system. The problem that is beyond me is: Given a long string (than can be PARSEd to line-length pieces), to form the pieces into a multiline text variable which can be passed to a parent process by a RETURN statement. -- 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 > That looks like what I want. But (it is a Linux system) I think I need only the LF, so it would be '0A'X. It would be very easy to embed ||'0A'X|| in the file of long strings, because it is obvious where the linebreaks belong. so I would not need to code the PARSE. Thanks. -- yusakhar
Post Follow-up to this messageOn Wed, 26 Mar 2008 07:43:19 -0700 (PDT), legacymainframe@gmail.com wrote: > Here is the blog: http://legacymainframe.wordpress.com. Which opened up as a totally blank page in konqueror. W3C Validator offers a clue: http://tinyurl.com/3x4qo6 It played better in Opera. 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 messageIn <47eaa251$0$23348$c3e8da3@news.astraweb.com>, on 03/26/2008 at 09:22 PM, yusakhar <some.user@some.domain> said: >The script is for use in a Linux system. Then you need to concatenate LF between lines. -- Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel> Unsolicited bulk E-mail subject to legal action. I reserve the right to publicly post or ridicule any abusive E-mail. Reply to domain Patriot dot net user shmuel+news to contact me. Do not reply to spamtrap@library.lspace.org
Post Follow-up to this messageIn <47ea3aa5$0$23425$c3e8da3@news.astraweb.com>, on 03/26/2008 at 02:02 PM, yusakhar <some.user@some.domain> said: >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. Why would you expect them to? In REXX there are no metacharacters other than the trivial case of having to double the framing characters in a quoted string, e.g., 'this '' is an apostrope' and "this "" is a quote." If you want to use a control character, express it as hex, e.g., Ctrl_J='0a'x. >What's the right way? Define CRLF in hex, then concatenate. Depending on the platform, you might need CR, LF, CRLF or NL, in the appropriate code. >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)". That's not a command, it's a function. >(I am not sure that this is a good emulation.) CHAROUT(outfile,singleline) might be more appropriate. but LINEOUT should work. >sh: 0: command not found That's because LINEOUT is a function. When a statement contains only an expression, the value of that expression is treated as a command in the default environment. As others have noted, you need to one of call LINEOUT outfile, singleline status=LINEOUT(outfile,singleline) >although the content of singleline is transferred correctly to outfile. >If the command works, why is it reported as unfound? It isn't; look at the message and you will see that "0" is the command not found. -- Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel> Unsolicited bulk E-mail subject to legal action. I reserve the right to publicly post or ridicule any abusive E-mail. Reply to domain Patriot dot net user shmuel+news to contact me. Do not reply to spamtrap@library.lspace.org
Post Follow-up to this messageyusakhar wrote: > The script is for use in a Linux system. The problem that is beyond me is: > > Given a long string (than can be PARSEd to line-length pieces), to form th e > pieces into a multiline text variable which can be passed to a parent > process by a RETURN statement. As others have told you, you can insert the correct newline character(s) into the string and issue it in one go. In general, you can parse any length delimited string as follows (note that this example works with any delimiter, it simply requires the first character of the string to be the delimiter): null = '00'x teststring = null"String 1"null"string 2"null"String 3" PARSE VAR teststring delim +1 teststring DO WHILE teststring \= "" PARSE VAR teststring onepiece (delim) teststring SAY onepiece END You can substitute a multi-character delimiter if you need to by changing "+1" in the first PARSE. Graham.
Post Follow-up to this messageOn Wed, 26 Mar 2008 17:04:17 UTC, Phil Hobbs <pcdh@SpamMeSenseless.pergamos.net> wrote: > BTW on Windows and OS/2, that should be crlf = '0d0a'x. I know, I did it from memory and had a 50% chance of gettting it right :-) Actually it works either way around. -- Regards Dave Saville NB Remove nospam. for good email address
Post Follow-up to this message"Graham" <norrisg@spam_free.linkline.com> wrote in message news:--adnTGKdZ3Ui3banZ2dnUVZ_h6hnZ2d@linkline.com... > null = '00'x > teststring = null"String 1"null"string 2"null"String 3" > PARSE VAR teststring delim +1 teststring > DO WHILE teststring \= "" > PARSE VAR teststring onepiece (delim) teststring > SAY onepiece > END > > You can substitute a multi-character delimiter if you need to by changing > "+1" in the first PARSE. > > Graham. Wonderful! I first saw this construct in some inherited code (pun not intended) virtually word-for-word and I've re-used it several times and never stopped long enought to smell the roses... it was obvious what it did. Now I see it explained (albeit without any real explanation) I like it even better. Phil ----
Post Follow-up to this messageDave Saville wrote: > On Wed, 26 Mar 2008 17:04:17 UTC, Phil Hobbs > <pcdh@SpamMeSenseless.pergamos.net> wrote: > > > I know, I did it from memory and had a 50% chance of gettting it right > :-) Actually it works either way around. Putting the linefeed before the carriage return? You complete Bolshevik, you. Cheers, Phil Hobbs
Post Follow-up to this messageOn Fri, 28 Mar 2008 14:34:46 -0500, Phil Hobbs <pcdhSpamMeSenseless@pergamos.net> wrote: > Putting the linefeed before the carriage return? You complete > Bolshevik, you. Wouldn't that make him a Menshevik? Best, Tony
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.