Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to find root(√) value using HLASM instructions

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: How to find root(√) value using HLASM instructions
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: 3158
Location: Tucson AZ

PostPosted: Thu Aug 02, 2007 9:19 pm    Post subject: Re: How to find root(√) value using HLASM instructions
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

Site Director


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

PostPosted: Thu Aug 02, 2007 9:28 pm    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Fri Aug 03, 2007 10:02 pm    Post subject:
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

Site Director


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

PostPosted: Fri Aug 03, 2007 10:27 pm    Post subject:
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    Post subject: Re: How to find root(√) value using HLASM instructions
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: 3158
Location: Tucson AZ

PostPosted: Mon Aug 06, 2007 2:38 pm    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Mon Aug 06, 2007 2:42 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon Aug 06, 2007 6:11 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon Aug 06, 2007 8:20 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts Find out a active PGM jpsager JCL & VSAM 10 Fri Oct 07, 2016 4:32 pm
No new posts How to find a CICS resource used in C... Arunkumar Chandrasekaran CICS 8 Thu Sep 29, 2016 1:45 pm
No new posts how to find clist's or view library Andrew Hsia CLIST & REXX 4 Tue Jun 28, 2016 6:07 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us