It appears to me that your requirement matches the C function below. (?)
I would probably just use C/C++, but you can see what the IBM C/C++ optimizing
compiler generated. It seems unlikely to me that there is a significantly
better way. You might ask on mvs-asm370.
size_t WordTest::wordCopy(char* out, size_t outLen, char* in, size_t inLen) {
char* pBlank = (char*)memchr(in, ' ', inLen);
size_t wordLen = pBlank
? pBlank - in
: inLen;
if (wordLen > outLen)
wordLen = outLen;
memcpy(out, in, wordLen);
return wordLen;
}
Note: in the pseudo assembly listing, the source doesn't always appear in the
right place in the generated code
OFFSET OBJECT CODE LINE# FILE# P S E U D O A S S E M B L Y L I S
T I N G
000188 | * size_t WordTest::wordCopy(char*
out, size_t outLen, char* in, size_t inLen) {
002B48 @21L0 DS 0D
002B48 00C300C5 =F'12779717'
XPLink entrypoint marker
002B4C 00C500F1 =F'12910833'
002B50 00001398 =F'5016'
002B54 00000088 =F'136'
WordTest::wordCopy(char*,unsigned
int,char*,unsigned int)
002B58 000188 | DS 0D
002B58 906A 4788 000188 | STM r6,r10,1928(r4)
002B5C End of Prolog
002B5C 58A0 484C 000164 | 12 L r10,in(,r4,2124)
002B60 5810 4850 000164 | 12 L r1,inLen(,r4,2128)
002B64 1892 000145 | 12 LR r9,r2
002B66 4100 0040 000164 | 12 LA r0,64
002B6A 182A 000164 | 12 LR r2,r10
002B6C 1851 000164 | 12 LR r5,r1
002B6E 5E50 484C 000164 | 12 AL r5,in(,r4,2124)
002B72 B25E 0052 000164 | 12 SRST r5,r2
002B76 A714 FFFE 000164 | 12 JO *-4
002B7A A744 0004 000164 | 12 JL @21L972
002B7E 4150 0000 000164 | 12 LA r5,0
002B82 000164 | 12 @21L972 DS 0H
000189 | * char* pBlank = (char*)memchr(in, '
', inLen);
000190 | * size_t wordLen = pBlank
002B82 EC58 0005 007E 000190 | CIJE r5,H'0',@21L1258
000191 | *
? pBlank - in
002B88 1F5A 000191 | SLR r5,r10
000192 | *
: inLen;
002B8A 1815 000192 | LR r1,r5
002B8C 000190 | @21L1258 DS 0H
000193 | * if (wordLen > outLen)
002B8C EC13 0004 2077 000193 | CLRJH r1,r3,@21L1259
002B92 1831 000193 | LR r3,r1
002B94 000193 | @21L1259 DS 0H
002B94 1813 000145 | 12 LR r1,r3
002B96 EC38 0016 007E 000145 | 12 CIJE r3,H'0',@21L665
002B9C A71A FFFF 000145 | 12 AHI r1,H'-1'
002BA0 1801 000145 | 12 LR r0,r1
002BA2 8A00 0008 000145 | 12 SRA r0,8
002BA6 A784 000B 000145 | 12 JE @21L974
002BAA 000145 | 12 @21L973 DS 0H
002BAA D2FF 9000 A000 000145 | 12 MVC
(char)(256,r9,0),(char)(r10,0)
002BB0 4190 9100 000145 | 12 LA r9,(char)(,r9,256)
002BB4 41A0 A100 000145 | 12 LA r10,(char)(,r10,256)
002BB8 A706 FFF9 000145 | 12 BRCT r0,@21L973
002BBC 000145 | 12 @21L974 DS 0H
002BBC C610 0000 05FA 000145 | 12 EXRL r1,F'1530'
000194 | * wordLen = outLen;
000195 | * memcpy(out, in, wordLen);
000196 | * return wordLen;
000197 | * }
002BC2 000197 | @21L665 DS 0H
002BC2 989A 4794 000197 | LM r9,r10,1940(r4)
002BC6 47F0 7004 000197 | B 4(,r7)
Kirk Wolf
Dovetailed Technologies
https://coztoolkit.com
On Wed, Oct 30, 2024, at 1:03 PM, Seymour J Metz wrote:
> No, if the translated character matches it is not stored. In my case I would
> be using a table of table dc 256al1(*-table) with a match character of space
> and explicitly add a space to the end.
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
> עַם יִשְׂרָאֵל חַי
> נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר
>
>
>
> ________________________________________
> From: IBM Mainframe Discussion List <[email protected]> on behalf of
> Robin Vowels <[email protected]>
> Sent: Wednesday, October 30, 2024 2:53 AM
> 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.
>
>
> On 2024-10-29 14:48, Seymour J Metz wrote:
> > You don't need to know in advance. The question I asked was about doing
> > a copy of a delimited string (in my use case, blank terminated) with
> > explicit bounds on the source and target sizes. TROO comes closest to
> > doing what I want, but it has that pesky alignment requirement.
>
> Does it move the blank?
>
> ----------------------------------------------------------------------
> 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