Page 1 of 1

question about cobol Unstring Statement

PostPosted: Mon Oct 27, 2008 9:20 pm
by lxw039
Hi, can anybody give me a example to explain the Unstring description as following:
"if the end of the sending field is reached before one of the delimiters is found, the characters between
the last delimiter and the end of the field are sent to the receiving field." thank you very much!

the Syntax:
UNSTRING XXX DELIMITED BY YY INTO ZZZZ.

Re: question about cobol Unstring Statement

PostPosted: Mon Oct 27, 2008 11:57 pm
by dick scherrer
Hello,

If there are less "sending" characters in the data than there are "receiving" characters defined, the unstring will send the shorter number of characters (i.e. from the last delimiter to the end of data).

To better see how this works, i suggest you experiment by putting some code in your program and force various "sending" sets of data thru an unstring and look at the results after the unstring.

While the following is not exactly the situation you asked about, the link shows how the unstring operates:
http://publibz.boulder.ibm.com/cgi-bin/ ... 0/6.2.39.8?

If there are any questions about the info in the manual or if you have results that you do not understand from your experiment, post back here and someone will be able to clarify.

Re: question about cobol Unstring Statement

PostPosted: Tue Oct 28, 2008 10:00 pm
by lxw039
thank you, Mr. Dick!!

Re: question about cobol Unstring Statement

PostPosted: Wed Oct 29, 2008 12:36 am
by dick scherrer
You're welcome :)

d