IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to find root(√) value using HLASM instructions


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sjothiprakash

New User


Joined: 21 Jul 2007
Posts: 12
Location: Chennai

PostPosted: Thu Aug 02, 2007 8:54 pm
Reply with quote

Hi friends,

Anybody know how to find the root(√) value using assembler instructions, and also finding log values using assembler instructions.

If you know how to code for it please give me.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Aug 02, 2007 9:19 pm
Reply with quote

sjothiprakash wrote:
root(√)
As in square root, the math function?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Thu Aug 02, 2007 9:28 pm
Reply with quote

Hello,

Here is some pseudo-code for square-root calculation
Code:
 read in number
 if number > 0 then
     left =  0
     right =  number + 1
     loop while (right - left) > 0.001
     mid =  (left + right)/2
        if ( mid*mid < number ) then
            left =  mid
         else
            right =  mid
        ifend
    loopend
    write out 'Square root of ' Number ' is ' mid
 else
    write out 'Illegal value: '
 ifend
Back to top
View user's profile Send private message
sjothiprakash

New User


Joined: 21 Jul 2007
Posts: 12
Location: Chennai

PostPosted: Fri Aug 03, 2007 9:33 pm
Reply with quote

Hi Scherrer,

I hope the pseudo will give the square root value of a number but how to check the loop condition with the floating point value(0.001).
And also as a fresher to assembler i dont know divisions with rounding(DP & CP) will give the excat value which will need to used in the loop condition.
Can you give me one more example related to assembler instructions.


William,

Yes, your question is correct, i am asking for maths root calculation.
Please Give me a clear picture.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Aug 03, 2007 10:02 pm
Reply with quote

Haven't tried it myself, but (one way or another) you should be able to call the Language Environment math services.
The sample COBOL call to CEESSLOG--logarithm base e looks fairly straight forward.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Aug 03, 2007 10:27 pm
Reply with quote

Hello,

Quote:
how to check the loop condition with the floating point value(0.001).


I don't believe the 0.001 is really a floating point value - it is merely a decimal number with scaling (or a fraction) - unless that is also floating point - long ago having a floating decimal was not a floating point number (which was used for scientific notion).

As far as division and remainders, you might want to use binary numbers (rather than packed-decimal) for calculating. I seem to recall that if use something like the following you will have your remainder in a register"
Code:
         L     R8,HEX0         EVEN/ODD PAIR, RESULT = REMAINDER
         L     R9,HEX5         EVEN/ODD PAIR, RESULT = QUOTIENT
         L     R3,HEX2         DIVISOR
         DR    R8,R3         * DIVIDE, REGISTER & REGISTER
Back to top
View user's profile Send private message
sjothiprakash

New User


Joined: 21 Jul 2007
Posts: 12
Location: Chennai

PostPosted: Mon Aug 06, 2007 2:22 pm
Reply with quote

William,

Can you please tell me which Library should be called for "Language Environment Programming services"
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Aug 06, 2007 2:38 pm
Reply with quote

The LE libs should already be available......
Back to top
View user's profile Send private message
sjothiprakash

New User


Joined: 21 Jul 2007
Posts: 12
Location: Chennai

PostPosted: Mon Aug 06, 2007 2:40 pm
Reply with quote

But there is Reason code=12 for link editing....
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Aug 06, 2007 2:42 pm
Reply with quote

sjothiprakash wrote:
But there is Reason code=12 for link editing....
OK.....
Back to top
View user's profile Send private message
sjothiprakash

New User


Joined: 21 Jul 2007
Posts: 12
Location: Chennai

PostPosted: Mon Aug 06, 2007 2:58 pm
Reply with quote

This is the error what i got on link editing

ABEND 013-64 OCCURRED WHILE PROCESSING PARTITIONED DATA SET WITH DDNAME SYSLIB.
UNABLE TO PROCESS LIBRARY SYSLIB DURING AUTOCALL PROCESSING.
SYMBOL CEESSSQT UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM THE DESIGNATED CALL LIBRARY.
MODULE ENTRY NOT PROVIDED. ENTRY DEFAULTS TO SECTION SAMPLE2.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Mon Aug 06, 2007 6:11 pm
Reply with quote

Hello,

You need to research your abend code before posting. This is from the manual linked to from the forums.
Quote:
64
An OPEN macro instruction was issued for a null data set using an access method other than QSAM or BSAM. Correct the DD statement to specify a real data set, or access the data set using BSAM or QSAM.


If there are inconsistencies in your library concatenation/specification, you need to talk with your system support people to find out where your problem is.
Back to top
View user's profile Send private message
sjothiprakash

New User


Joined: 21 Jul 2007
Posts: 12
Location: Chennai

PostPosted: Mon Aug 06, 2007 7:49 pm
Reply with quote

Hi dick,

Now I changed my JCL appropriatly, but still its shown RC=12 for CEESSSQT as :
" SYMBOL CEESSSQT UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM THE DESIGNATED CALL LIBRARY "
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Mon Aug 06, 2007 8:20 pm
Reply with quote

Hi Jothi,

I'd suggest talking with your system support people and make sure that your assemble/link includes all of the LE libraries.

Have you tried to call this using a COBOL program? If you do so, and it works, you may see that the libraries used for COBOL are not the exact same as the ones in your assembly.

If you are going to use these callable routines, i'd suggest you work with the system support people so there will be a standard method (if one does not alerady exist). If each developer creates their own compile/assemble/link jcl, it may cause all sorts of problems later.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts sort to find out the char which repea... Mainframe Interview Questions 10
No new posts Compare 2 alphabets in a REXX and fin... CLIST & REXX 2
No new posts Call an hlasm from REXX in batch and ... CLIST & REXX 4
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
Search our Forums:

Back to Top