Anand78
New User
Joined: 06 Mar 2006 Posts: 50 Location: PUNE
|
|
|
|
Hi,
I have the following rquirement.
I need to unstring a variable which having value 'bbbbbbbb9,328.32'
I want to unstring only when it hits the first chacter not spaces.
here b means space.
After unstring VAR1 should have 9 and VAR2 328.32.
Thanks, |
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Code: |
01 WORK-STRING PIC X(16).
01 UNSTRING-AREA.
05 FIELD-1 PIC X(16).
05 FIELD-2 PIC X(16).
05 FIELD-3 PIC X(16).
UNSTRING WORK-AREA
DELIMITED BY ALL SPACES OR ','
INTO FIELD-1
FIELD-2
FIELD-3
END-UNSTRING
|
if there are leading spaces, field-1 will be spaces, field-2 will contain 9 and field-3 will contain the rest.
if there are no leading spaces, field-1 will contain the 9, field-2 will contain the rest and field three will contain spaces. |
|