Problem:
Many developers find that older COBOL applications or those written for other COBOL compilers like WANG or DEC, demonstrate numeric entry that seems simpler than what Micro Focus COBOL expects. Fewer keystrokes are needed to complete the entry and decimal alignment of edited numeric fields doesn't require the entry of a final period (.) in order to complete the ACCEPT command. Here's a trick that works for all versions of Micro Focus COBOL, whether you are using UNIX products like Server Express or Object COBOL Developer Suite or the PC products like Net Express or the older COBOL Workbench.
Resolution:
Using this short demonstration example:
Program-ID. Numtest.
WORKING-STORAGE SECTION.
01 MY-NUMBER PIC 9(09).
*
PROCEDURE DIVISION.
*
DISPLAY "enter 1234567 into 9(09) " LINE 7 COLUMN 1.
ACCEPT my-number LINE 7 COLUMN 41.
DISPLAY my-number LINE 8 COLUMN 1.
*
stop run.
With Micro Focus COBOL and the default setting of ADIS, the component that controls ACCEPT and DISPLAY behavior, you are required to enter all nine digits with leading zeros or enter '1234567.'.
However, since ADIS is configurable, here are the steps to change the default and make a simple data entry procedure without making any coding changes to the demonstration program.
Log-in as 'root' and go into the $COBDIR directory.
Execute the command 'adiscf'.
A menu will appear at the bottom of the screen.
Select menu option F2=Load and select option 1, Default Configuration.
'Save-As' and supply some name, for example, Orig. (This will preserve the ADIS Default Configuration in the event that you need to keep your Micro Focus product in-tact on this machine).
Next select menu option F2=Alter and then menu option F3=Accept/Display Options.
Next selection menu option F3=Individual Options and choose option "18" for RM-style numeric data entry.
The default will show "1" for Micro Focus default entry.
You want to change that to "2" for RM style numeric data entry, and hit 'Enter' to actually change the value.
Next enter Esc, and again Esc and another Esc to bring back the menu showing option, F4=Save and F3=Overwrite Existing configuration. Hit Esc to Exit.
After ADISCTRL has been changed run the demo program, Numtest, and you'll see that that you can enter simply 123456 <Enter> and the field become right-justified and zero-filled.
N.B. The file, ADISCTRL, will need to be included with the application when it is distributed to maintain this new, non-default, behavior.