Learning AP instruction - need some help



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

Re: Learning AP instruction - need some help

Postby enrico-sorichetti » Thu Aug 23, 2012 2:27 am

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
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Learning AP instruction - need some help

Postby steve-myers » Thu Aug 23, 2012 3:05 am

fast_learner wrote:... Please note - I have assumed that Z would be first filled with zeroes using ZAP and then it will be used to store the addition of W+X+Y.
That will work, but why not use ZAP (Zero and Add decimal) to just "copy" W to Z?
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Learning AP instruction - need some help

Postby Akatsukami » Thu Aug 23, 2012 3:08 am

steve-myers wrote:There are two "ringers" here.[list]
Mr. Scherrer's analysis about packed decimal signs is incorrect. There is no such thing as a hexadecimal O (character O, not digit 0). A packed decimal sign is the last 4 bits (1 hexadecimal digit) of a packed decimal value. There are two classes of packed decimal signs.[list]
[*]"Preferred" signs: C for positive and D for negative. The packed decimal instructions always generate a "preferred" sign. To a lazy eye, D often looks like O,
[*]Alternate signs: A, B, E and F. The only one I have memorized is F, which is considered to be positive.

I believe that that is not entirely the case. F is considered unsigned, although it is treated as positive in arithmetic calculations. A COBOL variable declared S9(n) COMP-3 will have a C in the sign nybble; one that is declared 9(n) COMP-3 will have an F. Obviously in a bitwise comparison they will be found to be different; in a HLL arithmetic comparison, I'm not sure (I'll give it a try tomorrow).
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Learning AP instruction - need some help

Postby BillyBoyo » Thu Aug 23, 2012 6:24 am

An AP (or any of he decimal instructions) will accept non-preferred signs "on the way in". The non-preferred signs are treated as either positive or negative by the machine code. F is treated as positive.

Only preferred signs (C and D) will appear in any result. Where the F appears in Cobol (or anywhere else) is only in those situations where the compiler (or coder, for instance in Assembler) has generated the code to make the result have an F.

The field-definitions in Cobol are how Cobol does it, not how anything happens natively with the machine instructions.

Your "give it a try" might take longer than you yet imagine, as in Cobol you have to concern yourself with the results for NUMPROC(PFD) and NUMPROC(NOPFD) (forget MIG). However, it is moot, as it does not relate to the decimal instructions. No matter what goes in, AP and cousins (those that can cause a S0C7) will never generate an F in a result. It is only with knowledge of the desired result and the code needed to then achieve it that an F ever appears. Down to the compiler/coder.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Learning AP instruction - need some help

Postby dick scherrer » Thu Aug 23, 2012 8:35 am

Hi Guys,

As i mentioned earlier (and didn't get corrected before others got here and found the mistake), i have no idea where that rather silly reply originated :?

Must have been interleaving with something going on in my room at the time . . .

Will surely try to not repreat 8-)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Learning AP instruction - need some help

Postby sindhu1 » Thu Aug 23, 2012 10:43 am

hi can anyone tell me how to post in this forum?not as areply as a new topic?
sindhu1
 
Posts: 3
Joined: Fri Aug 03, 2012 11:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Learning AP instruction - need some help

Postby BillyBoyo » Thu Aug 23, 2012 12:45 pm

If you click on the forum name, which gives you a list of topics, you should see the button on the left towards the top.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Previous

Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post