Computing.Net > Forums > OpenVMS > To split a string with a space

To split a string with a space

Reply to Message Icon

Original Message
Name: Sharitha
Date: October 6, 2004 at 06:05:00 Pacific
Subject: To split a string with a space
OS: OpenVMS
CPU/Ram: DS20E
Comment:

Hi,
I have file in whish the record are stored as
30 95
40 89

i need to read this file line by line and split the String into 2 variables
eg: variable a =30
varibale b=95
Kindly help

Shari


Report Offensive Message For Removal


Response Number 1
Name: Hakan Andersson (by HakAnd)
Date: October 6, 2004 at 07:27:59 Pacific
Reply: (edit)

a = f$element(0," ",string)
b = f$element(1," ",string)


Report Offensive Follow Up For Removal

Response Number 2
Name: Bob Gezelter
Date: October 6, 2004 at 08:44:04 Pacific
Reply: (edit)

Shari,

Hakan has provided an example of how to split the records in DCL, the command language used on OpenVMS.

Taking a second look at your posting, it occurs to me that you did not mention the language you are using. If we know the language, the answer may be clearer.

- Bob Gezelter


Report Offensive Follow Up For Removal

Response Number 3
Name: Hakan Andersson (by HakAnd)
Date: October 6, 2004 at 09:20:57 Pacific
Reply: (edit)

As Bob mentioned, I took for granted that a DCL command was requested........


Report Offensive Follow Up For Removal

Response Number 4
Name: VMSFan
Date: October 7, 2004 at 14:30:52 Pacific
Reply: (edit)

It might also help to:

F$EDIT(string, "COMPRESS,TRIM")

before using F$ELEMENT (just in case there may be extra spaces).


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: To split a string with a space

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge