From: David E. <de...@us...> - 2007-01-11 00:16:48
|
Harold Norris wrote: > I took test26.cob as a start. > The existing data being displayed is being updated > with new data. > I am using a PIC X(*) variable as TC doesn't deal > well with non numeric data in a numeric variable. > ... > WORKING-STORAGE SECTION. > 01 D-1 PIC Z(6).99. > 01 D-2 PIC S9(6)V99 VALUE 45.77. > 01 W-1 PIC X(14) JUST RIGHT. > 01 W-2 PIC X(14) JUST RIGHT. > 01 W-3 PIC X. > 01 E-X PIC 9(4) COMP. > PROCEDURE DIVISION. > GO TO A001-START. > EX1-ERROR. > IF E-X = 14 MOVE 0 TO E-X. > A001-START. > MOVE D-2 TO D-1. > MOVE D-1 TO W-1. > display W-1 LINE 3 POSITION 10. > accept W-2 line 3 position 10 > ON EXCEPTION E-X PERFORM EX1-ERROR. > INSPECT W-2 REPLACING LEADING " " BY "0". > * IN HERE ARE LINES DETERMINING IF THE > * INPUT CHARACTERS ARE NUMERIC OR NOT. > MOVE W-2 TO D-2. > MOVE D-2 TO D-1. > DISPLAY D-1 LINE 3 POSITION 10. > IF E-X = 0 GO TO A001-START. > STOP RUN. > > What I get when I run the program is > (on line 3 position 10). > 45.77 > The accept cursor locates itself in > column 10 AND does not blank out the 45.77 > after I input numeric data and hit enter, > the old 45.77 is replaced by the new data. I think your code segment works, but there is no automated way to test you code changes for any new bugs. I have looked at the code, and currently there are two options available. The first, the default, will pad the data with blanks and display it. The second, UPDATE, will update the display field with the contents of the identifier. So I'm not aware of any SCREEN-IO option to achieve the desired effect. But I think that would be the way to do it. Is any one aware if it is possible to to the above with other compilers? And if so, is it an option or default behavior. > If you don't get this when you run it, I'll send over a copy of my > library. The only other addition to the library is a trap for > control-c. > My customer's employees enjoy, I think, entering control-c > to terminate what ever they are doing and it has caused > massive damage to the data files. Congratulations, you are now officially a C programmer. Well 'control-c' is trapped by the curses library, I think. It is supposed to be used in emergency situations only. The TC RTL does not do any clean-up of the run-time unit. As a result, the files are not sync-ed and closed. There are some ways around this, but then you would need some other way to trap an emergency exit. David Essex |