Prev: New to COBOL
Next: RosettaCode
From: Charles Hottel on 10 Aug 2010 22:30 "Pete Dashwood" <dashwood(a)removethis.enternet.co.nz> wrote in message news:8ccm12FbsvU1(a)mid.individual.net... > Charles Hottel wrote: >> "e p chandler" <epc8(a)juno.com> wrote in message >> news:1c92f294-4b33-4423-b769-8243add7d9b8(a)g33g2000yqc.googlegroups.com... >> On Aug 8, 5:20 am, "sharad kumar.j" <aryansmit3...(a)gmail.com> wrote: >>> hi, >>> I hhave started my programming in cobol and i'm 3 weeks old.I would >>> like to know that is there any built in function to convert amount in >>> number to words >>> eg:345 >>> as >>> three hundred and forty five.... >> >>>> a Google search on >> >>>> cobol dollar amount to words >> >>>> should be very helpful to you. >> >> 000010 @OPTIONS MAIN,TEST >> 000020 Identification Division. >> 000030 Program-Id. Cutenum. >> 000040* By Thane Hubbell - 01/15/1999 >> 000041* Compiled and Tested under Fujitsu COBOL >> 000042 Environment Division. >> 000050 Configuration Section. >> 000060 Source-Computer. IBM-PC. >> 000070 Object-Computer. IBM-PC. >> 000080 Data Division. >> 000090 Working-Storage Section. >> 000252 01 The-Number Pic 9(9) Value Zeros. >> 000254 01 Text-Field Pic X(200) Value Spaces. >> 000255 01 Number-Descriptions. >> 000256 03 Table-Area-Low. >> 000257 05 Filler Pic X(8) Value "One". >> 000258 05 Filler Pic X(8) Value "Two". >> 000259 05 Filler Pic X(8) Value "Three". >> 000260 05 Filler Pic X(8) Value "Four". >> 000261 05 Filler Pic X(8) Value "Five". >> 000262 05 Filler Pic X(8) Value "Six". >> 000263 05 Filler Pic X(8) Value "Seven". >> 000264 05 Filler Pic X(8) Value "Eight". >> 000265 05 Filler Pic X(8) Value "Nine". >> 000266 05 Filler Pic X(8) Value "Ten". >> 000267 05 Filler Pic X(8) Value "Eleven". >> 000268 05 Filler Pic X(8) Value "Twelve". >> 000269 05 Filler Pic X(8) Value "Thirteen". >> 000270 03 Low-Numbers Redefines Table-Area-Low. >> 000271 05 Low-Number Pic X(8) Occurs 13 Times. >> 000272 03 Table-Area-Secondary. >> 000273 05 Filler Pic X(7) Value Spaces. >> 000274 05 Filler Pic X(7) Value "Twenty". >> 000275 05 Filler Pic X(7) Value "Thirty". >> 000276 05 Filler Pic X(7) Value "Fourty". >> 000277 05 Filler Pic X(7) Value "Fifty". >> 000278 05 Filler Pic X(7) Value "Sixty". >> 000279 05 Filler Pic X(7) Value "Seventy". >> 000280 05 Filler Pic X(7) Value "Eighty". >> 000281 05 Filler Pic X(7) Value "Ninety". >> 000282 03 Secondary-Numbers Redefines Table-Area-Secondary. >> 000283 05 Secondary-Number Pic X(7) Occurs 9 Times. >> 000284 03 Table-Area-Ante. >> 000285 05 Filler Pic X(8) Value Spaces. >> 000286 05 Filler Pic X(8) Value "Million". >> 000287 05 Filler Pic X(8) Value Spaces. >> 000288 05 Filler Pic X(8) Value "Thousand". >> 000289 05 Filler Pic X(8) Value Spaces. >> 000290 05 Filler Pic X(8) Value Spaces. >> 000292 03 Ante-Numbers Redefines Table-Area-Ante. >> 000293 05 Ante-Number Pic X(8) Occurs 6 Times. >> 000294 01 Cntr Pic 99 Value Zeros. >> 000295 01 String-Pointer Pic 99 Value 1. >> 000296 01 Digits Pic 9 Value Zeros. >> 000297 01 Offset Pic 9 Value Zeros. >> 000298 01 Offset-Value Pic 9v9 Value Zeros. >> 000299 01 Test-Num Pic 99 Value Zeros. >> 000300 01 Second-Num Pic 99 Value Zeros. >> 000301 01 Ante-Flag Pic X Value Spaces. >> 000302 88 Print-Ante Value "Y". >> 000303 88 No-Print-Ante Value Spaces. >> 000304 Screen Section. >> 000305 01 Main-Screen >> 000306 Blank Screen, Auto, Required, >> 000307 Foreground-Color Is 7, >> 000308 Background-Color Is 1. >> 000309 03 Line 1 Column 1 Value "Enter Amount". >> 000310 03 Line 3 Column 1 Value "Result ". >> 000311 03 Line 1 Column 14 Pic 9(9) Using The-Number. >> 000312 03 Line 4 Column 1 Pic X(80) From Text-Field. >> 000313 Procedure Division. >> 000314 Cutenum-Start. >> 000315 Display Main-Screen >> 000316 Accept Main-Screen >> 000324 Perform Varying Cntr From 1 By 1 Until Cntr > 6 >> 000325 If Digits = 2 >> 000326 Subtract 1 From Digits >> 000327 Else >> 000328 Add 1 To Digits >> 000329 End-If >> 000330 Move Offset-Value to Offset >> 000331 Add .5 to Offset-Value >> 000332 Compute Test-Num = >> 000334 Function Numval (The-Number (Cntr + Offset:Digits)) >> 000335 Evaluate Digits Also Test-Num >> 000338 When 1 Also 1 Thru 9 >> 000339 String Low-Number (Test-Num) >> 000340 Delimited By Space >> 000341 " Hundred " Delimited By Size >> 000342 Into Text-Field >> 000343 Pointer String-Pointer >> 000344 Set Print-Ante To True >> 000345 When 2 Also 1 Thru 9 >> 000346 String Low-Number (Test-Num) >> 000347 Delimited by Space >> 000348 Space Delimited by Size >> 000349 Into Text-Field >> 000350 Pointer String-Pointer >> 000351 Set Print-Ante To True >> 000352 When 2 Also 10 Thru 13 >> 000353 String Low-Number (Test-Num) >> 000354 Delimited By Space >> 000355 Space Delimited By Size >> 000356 Into Text-Field >> 000357 Pointer String-Pointer >> 000358 Set Print-Ante To True >> 000359 When 2 Also 14 Thru 19 >> 000360 Compute Second-Num = >> 000361 Function Rem (Test-Num 10) >> 000362 String Low-Number (Second-Num) >> 000363 "teen" Delimited By Space >> 000364 Space Delimited by Size >> 000365 Into Text-Field >> 000366 Pointer String-Pointer >> 000367 Set Print-Ante To True >> 000368 When 2 Also 20 Thru 99 >> 000369 Move Test-Num To Second-Num >> 000370 Move "0" To Second-Num (2:1) >> 000371 Subtract Second-Num From Test-Num >> 000372 Divide Second-Num By 10 Giving Second-Num >> 000373 String Secondary-Number (Second-Num) >> 000374 Low-Number (Test-Num) >> 000375 Delimited By Space >> 000376 Space Delimited By Size >> 000377 Into Text-Field >> 000378 Pointer String-Pointer >> 000379 Set Print-Ante To True >> 000380 End-Evaluate >> 000381 If Digits = 2 And Print-Ante >> 000382 String Ante-Number (Cntr) >> 000383 Delimited By Space >> 000384 Space Delimited By Size >> 000385 Into Text-Field >> 000386 Pointer String-Pointer >> 000387 Set No-Print-Ante To True >> 000388 End-if >> 000389 End-Perform >> 000390 Display Main-Screen >> 000391 Display Text-Field Upon Console >> 000460 Stop Run. >> > Nice to see you back here Charlie. :-) > > Couple of quick questions: > > 1. Are you sure that is public domain? (If it is from Thane's book it is > copyright, unless he posts it himself.) > 2. Won't it return "fiveteen" for "fifteen"? (Didn't have time to set it > up and compile and test it but a cursory glance raised an alarm...) > > Pete. > -- > "I used to write COBOL...now I can do anything." > I do not know if it was in his book. It was on his website and available for download by anyone who wanted it. I do not know if his website is still around. Ihave it stored on my hard drive.
From: foodman on 11 Aug 2010 06:00 On Aug 8, 5:20 am, "sharad kumar.j" <aryansmit3...(a)gmail.com> wrote: > hi, > I hhave started my programming in cobol and i'm 3 weeks old.I would > like to know that is there any built in function to convert amount in > number to words > eg:345 > as > three hundred and forty five.... Written in 1986, this is a WS copy and a PD copy. I made a little program from the two copies. compiles and works. here it is $set ans85 noosvs mf IDENTIFICATION DIVISION. PROGRAM-ID. NUMBERWORDS. AUTHOR. A. R. DILWORTH. DATE-WRITTEN. 08/10/10. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. RANDY-2000. OBJECT-COMPUTER. TANDY-2000. DATA DIVISION. WORKING-STORAGE SECTION. * * W9918 - USED BY S9918 (CHECK AMOUNT IN WORDS). * * THE VALUE OF LN-MAX-LENGTH SHOULD BE SET BY THE USING PROG. * 01 PRINT-FIELDS. 02 WORK-FIELD PIC X(132). 02 WORK-FLD REDEFINES WORK-FIELD PIC X(01) OCCURS 132 TIMES INDEXED BY WORK-FLD-IDX. 01 WORK-FLD-SUB PIC 9(03). 01 STORE-WORK-FLD-SUB PIC 9(03). * 01 LN-MAX-LENGTH PIC 9(03) VALUE 132. 01 PROTECT-FLD PIC X(01) VALUE '*'. * 01 ALPHA-AMOUNT. 02 ALPHA-AMT PIC 9(09)V99. 02 ALPHA-AMT-CHAR REDEFINES ALPHA-AMT PIC 9(01) OCCURS 11 TIMES INDEXED BY ALPHA-AMT-CHAR-IDX. 02 FILLER REDEFINES ALPHA-AMT. 03 FILLER PIC 9(09). 03 ALPHA-AMT-CENTS PIC 9(02). 01 ALPHA-AMT-CHAR-IDX-MAX PIC 9(02) VALUE 11. * 01 ALPHA-AMT-STRING-FIELD. 02 ALPHA-AMT-STRING-FLD PIC X(80). 02 ALPHA-AMT-STRING-CHAR REDEFINES ALPHA-AMT-STRING-FLD PIC X(01) OCCURS 80 TIMES INDEXED BY ALPHA-AMT-STRING-CHAR-IDX. 01 ALPHA-AMT-PROTECT-LENGTH PIC 9(02). * 01 UNITS-TABLE. 02 FILLER PIC X(05) VALUE 'ONE'. 02 FILLER PIC X(05) VALUE 'TWO'. 02 FILLER PIC X(05) VALUE 'THREE'. 02 FILLER PIC X(05) VALUE 'FOUR'. 02 FILLER PIC X(05) VALUE 'FIVE'. 02 FILLER PIC X(05) VALUE 'SIX'. 02 FILLER PIC X(05) VALUE 'SEVEN'. 02 FILLER PIC X(05) VALUE 'EIGHT'. 02 FILLER PIC X(05) VALUE 'NINE'. 01 FILLER REDEFINES UNITS-TABLE. 02 UNITS-WORD PIC X(05) OCCURS 9 TIMES INDEXED BY UNITS-WORD-IDX. * 01 TENS-TABLE. 02 FILLER PIC X(07) VALUE 'DUMMY'. 02 FILLER PIC X(07) VALUE 'TWENTY'. 02 FILLER PIC X(07) VALUE 'THIRTY'. 02 FILLER PIC X(07) VALUE 'FORTY'. 02 FILLER PIC X(07) VALUE 'FIFTY'. 02 FILLER PIC X(07) VALUE 'SIXTY'. 02 FILLER PIC X(07) VALUE 'SEVENTY'. 02 FILLER PIC X(07) VALUE 'EIGHTY'. 02 FILLER PIC X(07) VALUE 'NINETY'. 01 FILLER REDEFINES TENS-TABLE. 02 TENS-WORD PIC X(07) OCCURS 9 TIMES INDEXED BY TENS-WORD-IDX. * 01 TEENS-TABLE. 02 FILLER PIC X(09) VALUE 'TEN'. 02 FILLER PIC X(09) VALUE 'ELEVEN'. 02 FILLER PIC X(09) VALUE 'TWELVE'. 02 FILLER PIC X(09) VALUE 'THIRTEEN'. 02 FILLER PIC X(09) VALUE 'FOURTEEN'. 02 FILLER PIC X(09) VALUE 'FIFTEEN'. 02 FILLER PIC X(09) VALUE 'SIXTEEN'. 02 FILLER PIC X(09) VALUE 'SEVENTEEN'. 02 FILLER PIC X(09) VALUE 'EIGHTEEN'. 02 FILLER PIC X(09) VALUE 'NINETEEN'. 01 FILLER REDEFINES TEENS-TABLE. 02 TEENS-WORD PIC X(09) OCCURS 10 TIMES INDEXED BY TEENS-WORD-IDX. * 01 DOLLAR-SW PIC X(01) VALUE 'N'. 88 DOLLAR-SW-OFF VALUE 'N'. 88 DOLLAR-SW-ON VALUE 'Y'. 01 THOUSAND-SW PIC X(01) VALUE 'N'. 88 THOUSAND-SW-OFF VALUE 'N'. 88 THOUSAND-SW-ON VALUE 'Y'. 01 TEEN-SW PIC X(01) VALUE 'N'. 88 TEEN-SW-OFF VALUE 'N'. 88 TEEN-SW-ON VALUE 'Y'. 01 HYPHEN-SW PIC X(01) VALUE 'N'. 88 HYPHEN-SW-OFF VALUE 'N'. 88 HYPHEN-SW-ON VALUE 'Y'. PROCEDURE DIVISION. A. ACCEPT ALPHA-AMT. IF ALPHA-AMT = ZERO STOP RUN. PERFORM S9918. DISPLAY WORK-FIELD. GO TO A. * - USED IN CONJUNCTION WITH W9918. * - THE AMOUNT TO BE PUT IN WORDS MUST BE IN ALPHA-AMT. * - THE LENGTH OF THE PRINT FIELD MUST BE IN LN-MAX- * LENGTH. * - THE AMOUNT IN WORDS (INCLUDING PROTECTION) IS * PLACED INTO WORK-FIELD. * S9918. MOVE SPACES TO WORK-FIELD. MOVE 1 TO WORK-FLD-SUB. SET ALPHA-AMT-CHAR-IDX TO 0. PERFORM S9918A THRU S9918A-X. IF ALPHA-AMT-CHAR-IDX = 9 AND ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX) = 1 MOVE 'Y' TO DOLLAR-SW, ELSE MOVE 'N' TO DOLLAR-SW. IF ALPHA-AMT-CHAR-IDX > 9 MOVE 'ZERO' TO ALPHA-AMT-STRING-FLD, PERFORM S9918H, ELSE PERFORM S9918B UNTIL ALPHA-AMT-CHAR-IDX = 10. PERFORM S9918F. SUBTRACT 1 FROM WORK-FLD-SUB. IF WORK-FLD-SUB < LN-MAX-LENGTH SUBTRACT WORK-FLD-SUB FROM LN-MAX-LENGTH GIVING ALPHA-AMT-PROTECT-LENGTH, MOVE WORK-FIELD TO ALPHA-AMT-STRING-FLD, MOVE SPACES TO WORK-FIELD, MOVE WORK-FLD-SUB TO STORE-WORK-FLD-SUB, MOVE 1 TO WORK-FLD-SUB, PERFORM S9918G UNTIL WORK-FLD-SUB > ALPHA-AMT-PROTECT-LENGTH, SET ALPHA-AMT-STRING-CHAR-IDX TO 1, PERFORM S9918I STORE-WORK-FLD-SUB TIMES. * * SET ALPHA-AMT-CHAR-IDX S9918A. SET ALPHA-AMT-CHAR-IDX UP BY 1. IF ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX) > ZERO GO TO S9918A-X. IF ALPHA-AMT-CHAR-IDX = ALPHA-AMT-CHAR-IDX-MAX GO TO S9918A-X. GO TO S9918A. S9918A-X. EXIT. * * ALPHA DOLLARS RTN S9918B. IF ALPHA-AMT-CHAR-IDX = 1 OR = 4 OR = 7 PERFORM S9918C, SET ALPHA-AMT-CHAR-IDX UP BY 1. IF ALPHA-AMT-CHAR-IDX = 2 OR = 5 OR = 8 PERFORM S9918D, SET ALPHA-AMT-CHAR-IDX UP BY 1. IF ALPHA-AMT-CHAR-IDX = 3 OR = 6 OR = 9 PERFORM S9918E. IF ALPHA-AMT-CHAR-IDX = 3 MOVE 'MILLION' TO ALPHA-AMT-STRING-FLD, PERFORM S9918H. IF ALPHA-AMT-CHAR-IDX = 6 AND THOUSAND-SW-ON MOVE 'THOUSAND' TO ALPHA-AMT-STRING-FLD, PERFORM S9918H, MOVE 'N' TO THOUSAND-SW. IF ALPHA-AMT-CHAR-IDX < 10 SET ALPHA-AMT-CHAR-IDX UP BY 1. * * HUNDREDS RTN S9918C. IF ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX) > ZERO SET UNITS-WORD-IDX TO ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX), MOVE UNITS-WORD (UNITS-WORD-IDX) TO ALPHA-AMT-STRING-FLD, PERFORM S9918H, MOVE 'HUNDRED' TO ALPHA-AMT-STRING-FLD, PERFORM S9918H, IF ALPHA-AMT-CHAR-IDX = 4 MOVE 'Y' TO THOUSAND-SW. * * TENS RTN S9918D. MOVE 'N' TO HYPHEN-SW, TEEN-SW. IF ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX) > 1 SET TENS-WORD-IDX TO ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX), MOVE TENS-WORD (TENS-WORD-IDX) TO ALPHA-AMT-STRING-FLD, PERFORM S9918H, MOVE 'Y' TO HYPHEN-SW, ELSE IF ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX) = 1 MOVE 'Y' TO TEEN-SW. IF ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX) > ZERO AND ALPHA-AMT-CHAR-IDX = 5 MOVE 'Y' TO THOUSAND-SW. * * UNITS RTN S9918E. IF HYPHEN-SW = 'Y' AND ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX) > ZERO MOVE '-' TO ALPHA-AMT-STRING-FLD, SUBTRACT 1 FROM WORK-FLD-SUB, PERFORM S9918H, SUBTRACT 1 FROM WORK-FLD-SUB. IF ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX) > ZERO AND TEEN-SW = 'N' SET UNITS-WORD-IDX TO ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX), MOVE UNITS-WORD (UNITS-WORD-IDX) TO ALPHA-AMT-STRING-FLD, PERFORM S9918H, ELSE IF TEEN-SW = 'Y' SET TEENS-WORD-IDX TO ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX), SET TEENS-WORD-IDX UP BY 1, MOVE TEENS-WORD (TEENS-WORD-IDX) TO ALPHA-AMT-STRING-FLD, PERFORM S9918H, MOVE 'N' TO TEEN-SW. IF HYPHEN-SW = 'Y' MOVE 'N' TO HYPHEN-SW. IF ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX) > ZERO AND ALPHA-AMT-CHAR-IDX = 6 MOVE 'Y' TO THOUSAND-SW. * * ALPHA CENTS RTN S9918F. IF DOLLAR-SW-ON MOVE 'DOLLAR' TO ALPHA-AMT-STRING-FLD, ELSE MOVE 'DOLLARS' TO ALPHA-AMT-STRING-FLD. PERFORM S9918H. MOVE 'AND' TO ALPHA-AMT-STRING-FLD. PERFORM S9918H. MOVE ALPHA-AMT-CENTS TO ALPHA-AMT-STRING-FLD. PERFORM S9918H. MOVE '/100' TO ALPHA-AMT-STRING-FLD. SUBTRACT 1 FROM WORK-FLD-SUB. PERFORM S9918H. * * STRING ALPHA-AMT PROTECT S9918G. MOVE PROTECT-FLD TO WORK-FLD (WORK-FLD-SUB). ADD 1 TO WORK-FLD-SUB. * * STRING ALPHA-AMT S9918H. SET ALPHA-AMT-STRING-CHAR-IDX TO 1. PERFORM S9918I UNTIL ALPHA-AMT-STRING-CHAR (ALPHA-AMT-STRING-CHAR-IDX) = SPACE OR WORK-FLD-SUB > LN-MAX-LENGTH. IF WORK-FLD-SUB < LN-MAX-LENGTH ADD 1 TO WORK-FLD-SUB. * * ALPHA-AMT-STRING MOVE S9918I. MOVE ALPHA-AMT-STRING-CHAR (ALPHA-AMT-STRING-CHAR-IDX) TO WORK-FLD (WORK-FLD-SUB). SET ALPHA-AMT-STRING-CHAR-IDX UP BY 1. ADD 1 TO WORK-FLD-SUB.
From: Anonymous on 11 Aug 2010 08:58 In article <acf4c646-f391-4fed-9038-b530e1d9b1bb(a)e15g2000yqo.googlegroups.com>, foodman <foodman123(a)aol.com> wrote: >On Aug 8, 5:20?am, "sharad kumar.j" <aryansmit3...(a)gmail.com> wrote: >> hi, >> I hhave started my programming in cobol and i'm 3 weeks old.I would >> like to know that is there any built in function to convert amount in >> number to words >> eg:345 >> as >> three hundred and forty five.... > >Written in 1986, this is a WS copy and a PD copy. >I made a little program from the two copies. [snip] > PROCEDURE DIVISION. > A. [snip - what follows, snippage unremarked, are all the paragraph-names] > S9918. > S9918A. > S9918A-X. > S9918B. > S9918C. > S9918D. > S9918E. > S9918F. > S9918G. > S9918H. > S9918I. Mr Dilworth, I'd say that is *exactly* the kind of code - if any code at all - that such a request requires. DD
From: Pete Dashwood on 11 Aug 2010 20:02 docdwarf(a)panix.com wrote: > In article > <acf4c646-f391-4fed-9038-b530e1d9b1bb(a)e15g2000yqo.googlegroups.com>, > foodman <foodman123(a)aol.com> wrote: >> On Aug 8, 5:20?am, "sharad kumar.j" <aryansmit3...(a)gmail.com> wrote: >>> hi, >>> I hhave started my programming in cobol and i'm 3 weeks old.I would >>> like to know that is there any built in function to convert amount >>> in number to words >>> eg:345 >>> as >>> three hundred and forty five.... >> >> Written in 1986, this is a WS copy and a PD copy. >> I made a little program from the two copies. > > [snip] > >> PROCEDURE DIVISION. >> A. > > [snip - what follows, snippage unremarked, are all the > paragraph-names] > >> S9918. >> S9918A. >> S9918A-X. >> S9918B. >> S9918C. >> S9918D. >> S9918E. >> S9918F. >> S9918G. >> S9918H. >> S9918I. > > Mr Dilworth, I'd say that is *exactly* the kind of code - if any code > at > all - that such a request requires. > > DD :-) Richard has it nailed when he says that what is familiar to us looks good to us. What is familiar to Tony Dilworth, however, is a form of COBOL code which is unfamiliar to most of us. It works for him. It's odd. I used to get incensed by Foodman's posts here but now it doesn't bother me in the least. Maybe I'm getting old, maybe I don't care as much about COBOL as I once did, maybe living in peaceful serenity at home is calming my restless spirit :-) Whatever, I looked at this code and actually smiled. Doc's response made me chuckle. Pete. -- "I used to write COBOL...now I can do anything."
From: Richard on 11 Aug 2010 20:44
On Aug 11, 10:00 pm, foodman <foodman...(a)aol.com> wrote: > On Aug 8, 5:20 am, "sharad kumar.j" <aryansmit3...(a)gmail.com> wrote: > > Written in 1986, > S9918. > MOVE SPACES TO WORK-FIELD. > MOVE 1 TO WORK-FLD-SUB. > SET ALPHA-AMT-CHAR-IDX TO 0. > PERFORM S9918A THRU S9918A-X. > IF ALPHA-AMT-CHAR-IDX = 9 > AND ALPHA-AMT-CHAR (ALPHA-AMT-CHAR-IDX) = 1 > MOVE 'Y' TO DOLLAR-SW, > ELSE > MOVE 'N' TO DOLLAR-SW. > IF ALPHA-AMT-CHAR-IDX > 9 > MOVE 'ZERO' TO ALPHA-AMT-STRING-FLD, > PERFORM S9918H, > ELSE > PERFORM S9918B UNTIL ALPHA-AMT-CHAR-IDX = 10. Did you really use commas in the procedure division ? These are a rich form of bugtrap that should have been eliminated in Cobol'61. Printers and most editors fail to distinguish adequately between '.' and ',' leading to one being mistaken for the other. |