Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

help HOW TO DIVIDE IN COBOL AND KEEP THE .numbers

Options
  • 15-09-2004 7:48pm
    #1
    Closed Accounts Posts: 3


    ok im dividing in a cobalt program but when i print the answer im only getting 3.00 when i should be getting 3.64 who can i correct this prob?


Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    multiply by 100 and then format the number as a string like "0.00" ? Whats cobolt?


  • Registered Users Posts: 1,865 ✭✭✭Syth


    Hobbes wrote:
    multiply by 100 and then format the number as a string like "0.00" ? Whats cobolt?
    Isn't cobalt a type of precious stone?


  • Closed Accounts Posts: 3 whoknew


    all decimals have to be declared as

    01 GPA-NUM-CUM PIC ZZ9.99.


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Originally posted by Google
    Did you mean: Cobol
    ;)


  • Closed Accounts Posts: 16,793 ✭✭✭✭Hagar


    whoknew wrote:
    all decimals have to be declared as

    01 GPA-NUM-CUM PIC ZZ9.99.


    I don't think that's strictly correct, thats a display pic which will surpress the zz if zero when printed.
    You really need something like

    1 GPA-CALC-NUM PIC 99999.999

    so that you don't loose accuracy when calculating then use the other pic to print it.


  • Advertisement
Advertisement