Applying format to a numeric edited-field as it is being entered.

February 29, 1996

Author: Eduardo Mendiola
Date: 2/29/96
Category: programming
Keywords: accept,edited-updates
Summary: Applying the format to a numeric edited-field as it is being entered

Normally, when accepting numeric edited fields, such as a date-field (i.e. PIC 99/99/99) or an amount field (i.e. PIC ZZZ,ZZZ.99), the format gets applied to it after the cursor leaves the field (using the screen section) or when the ACCEPT statement terminates (not using the screen section).

Some applications require that the format be applied to a numeric edited field as it is being entered by the user.

To accomplish this, you must add the following configuration variable to your cobol configuration file (CBLCONFIG):


The value will always appear to the user in its "final" form. This is similar to the way numbers are entered on most calculators.

  identification division.
  program-id. testit.
  data division.
  working-storage section.
  01 date-field pic 99/99/99.
  01 amount pic zzz,zzz.99.
  01 customer pic x(20). 
  screen section.
  01 screen-1.
    05 "Date : " line 5 col 5.
    05 using date-field col + 5.
    05 "Amount : " line 7 col 5.
    05 using amount col + 5.
    05 "Customer: " line 9 col 5.
    05 using customer col + 5. 
  procedure division.
    display window erase.
    display screen-1.
    accept screen-1.
    stop run.
Your Session will expire in 90 minutes
Notification will be shown in:
600 seconds