Unexpected EDMK problem



High Level Assembler(HLASM) for MVS & VM & VSE

Unexpected EDMK problem

Postby steve-myers » Thu Feb 11, 2016 10:28 pm

I have encountered an unexpected problem with EDMK.
         EDMK  EDPATT,VAL
         ...
EDPATT   DC    0C' NNN',C' ',X'202120'
VAL      DC    P'009'
EDMK did not alter register 1. I expected it to set reg 1 to the address of the 9 in the output area. The relevant paragraph in Principles of Operation (SA22-7832-09) is very confusingly (to me, anyway) worded to imply it won't set reg 1 if VAL would be P'000', but it will set reg 1 if there is a non-zero. In my opinion this is a fair use quote.
EDIT AND MARK is identical to EDIT, except for the additional function of inserting the address of the result byte in general register 1 if the result byte is a zoned source digit and the significance indicator was off before the examination of the source bytes. If no result byte meets the criteria, general register 1 remains unchanged; if more than one result byte meets the criteria, the address of the rightmost such result byte is inserted.
I would normally code something like LA 1,EDPATT+3 to handle the case of P'000', but that would hide the case of P'009'. When I detected this I knew VAL would not be 0, so I did not preset reg 1, and got walloped.

This was encountered with Hercules. Does real hardware work this way?
steve-myers
Global moderator
 
Posts: 1841
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 185 times

Re: Unexpected EDMK problem

 

Re: Unexpected EDMK problem

Postby enrico-sorichetti » Thu Feb 11, 2016 11:18 pm

I just looked at the ED/EDMK code in decimal.c and it behaves according to the POP's quoted sentence

I usually cleared register 1 before the EDMK to make things more understandable
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

These users thanked the author enrico-sorichetti for the post:
steve-myers (Thu Feb 11, 2016 11:33 pm)
enrico-sorichetti
Global moderator
 
Posts: 2573
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 123 times

Re: Unexpected EDMK problem

Postby BillyBoyo » Fri Feb 12, 2016 12:19 am

It's taken half-an-hour of looking at the PoP and then about the same in checking whilst typing, but I think the EDMK is working as documented.

The effect is not so much "masked" by the assignment of the forced significant digit into register 1 before the instruction, it is how it is suggested that it is done (doesn't have to be done that way).

Problem is when the digit-with-the-sign is the source digit. Your significance indicator is on when that arrives, then the instruction notices the sign, puts in the source digit (converted) and sets the significance indicator off. However, it is the state of the significance indicator before the source bytes (sic) are examined that determines if register 1 gets set.

I'm not sure I have this right, because of that "bytes". If it said "byte" I'd be happy. It says "bytes", which I don't understand, so I'm not happy.

"a LOAD ADDRESS instruction is used to set up the first digit position that is forced to print if no significant digits occur to the left" is from the example in the appendix. Again that's just restating how you said you'd do it if zero were possible, but I think it just comes into play as well if there are no significant digits before that first significant position.

These users thanked the author BillyBoyo for the post:
steve-myers (Fri Feb 12, 2016 6:09 am)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 262 times

Re: Unexpected EDMK problem

Postby steve-myers » Fri Feb 12, 2016 6:09 am

BillyBoyo wrote:... "a LOAD ADDRESS instruction is used to set up the first digit position that is forced to print if no significant digits occur to the left" is from the example in the appendix. Again that's just restating how you said you'd do it if zero were possible, but I think it just comes into play as well if there are no significant digits before that first significant position.
I think you're right. The trouble is I don't think that's how a reasonable person would expect the instruction to work.
steve-myers
Global moderator
 
Posts: 1841
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 185 times

Re: Unexpected EDMK problem

Postby BillyBoyo » Fri Feb 12, 2016 7:06 am

Search-engineing locates some old PoPs, and the 370 from Sep75 has this in the description of the example:

If significance is forced, general register 1 remains unchanged. Therefore, the address of the character following
the Significance starter should be placed in the register before the EDIT AND MARK instruction is performed.


That's horribly simple, and took about eight seconds to understand :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 262 times

Re: Unexpected EDMK problem

Postby steve-myers » Sat Feb 13, 2016 8:13 am

After some additional thought, I decided I was an idiot for thinking EDMK should work the way I thought it would.

After some experimentation, I found I had two choices.
  • Preset register 1.
  • Forget the significance start: just use 40202020 as the edit pattern. EDMK will set register 1 to the last byte when VAL is 1 though 9, which I knew was true going in. Of course if VAL is 0, EDMK will blank the pattern and not change register 1.
Billyboyo and Enrico: Thank you for the time you spent fiddling with my stupidity.
steve-myers
Global moderator
 
Posts: 1841
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 185 times


Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post