IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

what will be the output ?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gnagakishore

New User


Joined: 26 Mar 2005
Posts: 25
Location: Hyderabad

PostPosted: Tue May 17, 2005 8:31 am
Reply with quote

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
View user's profile Send private message
Deepa.m

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Tue May 17, 2005 1:20 pm
Reply with quote

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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Wed May 18, 2005 4:41 pm
Reply with quote

Hi Deepa,

I have a doubt here, whether it will be SPACES or NULL.

Can you confirm again.

Thanks & Regards,

Priyesh.
Back to top
View user's profile Send private message
vasanthanc

New User


Joined: 01 Apr 2005
Posts: 58

PostPosted: Thu May 19, 2005 11:12 am
Reply with quote

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
View user's profile Send private message
swaran_msc

New User


Joined: 19 May 2005
Posts: 5
Location: Bangalore

PostPosted: Thu May 19, 2005 12:20 pm
Reply with quote

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
View user's profile Send private message
vasanthanc

New User


Joined: 01 Apr 2005
Posts: 58

PostPosted: Thu May 19, 2005 2:08 pm
Reply with quote

here, the question is about, what will be value if field2, if 2 delimeters are there consecutively
Back to top
View user's profile Send private message
vidyasaraswathi

New User


Joined: 10 May 2005
Posts: 72

PostPosted: Thu May 19, 2005 2:56 pm
Reply with quote

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
View user's profile Send private message
vidyasaraswathi

New User


Joined: 10 May 2005
Posts: 72

PostPosted: Thu May 19, 2005 4:36 pm
Reply with quote

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
View user's profile Send private message
Deepa.m

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Thu May 19, 2005 4:44 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts XDC SDSF output to temp dataset CLIST & REXX 4
Search our Forums:

Back to Top