Generating a TR field

2022-05-26 Thread Schmitt, Michael
I want to replace all '*' with a space in a field. That's a TR instruction, 
right? But when I search through our 40 years of assembler code, I see no uses 
of TR for such a purpose.

I thinking this is because of difficulty in building the TR table. We'd need to 
have 256 bytes where every byte's value in in ascending sequence: 00 01 02 03 
04 05 06 07 08 09 0A etc, right? Except for the byte at offset x'5C', which 
would have the value x'40'.

Is there a slick way or a macro to build the TR table? Or do people just code a 
TRT loop instead, since it is easier to build a TRT table?


Re: Generating a TR field

2022-05-26 Thread Ed Jaffe

On 5/26/2022 2:23 PM, Schmitt, Michael wrote:

I want to replace all '*' with a space in a field. That's a TR instruction, 
right? But when I search through our 40 years of assembler code, I see no uses 
of TR for such a purpose.

I thinking this is because of difficulty in building the TR table. We'd need to 
have 256 bytes where every byte's value in in ascending sequence: 00 01 02 03 
04 05 06 07 08 09 0A etc, right? Except for the byte at offset x'5C', which 
would have the value x'40'.

Is there a slick way or a macro to build the TR table? Or do people just code a 
TRT loop instead, since it is easier to build a TRT table?

What you want should be trivial:

|TABLE DC  256AL1(*-TABLE)
|  ORG TABLE+C'*'
|      DC  CL1' '
|      ORG ,

--
Phoenix Software International
Edward E. Jaffe
Chief Technology Officer
831 Parkview Drive North
El Segundo, CA 90245
https://www.phoenixsoftware.com/



This e-mail message, including any attachments, appended messages and the
information contained therein, is for the sole use of the intended
recipient(s). If you are not an intended recipient or have otherwise
received this email message in error, any use, dissemination, distribution,
review, storage or copying of this e-mail message and the information
contained therein is strictly prohibited. If you are not an intended
recipient, please contact the sender by reply e-mail and destroy all copies
of this email message and do not otherwise utilize or retain this email
message or any or all of the information contained therein. Although this
email message and any attachments or appended messages are believed to be
free of any virus or other defect that might affect any computer system into
which it is received and opened, it is the responsibility of the recipient
to ensure that it is virus free and no responsibility is accepted by the
sender for any loss or damage arising in any way from its opening or use.


Re: Generating a TR field

2022-05-26 Thread Charles Mills
All of the above.

A run-time loop would be trivial, and if executed once per run would not use 
noticeable CPU.

A macro that used an incremented LCLA would be straightforward.

@Ed's approach is elegant, although a maintenance newbie might have trouble 
understanding what 256AL1(*-TABLE) did.

If the field is expected to be all, say, uppercase alphanumeric, and you could 
live with anything else being translated to SUB or ? or something like that, 
then hand-coding the table would not be too onerous.

There are probably other arguably reasonable approaches.

Charles


-Original Message-
From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On 
Behalf Of Ed Jaffe
Sent: Thursday, May 26, 2022 2:36 PM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Re: Generating a TR field

On 5/26/2022 2:23 PM, Schmitt, Michael wrote:
> I want to replace all '*' with a space in a field. That's a TR instruction, 
> right? But when I search through our 40 years of assembler code, I see no 
> uses of TR for such a purpose.
>
> I thinking this is because of difficulty in building the TR table. We'd need 
> to have 256 bytes where every byte's value in in ascending sequence: 00 01 02 
> 03 04 05 06 07 08 09 0A etc, right? Except for the byte at offset x'5C', 
> which would have the value x'40'.
>
> Is there a slick way or a macro to build the TR table? Or do people just code 
> a TRT loop instead, since it is easier to build a TRT table?
What you want should be trivial:

|TABLE DC  256AL1(*-TABLE)
|  ORG TABLE+C'*'
|  DC  CL1' '
|  ORG ,

-- 
Phoenix Software International
Edward E. Jaffe
Chief Technology Officer
831 Parkview Drive North
El Segundo, CA 90245
https://www.phoenixsoftware.com/



This e-mail message, including any attachments, appended messages and the
information contained therein, is for the sole use of the intended
recipient(s). If you are not an intended recipient or have otherwise
received this email message in error, any use, dissemination, distribution,
review, storage or copying of this e-mail message and the information
contained therein is strictly prohibited. If you are not an intended
recipient, please contact the sender by reply e-mail and destroy all copies
of this email message and do not otherwise utilize or retain this email
message or any or all of the information contained therein. Although this
email message and any attachments or appended messages are believed to be
free of any virus or other defect that might affect any computer system into
which it is received and opened, it is the responsibility of the recipient
to ensure that it is virus free and no responsibility is accepted by the
sender for any loss or damage arising in any way from its opening or use.


Re: Generating a TR field

2022-05-26 Thread Charles Mills
Heck, doing it the hardest way possible would not be terribly burdensome.

Code one line DC X'00',X'01',X'02',...,X'0F'

Repro that 15 times. Then using an editor select the first repro line and 
change all '0 to '1, then on the next line all '0 to '2, and so forth. Finally 
overtype 40 where the 5C is.

Charles


-Original Message-
From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On 
Behalf Of Charles Mills
Sent: Thursday, May 26, 2022 2:52 PM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Re: Generating a TR field

All of the above.

A run-time loop would be trivial, and if executed once per run would not use 
noticeable CPU.

A macro that used an incremented LCLA would be straightforward.

@Ed's approach is elegant, although a maintenance newbie might have trouble 
understanding what 256AL1(*-TABLE) did.

If the field is expected to be all, say, uppercase alphanumeric, and you could 
live with anything else being translated to SUB or ? or something like that, 
then hand-coding the table would not be too onerous.

There are probably other arguably reasonable approaches.

Charles


-Original Message-
From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On 
Behalf Of Ed Jaffe
Sent: Thursday, May 26, 2022 2:36 PM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Re: Generating a TR field

On 5/26/2022 2:23 PM, Schmitt, Michael wrote:
> I want to replace all '*' with a space in a field. That's a TR instruction, 
> right? But when I search through our 40 years of assembler code, I see no 
> uses of TR for such a purpose.
>
> I thinking this is because of difficulty in building the TR table. We'd need 
> to have 256 bytes where every byte's value in in ascending sequence: 00 01 02 
> 03 04 05 06 07 08 09 0A etc, right? Except for the byte at offset x'5C', 
> which would have the value x'40'.
>
> Is there a slick way or a macro to build the TR table? Or do people just code 
> a TRT loop instead, since it is easier to build a TRT table?
What you want should be trivial:

|TABLE DC  256AL1(*-TABLE)
|  ORG TABLE+C'*'
|  DC  CL1' '
|  ORG ,

-- 
Phoenix Software International
Edward E. Jaffe
Chief Technology Officer
831 Parkview Drive North
El Segundo, CA 90245
https://www.phoenixsoftware.com/



This e-mail message, including any attachments, appended messages and the
information contained therein, is for the sole use of the intended
recipient(s). If you are not an intended recipient or have otherwise
received this email message in error, any use, dissemination, distribution,
review, storage or copying of this e-mail message and the information
contained therein is strictly prohibited. If you are not an intended
recipient, please contact the sender by reply e-mail and destroy all copies
of this email message and do not otherwise utilize or retain this email
message or any or all of the information contained therein. Although this
email message and any attachments or appended messages are believed to be
free of any virus or other defect that might affect any computer system into
which it is received and opened, it is the responsibility of the recipient
to ensure that it is virus free and no responsibility is accepted by the
sender for any loss or damage arising in any way from its opening or use.


Re: Generating a TR field

2022-05-26 Thread Paul Gilmartin
On May 26, 2022, at 15:52:08, Charles Mills wrote:
>
> @Ed's approach is elegant, although a maintenance newbie might have trouble 
> understanding what 256AL1(*-TABLE) did.
> 
Troublesome only because Ed left out the most important thing.

> -Original Message-
> From: Ed Jaffe
> Sent: Thursday, May 26, 2022 2:36 PM
> 
> What you want should be trivial:
> |TABLE DC  256AL1(*-TABLE)
> |  ORG TABLE+C'*'
> |  DC  CL1' '
> |  ORG ,

-- 
gil


Re: Generating a TR field

2022-05-26 Thread Charles Mills
And what is that? Some comments?

Charles


-Original Message-
From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU]
On Behalf Of Paul Gilmartin
Sent: Thursday, May 26, 2022 3:08 PM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Re: Generating a TR field

On May 26, 2022, at 15:52:08, Charles Mills wrote:
>
> @Ed's approach is elegant, although a maintenance newbie might have
trouble understanding what 256AL1(*-TABLE) did.
> 
Troublesome only because Ed left out the most important thing.

> -Original Message-
> From: Ed Jaffe
> Sent: Thursday, May 26, 2022 2:36 PM
> 
> What you want should be trivial:
> |TABLE DC  256AL1(*-TABLE)
> |  ORG TABLE+C'*'
> |  DC  CL1' '
> |  ORG ,

-- 
gil


Re: Generating a TR field

2022-05-26 Thread Gord Tomlin

On 2022-05-26 18:26 PM, Charles Mills wrote:

And what is that? Some comments?

Probably the actual TR instruction.
--

Regards, Gord Tomlin
Action Software International
(a division of Mazda Computer Corporation)
Tel: (905) 470-7113, Fax: (905) 470-6507
Support: https://actionsoftware.com/support/


Re: Generating a TR field

2022-05-26 Thread Charles Mills
OP did not ask how to do the translate. OP asked

> Is there a slick way or a macro to build the TR table?

Charles


-Original Message-
From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On 
Behalf Of Gord Tomlin
Sent: Thursday, May 26, 2022 3:46 PM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Re: Generating a TR field

On 2022-05-26 18:26 PM, Charles Mills wrote:
> And what is that? Some comments?
Probably the actual TR instruction.
--

Regards, Gord Tomlin
Action Software International
(a division of Mazda Computer Corporation)
Tel: (905) 470-7113, Fax: (905) 470-6507
Support: https://actionsoftware.com/support/


Re: Generating a TR field

2022-05-26 Thread Gord Tomlin

On 2022-05-26 19:08 PM, Charles Mills wrote:

OP did not ask how to do the translate. OP asked


Is there a slick way or a macro to build the TR table?


True. I should leave it to Gil.

--

Regards, Gord Tomlin
Action Software International
(a division of Mazda Computer Corporation)
Tel: (905) 470-7113, Fax: (905) 470-6507
Support: https://actionsoftware.com/support/


Re: Generating a TR field

2022-05-26 Thread Robin Vowels
- Original Message - 
From: "Schmitt, Michael" 

To: 
Sent: Friday, May 27, 2022 7:23 AM



I want to replace all '*' with a space in a field. That's a TR instruction, 
right?
But when I search through our 40 years of assembler code, I see no uses of TR 
for such a purpose.


What?  That's what TR does, viz, replace one or more characters with others.


I thinking this is because of difficulty in building the TR table.
We'd need to have 256 bytes where every byte's value in in ascending sequence:
00 01 02 03 04 05 06 07 08 09 0A etc, right? Except for the byte at offset 
x'5C',
which would have the value x'40'.



Is there a slick way or a macro to build the TR table?
Or do people just code a TRT loop instead, since it is easier to build a TRT 
table?


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


Re: Generating a TR field

2022-05-26 Thread Graeme Gibson
@Ed's approach is elegant, although a maintenance newbie might have trouble understanding what 
256AL1(*-TABLE) did.


Ed’s technique is standard practice here for building such a table.

As for newbies who may be unclear about the machine code that this generates:

“Use the listing, Luke, use the LISTING!”
   (with PRINT GEN, of course)

   [Worth repeating ‘till they get how useful the listing is]

I also googled 256al1(*-

The 1st result (http://www.simotime.com) required a "find" (ctrl-f) for "256al1" to locate the 
detailed description of creating a table that way.


The 2nd result (http://csc.columbusstate.edu/woolbright/TR.HTM)
gives all the detail required to address the OP's task/request:
  "I want to replace all '*' with a space (" ") in a field."
  "Is there a slick way .. to build the TR table."


Cheers to all,
Graeme
ASE P/L

On 27/05/2022 7:52 am, Charles Mills wrote:

All of the above.

A run-time loop would be trivial, and if executed once per run would not use 
noticeable CPU.

A macro that used an incremented LCLA would be straightforward.

@Ed's approach is elegant, although a maintenance newbie might have trouble 
understanding what 256AL1(*-TABLE) did.

If the field is expected to be all, say, uppercase alphanumeric, and you could 
live with anything else being translated to SUB or ? or something like that, 
then hand-coding the table would not be too onerous.

There are probably other arguably reasonable approaches.

Charles


-Original Message-
From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On 
Behalf Of Ed Jaffe
Sent: Thursday, May 26, 2022 2:36 PM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Re: Generating a TR field

On 5/26/2022 2:23 PM, Schmitt, Michael wrote:

I want to replace all '*' with a space in a field. That's a TR instruction, 
right? But when I search through our 40 years of assembler code, I see no uses 
of TR for such a purpose.

I thinking this is because of difficulty in building the TR table. We'd need to 
have 256 bytes where every byte's value in in ascending sequence: 00 01 02 03 
04 05 06 07 08 09 0A etc, right? Except for the byte at offset x'5C', which 
would have the value x'40'.

Is there a slick way or a macro to build the TR table? Or do people just code a 
TRT loop instead, since it is easier to build a TRT table?

What you want should be trivial:

|TABLE DC  256AL1(*-TABLE)
|  ORG TABLE+C'*'
|  DC  CL1' '
|  ORG ,