But the whole point of this discussion is you don’t know the source length 
without inspection of the string, because it is null-terminated.

So either you need to scan the string first to find its length and then move 
for that length, or scan and move one byte at a time like the code generated by 
the C compiler.

-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
Seymour J Metz
Sent: Tuesday, October 22, 2024 2:59 PM
To: [email protected]
Subject: Re: Bounded string move?

MVCL has a source length and a destination length. An S0C4 would indicate that 
one of those lengths was wrong. If the source string is 10 bytes long then the 
source length should be 10 even if the destination length is 512.

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



________________________________________
From: IBM Mainframe Discussion List <[email protected]> on behalf of 
Schmitt, Michael <[email protected]>
Sent: Tuesday, October 22, 2024 3:41 PM
To: [email protected]
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.


Are you sure?

For example, you know that the maximum size a string can be is 512 bytes, but 
it might be shorter. You do a MVCL with length 512.

But, the string is actually 10 bytes long, and is positioned at 4086 bytes into 
a virtual storage page, where the next page *is not allocated*.

When the move tries to read byte 11 won't it get a S0C4, reason code 11 
(page-translation exception)?

Because I've seen this kind of S0C4 before.

-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
Seymour J Metz
Sent: Tuesday, October 22, 2024 2:11 PM
To: [email protected]
Subject: Re: Bounded string move?

Not if you have the correct destination length.

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



________________________________________
From: IBM Mainframe Discussion List <[email protected]> on behalf of 
Schmitt, Michael <[email protected]>
Sent: Tuesday, October 22, 2024 1:00 PM
To: [email protected]
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.


Couldn't that get a S0C4? The area you're copying from may be at the end of a 
page.

-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
Robin Vowels
Sent: Tuesday, October 22, 2024 11:57 AM
To: [email protected]
Subject: Re: Bounded string move?

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 [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN



----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN



----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to