例
dcl Source char value (' 368,475;121.,856,478')
dcl Delims char(3) init (',;.'); /* string of delimiters */
dcl Number(5) char(3);
dcl Start fixed bin(31);
dcl End fixed bin(31);
/* Extract the three-digit numbers from the source string */
/* by searching for the delimiters */
Start = verify (Source, ' ');
/* find start of first number */
End = search (Source, ',;.', Start );
/* find end of first number */
if End = 0 then
End = length (Source) + 1;
Number(1) = substr (Source, Start, 3); /* 368 */
Start = verify (Source, Delims, End);
/* find start of second number */
End = search (Source, Delims, Start );
Number(2) = substr (Source, Start, 3); /* 475 */
|
This information center is powered by Eclipse technology. (http://www.eclipse.org)