View previous topic :: View next topic
|
Author |
Message |
gnagakishore
New User
Joined: 26 Mar 2005 Posts: 25 Location: Hyderabad
|
|
|
|
UNSTRING data-field DELIMITED BY "," , OR "/ "
INTO field-1, field-2, field-3, field-4 WITH POINTER P1
TALLING IN COUNTER-1 ON OVERFLOW GOTO PARA2.
suppose while executing the above statement if it encounteres two contiguous delimiters after sending a few characters in field-1 , what will happen ? |
|
Back to top |
|
|
Deepa.m
New User
Joined: 28 Apr 2005 Posts: 99
|
|
|
|
if two contiguous delimiter was found then next variable will have spaces In ur example,FIELD2 will have spaces FILED3 will have next set of characters until an other delimiter is found. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hi Deepa,
I have a doubt here, whether it will be SPACES or NULL.
Can you confirm again.
Thanks & Regards,
Priyesh. |
|
Back to top |
|
|
vasanthanc
New User
Joined: 01 Apr 2005 Posts: 58
|
|
|
|
Since field2 is cobol variable, while declaration itself space will be allocated. So obviously it will have spaces and not null.
Kindly let me know, if I am wrong |
|
Back to top |
|
|
swaran_msc
New User
Joined: 19 May 2005 Posts: 5 Location: Bangalore
|
|
|
|
When it encounters two delimiters, the charcters b4 the first delimiter will be transferred into Field-1. After the second delimiter, the charcters will be transferred into Field-2 until it encounters another delimiter.
For an Ex
Data Field - IBM Global/,Services,Ltd
After Unstring Operation
Field-1 Value is - IBM Global
Field-2 Value is - Services
---
---
Corrections are Welcome |
|
Back to top |
|
|
vasanthanc
New User
Joined: 01 Apr 2005 Posts: 58
|
|
|
|
here, the question is about, what will be value if field2, if 2 delimeters are there consecutively |
|
Back to top |
|
|
vidyasaraswathi
New User
Joined: 10 May 2005 Posts: 72
|
|
|
|
Hi,
If the Data Field is IBM Global/,Services,Ltd
then the value of field2 is Services.
If the Data Field is IBM Global/,/Services,Ltd
then the value of field2 is /Services |
|
Back to top |
|
|
vidyasaraswathi
New User
Joined: 10 May 2005 Posts: 72
|
|
|
|
Hi all,
I agree with Mahesh.
Please ignore my previous reply.
I executed the Unstring example in the mainframes and found that if 2 continuous delimiters are encountered after some characters are transferred to field1, then the field2 will contain spaces.
Here are the result of the execution in different cases:
1)Data Field - IBM GLOBAL,/SERVICES/LTD
field1=IBM GLOBAL
field2= spaces
field3=SERVICES
2) Data Field - IBM GLOBAL,,SERVICES/LTD
field1=IBM GLOBAL
field2= spaces
field3=SERVICES
3)Data Field -IBM GLOBAL,,,SERVICES/LTD
field1=IBM GLOBAL
field2=spaces
field3=spaces |
|
Back to top |
|
|
Deepa.m
New User
Joined: 28 Apr 2005 Posts: 99
|
|
|
|
Field2 will be spaces. For above string "IBM Global/,Services,Ltd "
which is under discussion the result would be
FIELD1= IBM GLOBAL
FIELD2= <SPACES>
FILED3=SERVICES
why don't you check for yourself. |
|
Back to top |
|
|
|