For your info - how the amount in words printed on a check?



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

For your info - how the amount in words printed on a check?

Postby jayind » Fri Jul 18, 2008 3:38 pm

Did you ever think the logic how the amount in WORDs printed on a check?

For example: $112.30 - ONE HUNDRED AND TWELVE DOLLARS AND THIRTY CENTS!!!!

Solution (if you are not aware)

I was undergoing a training and the trainer asked this question. I suggested a general logic
divide the amount by 1000, 100, 10 respectively to get THOUSANDs, HUNDREDs and ONEs...
but he has given a simple logic in COBOL..
Here is the logic and just wanted to share with you....

define a variable

01   AMT          PIC 9(5).9(2)
01   AMT-X redefines AMT.
   05 AMT-THOUSANDS                    PIC X(2).
   05 AMT-HUNDREDS                    PIC X(1).
   05 AMT-TENS      PIC X(1).
   05 AMT-ONES      PIC X(1).
   05 AMT-DOT      PIC X(1).
   05 AMT-DECIMALS                   PIC X(2).


And little more code is required for validations if ‘0’s present in the respective field values..

Usually this is a subroutine in the existing systems just by passing the value we get the required....
Just thought to share the info with you...

Regards,
jayind
jayind
 
Posts: 62
Joined: Wed Apr 23, 2008 1:37 pm
Location: Chennai, India
Has thanked: 0 time
Been thanked: 0 time

Re: For your info - how the amount in words printed on a check?

 

Re: For your info - how the amount in words printed on a check?

Postby ritwik.das » Wed Jul 23, 2008 4:38 pm

This is really cool! Jayind, thanks a lot.

Regards!
Ritwik
Thanks & Regards!
Ritwik
ritwik.das
 
Posts: 13
Joined: Wed Jul 16, 2008 10:27 am
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post