Welcome, Guest. Please login or register.

Author Topic: Problems with PARSE (Rexx)  (Read 1746 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show only replies by iamaboringperson
Problems with PARSE (Rexx)
« on: July 31, 2006, 01:43:00 AM »
Hi, I've been having troubles with the Rexx PARSE instruction.

When I want the first part of a string I get nothing.

EG.

Code: [Select]

BLAH="1.2.3"

PARSE VAR BLAH WITH num1'.'num2'.'num3

SAY NUM1 NUM2 NUM3

I get:

2 3

The only way I've been able to work around this, is to put something in front of the variable.

Like so:

Quote

BLAH="1.2.3"

BLAH_T='a'BLAH

PARSE VAR BLAH_T WITH 'a'num1'.'num2'.'num3

SAY NUM1 NUM2 NUM3


But this is inelegant, and it messes with the data. It's possible that depending on what data is coming in, it may not work.

Surely there is some way around this problem?

Thanks in advance if anybody can help me!
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Problems with PARSE (Rexx)
« Reply #1 on: July 31, 2006, 02:21:42 AM »
@iamaboringperson
Quote
Surely there is some way around this problem?

As usual ARexx itself is ok, but your code is not. ARexx is very frustrating in this respect, it's so flexible it lets thru almost anything without error messages. :-)

Specifically:
Code: [Select]
PARSE VAR BLAH WITH num1'.'num2'.'num3
...is wrong. With that code the first value is assigned to variable called 'WITH'.

Either remove WITH or use:
Code: [Select]
PARSE VALUE BLAH WITH num1'.'num2'.'num3