How do I parse with respect to a Linefeed character 
Author Message
 How do I parse with respect to a Linefeed character

Hello:
I've got a string of text that came from a unix machine where the lines are delimited
with LF characters.  I'd like to do something like this:

LF=x2c(0A);

DATA = the line
                       from the unix machine

parse value data with first LF second

This doesn't work at all.  In the general case (parsing lots of lines) it actually
sticks new values into LF.  I solved the problem using pos() and substr(), but
the parse value seems like the better way to go.

In all the examples that I've seen of parse value, they always use a character of
some sort in quotes, e.g. parse value time() with hrs ':' mins ':' sec,   which works
fine, but

a=':';
parse value time() with hrs a min a sec

does not seem to work.  How should I approach this problem?

Thanks,
Phil



Tue, 01 Dec 1998 03:00:00 GMT  
 How do I parse with respect to a Linefeed character

Quote:

>Hello:
>I've got a string of text that came from a unix machine where the lines are delimited
>with LF characters.  I'd like to do something like this:

>LF=x2c(0A);

>DATA = the line
>                       from the unix machine

>parse value data with first LF second

>This doesn't work at all.  In the general case (parsing lots of lines) it actually
>sticks new values into LF.  I solved the problem using pos() and substr(), but
>the parse value seems like the better way to go.

>In all the examples that I've seen of parse value, they always use a character of
>some sort in quotes, e.g. parse value time() with hrs ':' mins ':' sec,   which works
>fine, but

>a=':';
>parse value time() with hrs a min a sec

>does not seem to work.  How should I approach this problem?

>Thanks,
>Phil

I'm not sure what you are getting at, but if you just want to change the UNIX eol (LF?) to the OS/2 eol (CRLF?) then is is sufficient to read and write the line.
Ex.:
Quote:
>textLine=linein(unixfile)
>call lineout textLine

This is how I handle my Unix text files.
Furthermore, if you have IBM's TCP/IP for OS/2 installed, you will find a translation utility (both directions) in the \tcpip\bin directory

Koos
----------------------------------------------------------------------
S.C. Pol                                         Phone: +31 20 3116122
PC Systems Administrator                         Fax  : +31 20 3116133

Amsterdam
The Netherlands                    "Please DO disturb. I was working!"
----------------------------------------------------------------------



Fri, 04 Dec 1998 03:00:00 GMT  
 How do I parse with respect to a Linefeed character

Quote:

>Hello:
>I've got a string of text that came from a unix machine where the lines are delimited
>with LF characters.  I'd like to do something like this:

>LF=x2c(0A);

>DATA = the line
>                       from the unix machine

>parse value data with first LF second

Try

 parse var data first (LF) second

The parentheses tell it to parse on the value of the variable rather
than fill the variable itself.

--------------------------------------------------------------
Dirk Terrell,  Poole-Terrell Consulting, maintainers of
The Aquatic Center web page   - http://www.*-*-*.com/
The Lloyd Bailey's Scuba Page - http://www.*-*-*.com/
The {*filter*}space Yellow Pages   - http://www.*-*-*.com/
The Gainesville Web           - http://www.*-*-*.com/
--------------------------------------------------------------



Fri, 04 Dec 1998 03:00:00 GMT  
 How do I parse with respect to a Linefeed character

Quote:

>Hello:
>I've got a string of text that came from a unix machine where the lines are delimited
>with LF characters.  I'd like to do something like this:

>LF=x2c(0A);

>DATA = the line
>                       from the unix machine

>parse value data with first LF second

>This doesn't work at all.  In the general case (parsing lots of lines) it actually
>sticks new values into LF.  I solved the problem using pos() and substr(), but
>the parse value seems like the better way to go.

>In all the examples that I've seen of parse value, they always use a character of
>some sort in quotes, e.g. parse value time() with hrs ':' mins ':' sec,   which works
>fine, but

>a=':';
>parse value time() with hrs a min a sec

>does not seem to work.  How should I approach this problem?

>Thanks,
>Phil

Try using Parse allrecs reca '0a'x recb '0a'x recc '0a'x recd


Fri, 04 Dec 1998 03:00:00 GMT  
 How do I parse with respect to a Linefeed character

Quote:

>Hello:
>I've got a string of text that came from a unix machine where the lines are delimited
>with LF characters.  I'd like to do something like this:

>LF=x2c(0A);

>DATA = the line
>                       from the unix machine

>parse value data with first LF second

As you found,  this doesn't work.

In VM Rexx (and I presume other implementations) you need to enclose the
LF in parens to insicate that it isn't just a variable to fill from the
input data.  i.e.:

   parse value data with first (LF) second
--
Rich Greenberg            

Pacific time.    I speak for myself & my dogs only.        VM'er since CP-67
Canines: Val(Chinook,CGC), Red(Husky,(RIP)), Shasta(Husky)



Sat, 05 Dec 1998 03:00:00 GMT  
 How do I parse with respect to a Linefeed character

Quote:

>I've got a string of text that came from a unix machine where the lines are delimited
>with LF characters.  I'd like to do something like this:

>LF=x2c(0A);

>DATA = the line
>                       from the unix machine
>parse value data with first LF second

>This doesn't work at all.  In the general case (parsing lots of lines) it actually
>sticks new values into LF.  I solved the problem using pos() and substr(), but
>the parse value seems like the better way to go.
>In all the examples that I've seen of parse value, they always use a character of
>some sort in quotes, e.g. parse value time() with hrs ':' mins ':' sec,   which works
>fine, but

>a=':';
>parse value time() with hrs a min a sec
>does not seem to work.  How should I approach this problem?

This might work........

s='0A'x
Parse var line useful (s) rest

Hope it helps........Rachel



Sun, 06 Dec 1998 03:00:00 GMT  
 How do I parse with respect to a Linefeed character

Quote:


>I've got a string of text that came from a unix machine where the lines are
 delimited
>with LF characters.  I'd like to do something like this:

>LF=x2c(0A);

LF='0A'x  (just a simple way)

Quote:
>DATA = the line
>                       from the unix machine
>parse value data with first LF second
>This doesn't work at all.  In the general case (parsing lots of lines) it

 actually

Because of wrong keywords. Use "var" keyword instead of "value" eg.

parse VAR data first (LF) second

Quote:
>sticks new values into LF.  I solved the problem using pos() and substr(), but
>the parse value seems like the better way to go.
>In all the examples that I've seen of parse value, they always use a character
 of
>some sort in quotes, e.g. parse value time() with hrs ':' mins ':' sec, which
 works
>fine, but

>a=':';
>parse value time() with hrs a min a sec
>does not seem to work.  How should I approach this problem?

If you want to use variable as separator you must enclose it
inside brackets.

parse value time() with hrs (a) min (a) sec

Cem Turgay



Mon, 07 Dec 1998 03:00:00 GMT  
 How do I parse with respect to a Linefeed character

FWIW, if you hav entire files to convert, then pick up the flip utility off
the hobbes site.


:>
:>
:>>I've got a string of text that came from a unix machine where the lines are
:> delimited
:>>with LF characters.  I'd like to do something like this:
:>>
:>>LF=x2c(0A);
:>
:>LF='0A'x  (just a simple way)
:>
:>>DATA = the line
:>>                       from the unix machine
:>>parse value data with first LF second
:>>This doesn't work at all.  In the general case (parsing lots of lines) it
:> actually
:>
:>Because of wrong keywords. Use "var" keyword instead of "value" eg.
:>
:>parse VAR data first (LF) second
:>
:>>sticks new values into LF.  I solved the problem using pos() and substr(), but
:>>the parse value seems like the better way to go.
:>>In all the examples that I've seen of parse value, they always use a character
:> of
:>>some sort in quotes, e.g. parse value time() with hrs ':' mins ':' sec, which
:> works
:>>fine, but
:>>
:>>a=':';
:>>parse value time() with hrs a min a sec
:>>does not seem to work.  How should I approach this problem?
:>
:>If you want to use variable as separator you must enclose it
:>inside brackets.
:>
:>parse value time() with hrs (a) min (a) sec
:>
:>
:>Cem Turgay

Paul



Tue, 08 Dec 1998 03:00:00 GMT  
 How do I parse with respect to a Linefeed character

Quote:

> FWIW, if you hav entire files to convert, then pick up the flip utility off
> the hobbes site.
> Paul

I'm not to person who wish to convert something.

Cem Turgay



Tue, 08 Dec 1998 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. replacing ^M characters with linefeed

2. Linefeed Character

3. '"""' and linefeed characters

4. Parsing - What am I doing wrong?

5. Converting INTEGER to CHARACTER - can it be done?

6. Need suggestion on doing character-graphic testing

7. Converting INTEGER to CHARACTER - can it be done?

8. Converting INTEGER to CHARACTER - can it be done?

9. Putting Dilimiter Character in Output Line for Parsing?

10. Help me parse a long character

11. Help me parse a long character

12. parsing an xml document with funky ascii characters

 

 
Powered by phpBB® Forum Software