# How to find root(âˆš) value using HLASM instructions

Author Message
sjothiprakash

New User

Joined: 21 Jul 2007
Posts: 12
Location: Chennai

 Posted: Thu Aug 02, 2007 8:54 pm 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.
William Thompson

Global Moderator

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

Posted: Thu Aug 02, 2007 9:19 pm

 sjothiprakash wrote: root(âˆš)
As in square root, the math function?
dick scherrer

Moderator Emeritus

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

Posted: Thu Aug 02, 2007 9:28 pm

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
sjothiprakash

New User

Joined: 21 Jul 2007
Posts: 12
Location: Chennai

 Posted: Fri Aug 03, 2007 9:33 pm 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.
William Thompson

Global Moderator

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

 Posted: Fri Aug 03, 2007 10:02 pm 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.
dick scherrer

Moderator Emeritus

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

Posted: Fri Aug 03, 2007 10:27 pm

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
sjothiprakash

New User

Joined: 21 Jul 2007
Posts: 12
Location: Chennai

 Posted: Mon Aug 06, 2007 2:22 pm William, Can you please tell me which Library should be called for "Language Environment Programming services"
William Thompson

Global Moderator

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

 Posted: Mon Aug 06, 2007 2:38 pm The LE libs should already be available......
sjothiprakash

New User

Joined: 21 Jul 2007
Posts: 12
Location: Chennai

 Posted: Mon Aug 06, 2007 2:40 pm But there is Reason code=12 for link editing....
William Thompson

Global Moderator

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

Posted: Mon Aug 06, 2007 2:42 pm

 sjothiprakash wrote: But there is Reason code=12 for link editing....
OK.....
sjothiprakash

New User

Joined: 21 Jul 2007
Posts: 12
Location: Chennai

 Posted: Mon Aug 06, 2007 2:58 pm 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.
dick scherrer

Moderator Emeritus

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

Posted: Mon Aug 06, 2007 6:11 pm

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.
sjothiprakash

New User

Joined: 21 Jul 2007
Posts: 12
Location: Chennai

 Posted: Mon Aug 06, 2007 7:49 pm 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 "
dick scherrer

Moderator Emeritus

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

 Posted: Mon Aug 06, 2007 8:20 pm 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.
 View Bookmarks All times are GMT + 6 Hours

 Topic Forum Replies Similar Topics Find the occurrence of Key Field (Par... DFSORT/ICETOOL 6 Find a record count/numeric is multip... COBOL Programming 1 Injecting HTTPHEADER parameters in th... PL/I & Assembler 0 Need to find a specific STRING COBOL Programming 11 How can I find the DDname of a file u... CICS 10
Search our Forums:

 IBMMainframes.com is not an official and/or affiliated with IBM® in anyway Board Rules | FAQ | Downloads | Wiki | SiteMap | Contact Us