question about cobol Unstring Statement



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

question about cobol Unstring Statement

Postby lxw039 » Mon Oct 27, 2008 9:20 pm

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.
lxw039
 
Posts: 47
Joined: Tue Oct 07, 2008 11:49 pm
Has thanked: 0 time
Been thanked: 0 time

Re: question about cobol Unstring Statement

Postby dick scherrer » Mon Oct 27, 2008 11:57 pm

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: question about cobol Unstring Statement

Postby lxw039 » Tue Oct 28, 2008 10:00 pm

thank you, Mr. Dick!!
lxw039
 
Posts: 47
Joined: Tue Oct 07, 2008 11:49 pm
Has thanked: 0 time
Been thanked: 0 time

Re: question about cobol Unstring Statement

Postby dick scherrer » Wed Oct 29, 2008 12:36 am

You're welcome :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post