MVC and MVCL are what I use if I know the actual length, but I'm concerned with 
the case where I know only bthe maximum length. I want to do a copy until a 
blank, but stop if that hits the maximum length.

-- 
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3
עַם יִשְׂרָאֵל חַי
נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר



________________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Robin Vowels <0000054c2a8bb600-dmarc-requ...@listserv.ua.edu>
Sent: Tuesday, October 22, 2024 12:56 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Bounded string move?

Caution: This email did not originate from George Mason’s mail system. Do not 
click links or open attachments unless you recognize the sender and know the 
content is safe.


On 2024-10-22 10:28, Seymour J Metz wrote:
> If I know the lengths of an input string and the length of a buffer,
> I can specify a pad character and copy it with MVCL. If I know that it
> is
>  delimited by, e.g., a blank, I can use MVST but I run the risk of a
> buffer overrun. Is there a quick way to copy a delimited string without
> overrunning either the input or output buffer and without resorting to
> TRT?

To guarantee no overruns, use MVCL.
That will copy the terminating character (e,g., blank)
and at the same time, preserving the integrity of the string.
Anything else beyond it is also copied to the destination.
Use blank fill for the destination in case the blank could
not be accommodated in source.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to