Aug 21, 2002 #1 AFPBoy Programmer Joined Apr 26, 2002 Messages 5 Location US How can you calculate a remainder in Cobol ex. 1197/103 = 11 remainder 67
Aug 21, 2002 #2 MKuiper Programmer Joined Jan 29, 2002 Messages 364 Location NL The easy way: DIVIDE <1> BY <2> GIVING <3> REMAINDER <4>. <1> and <2> are numeric fields or literals <3> and <4> are numeric fields The other easy way: COMPUTE <4> = <1> - (( <1> / <2> ) * <2> ) Marcel Upvote 0 Downvote
The easy way: DIVIDE <1> BY <2> GIVING <3> REMAINDER <4>. <1> and <2> are numeric fields or literals <3> and <4> are numeric fields The other easy way: COMPUTE <4> = <1> - (( <1> / <2> ) * <2> ) Marcel
Aug 21, 2002 #3 MKuiper Programmer Joined Jan 29, 2002 Messages 364 Location NL After I send my post, I found the real reason for your question: The remainder of 1197 divided by 103 is 64 and not 67 :-( Good you asked this forum. Marcel Upvote 0 Downvote
After I send my post, I found the real reason for your question: The remainder of 1197 divided by 103 is 64 and not 67 :-( Good you asked this forum. Marcel
Aug 21, 2002 #4 MarcLodge Programmer Joined Feb 26, 2002 Messages 1,886 Location GB Also, depending upon your compiler you can COMPUTE WS-REMAINDER = FUNCTION MOD ( 1197, 103) but Marcel is right, the remainder is 64! Marc Upvote 0 Downvote
Also, depending upon your compiler you can COMPUTE WS-REMAINDER = FUNCTION MOD ( 1197, 103) but Marcel is right, the remainder is 64! Marc
Aug 22, 2002 Thread starter #5 AFPBoy Programmer Joined Apr 26, 2002 Messages 5 Location US thank you all Upvote 0 Downvote