Page 1 of 1

Help to translate some codes!

PostPosted: Sun Apr 29, 2012 5:45 pm
by bobguo
...
TRT WA(4),PTABLE
BC 12,CNVFRCE
STC R2,*+5
BC 0,CNVFRCE
...
PTABLE DC 10X'00000000000000000000202001012001'
DC 96X'20'


the hlasm codes above can be translated to:

If the first half byte of WA(3:1) is ‘C’/’D’/’F’ and the second half byte is ‘0’-‘9’ index starts from 0
Continue
Else
Go to CNVFRCE
End-if

if not, can somebody do me a favor to correct it? thx in advance!

Re: Help to translate some codes!

PostPosted: Sun Apr 29, 2012 10:36 pm
by steve-myers
  • Do not alter the instruction stream as you are doing with your STC instruction. It works, but it slows things. It was so bad with the z/900 systems (the first generation z/Architecture systems) that some customers returned their machines and some ISVs had to make serious updates to their products! Use the EX instruction (EX 2,addr of instruction) to do the equivalent. This is slow, too, but nothing like what you are doing. I can't recall using (or seeing used) an EX instruction to execute a BC instruction.
  • I have never seen condition mask 12 used after a TRT instruction. I had to go to Principles of Operation to try to decode what you think you are doing. Like most Assembler programmers I am disconnected from condition code settings and the conditional branch condition code mask. Like most Assembler programmers I just use condition code masks 8 and 7 (Z and NZ) after a TRT, and don't differentiate between condition codes 1 and 2 after a TRT. The only time I use a condition code mask in a BC instruction is after an AL or SL instruction.
After all that I still do not understand your PTABLE. I'm too lazy to count the bytes, but I do not see how it fits your alleged data. I have to go now, but there are other issues here.

Re: Help to translate some codes!

PostPosted: Mon Apr 30, 2012 12:53 am
by steve-myers
Going back to my first bullet.

It was quite common back in 709x machine days to alter TRA instructions (an unconditional branch) to a NOP instruction as a programmed switch. This practice, which you are sort of doing here, was avoided in System/360 by using TM followed by a BC instruction.

Early versions of HASP for OS/360 persisted in altering the second byte of instructions like MVC, CLC or TR to set their lengths. HASP Version 4 for OS/VS2 Release 1 replaced all of this usage with an EX r,... instructions.

I read through your post again. I conclude what you think you are doing is testing a field to see if it contains EBCDIC characters A through R (but not S through Z) or 0 through 9. Your definition is not exactly that, but I think I have the flavor. If that's the case, most Assembler programmers would write something like -
PTABLE   DC    256X'04'
         ORG   PTABLE+C'A'  X'C1'
         DC    9X'00'
         ORG   PTABLE+C'J'  X'D1'
         DC    9X'00'
         ORG   PTABLE+C'0'  X'F0'
         DC    10X'00'
         ORG   ,


The ORG , at the end instructs the Assembler to resume at the highest point. It might be safer to use ORG PTABLE+256, but it's just not done. This table tells TRT to stop if it encounters a code that is not A through R or 0 through 9.

Re: Help to translate some codes!

PostPosted: Sat May 12, 2012 11:31 am
by bobguo
thanks for steve-myers replay.
but i think its purpose is to test the last byte of WA(4) not all the bytes of WA(4), if i use the table you supplied,the process should be:

TRT WA(4),PTABLE
BC X'0010',CNVFRCE

right?

Re: Help to translate some codes!

PostPosted: Sat May 12, 2012 1:01 pm
by BillyBoyo
Why don't you tell us what you are trying to achieve?

Re: Help to translate some codes!

PostPosted: Mon May 14, 2012 12:10 am
by steve-myers
I think the trouble is the TS doesn't have a clue, and wants us to tell him what's going on.

The trouble is his PTABLE doesn't make much sense. It will stop a TRT on all lowercase and upper case EBCDIC characters and some - but not all - EBCDIC punctuation characters, and some - but not all - EBCDIC control characters. Worse, some of the function bytes (the non-zero bytes in PTABLE) make no sense at all. For example 01 when inserted into a BC instruction results in a BC 0,... - a NOP - and the BC won't branch.

Re: Help to translate some codes!

PostPosted: Mon May 14, 2012 3:09 am
by steve-myers
0000 4B4B4B4B 4B4B4B4B 4B4B4B4B 4B4B4B4B *................*
0010 4B4B4B4B 4B4B4B4B 4B4B4B4B 4B4B4B4B *................*
0020 4B4B4B4B 4B4B4B4B 4B4B4B4B 4B4B4B4B *................*
0030 4B4B4B4B 4B4B4B4B 4B4B4B4B 4B4B4B4B *................*
0040 404B4B4B 4B4B4B4B 4B4B4B4B 4C4D4E4F * ...........<(+|*
0050 504B4B4B 4B4B4B4B 4B4B5A5B 5C5D5E5F *&.........!$*);¬*
0060 60614B4B 4B4B4B4B 4B4B4B6B 6C6D6E6F *-/.........,%_>?*
0070 4B4B4B4B 4B4B4B4B 4B4B7A7B 7C7D7E7F *..........:#@'="*
0080 4B818283 84858687 88894B4B 4B4B4B4B *.abcdefghi......*
0090 4B919293 94959697 98994B4B 4B4B4B4B *.jklmnopqr......*
00A0 4BA1A2A3 A4A5A6A7 A8A94B4B 4B4B4B4B *.~stuvwxyz......*
00B0 4B4B4B4B 4B4B4B4B 4B4BBABB 4B4B4B4B *..........[]....*
00C0 C0C1C2C3 C4C5C6C7 C8C94B4B 4B4B4B4B *{ABCDEFGHI......*
00D0 D0D1D2D3 D4D5D6D7 D8D94B4B 4B4B4B4B *}JKLMNOPQR......*
00E0 E04BE2E3 E4E5E6E7 E8E94B4B 4B4B4B4B *\.STUVWXYZ......*
00F0 F0F1F2F3 F4F5F6F7 F8F94B4B 4B4B4B4B *0123456789......*

0000 00000000 00000000 00002020 01012001 *................*
0010 00000000 00000000 00002020 01012001 *................*
0020 00000000 00000000 00002020 01012001 *................*
0030 00000000 00000000 00002020 01012001 *................*
0040 00000000 00000000 00002020 01012001 *................*
0050 00000000 00000000 00002020 01012001 *................*
0060 00000000 00000000 00002020 01012001 *................*
0070 00000000 00000000 00002020 01012001 *................*
0080 00000000 00000000 00002020 01012001 *................*
0090 00000000 00000000 00002020 01012001 *................*
00A0 20202020 20202020 20202020 20202020 *................*
00B0 20202020 20202020 20202020 20202020 *................*
00C0 20202020 20202020 20202020 20202020 *................*
00D0 20202020 20202020 20202020 20202020 *................*
00E0 20202020 20202020 20202020 20202020 *................*
00F0 20202020 20202020 20202020 20202020 *................*
The first table is just a translate table to translate non-printables to periods. The second table is the TS's PTABLE in all its glory.

I made a mistake in my previous post. As you can see, the TS's table will not stop a TRT on EBCDIC lower case A through R, but it will stop on lower case S tthrough Z. The TRT WA(4),PTABLE will stop on any non-zero function byte, and the BC will brach if it stopped on the last byte in WA, but continue if the TRT did not stop or it stopped on any of the first 3 bytes in WA.