2007 Dec 20 4:57 PM
Hi All,
I have a field declared as CHAR3 . I get the data into this field from a file which has value like '30 days' or '265 days' or '3 days'.
Now I am grabbing the value from the file as below: field = field+0(3).
so the result is '30 ' or '265' or '3 d'. Here, if you observe, the value 'd' in the last result is an error.
Could someone help me that I display the correct value?
Thanks,
points assured.
2007 Dec 20 5:08 PM
Hi Raja,
Did you try using the keuword SPLIT functionality? You can use this to split up a string into multiple variables.
Here in your case, you can split the source string into 2 variables at space.
SPLIT field AT ' ' INTO field1 field1.
This way, you will have the number in field1.
Hope this helps,
Sumant.
2007 Dec 20 5:04 PM
Hi Raja,
Try this
REPORT YCHATEST.
DATA : V_CHAR(3),
V_STR TYPE STRING.
V_STR = '3 days'.
V_CHAR = V_STR+0(3).
IF V_CHAR CO '0123456789'.
ELSE.
CLEAR V_CHAR+1(2).
ENDIF.
WRITE : V_CHA
2007 Dec 20 5:06 PM
Hi,
Include a conditon like
If Field3 CN '0123456789'.
field3 = field3 + 0(2).
Endif.
Pra
2007 Dec 20 5:08 PM
Hi Raja,
Did you try using the keuword SPLIT functionality? You can use this to split up a string into multiple variables.
Here in your case, you can split the source string into 2 variables at space.
SPLIT field AT ' ' INTO field1 field1.
This way, you will have the number in field1.
Hope this helps,
Sumant.
2007 Dec 20 5:30 PM
split field at space into f1 and f2
f1 will the required output u expect.