modulus operation



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Re: modulus operation

Postby Akatsukami » Fri Aug 16, 2013 7:03 pm

rajitha_nair01 wrote:but we here are asked to use intrinsic functions only if there is no otjer way out. STANDARDS!!!!...

In place of the LOG10 intrinsic function, you can use the Language Environment CEESxLG1 functions. I doubt there'll be any real difference in performance or whatnot, but you can accurately claim during code review that you didn't use an intrinsic.
"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: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Re: modulus operation

 

Re: modulus operation

Postby BillyBoyo » Fri Aug 16, 2013 8:16 pm

I'd expect that the intrinsic FUNCTION actually uses the LE routines.

Is there a published reason for limiting the use of intrinsic FUNCTIONs?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: modulus operation

Postby Robert Sample » Fri Aug 16, 2013 8:25 pm

The intrinsic functions, at least for the LOG functions, are EXPLICITLY stated in the Programming Guide manual to be using the equivalent CEE routine.

LOG10 rounds the value returned for the calculation I did. Hence the correct code is
      COMPUTE WS-E-DIGITS = FUNCTION INTEGER (
                            FUNCTION LOG10 (WS-E-NUM) ) + 1 .
to replace the COMPUTE WS-E-DIGITS statement in my previous code post.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: modulus operation

Postby Akatsukami » Fri Aug 16, 2013 8:28 pm

BillyBoyo wrote:I'd expect that the intrinsic FUNCTION actually uses the LE routines.

Probably; this is actually a little bit of malicious compliance. To the left...

Is there a published reason for limiting the use of intrinsic FUNCTIONs?

Rajitha-chan has claimed that her shop's standards discourage use of instrinsic functions save where no other solution is possible. I opine that such standards ought to be followed as strictly -- and narrowly -- as possible.
"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: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: modulus operation

Postby rajitha_nair01 » Mon Aug 19, 2013 4:57 pm

Used justified right with x of variable and solved the problem, and it worked. :D

thanks all for your time. :)
rajitha_nair01
 
Posts: 11
Joined: Thu Aug 15, 2013 5:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: modulus operation

Postby BillyBoyo » Mon Aug 19, 2013 5:32 pm

Hi rahtha_nair01,

Thanks for letting us know.

Can you post your working code, as it may help others with similar requirements in the future.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Previous

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post