skip to main content

Procedure Division Statements : ACCEPT

ACCEPT
General Format
Format 1
ACCEPT identifier-1 [ FROM mnemonic-name-1 ] [ END-ACCEPT ]
Format 2
ACCEPT identifier-2 FROM { DATE                       }   [END-ACCEPT]
                         { DAY                        }
                         { CENTURY-DATE               }
                         { DATE YYYYMMDD              }
                         { CENTURY-DAY                }
                         { DAY YYYYDDD                }
                         { TIME                       }
                         { DATE-AND-TIME              }
                         { DAY-OF-WEEK                }
                         { TERMINAL-INFO              }
                         { SYSTEM-INFO                }
                         { INPUT STATUS               }
                         { ESCAPE KEY                 }
                         { COMMAND-LINE               }
                         { THREAD HANDLE              }
                         { WINDOW HANDLE              }
                         { CONTROL                    }
                         { LINE NUMBER                }
                         { EXCEPTION STATUS           }
Format 3
ACCEPT  [ ( {Identifier-3}, {Identifier-4} ) ] {screen-name-1}
  [ UNTIL Condition-1 ]
  [ ON {EXCEPTION} [Key-Dest] Imperative-Statement-1 ]
       {ESCAPE   }
  [ NOT ON {EXCEPTION} Imperative-Statement-2 ]
  [ END-ACCEPT ]
Remaining-Phrases are optional, can appear in any order.
  AT Screen-Loc
  AT LINE NUMBER {Identifier-3} [CELL  ]
  AT {COLUMN  } NUMBER {Identifier-4} [CELL  ]
     {COL     }        {Integer-2   } [CELLS ]
     {POSITION}                       [PIXEL ]
     {POS     }                       [PIXELS]
  WITH NO ADVANCING
  {ERASE} [TO END OF] {LINE  }
  {BLANK}             {SCREEN}
  {ERASE} [EOS]
  {BLANK} [EOL]
  WITH [NO] {BELL}
  {UNDERLINE }
  {UNDERLINED}
  WITH {BLINKING}
       {BLINK   }
  {HIGHLIGHT}
  {HIGH     }
  {BOLD     }
  {LOWLIGHT }
  {LOW      }
  {STANDARD }
  {REVERSE-VIDEO}
  {REVERSE      }
  {REVERSED     }
  SAME
  WITH {COLOR } Color-Val 
  {FOREGROUND-COLOR } IS Fg-Color 
  {FOREGROUND-COLOUR}
  {BACKGROUND-COLOR } IS Bg-Color 
  {BACKGROUND-COLOUR}
  SCROLL [UP  ] [ BY Scrl-Num {LINE } ]
         [DOWN]               {LINES}
  WITH {CONVERSION}
       {CONVERT   }
  { WITH NO ECHO }
  { NO-ECHO      }
  { SECURE       }
  { OFF          }
  PROMPT [ CHARACTER IS Prompt-Lit ]
  { DEFAULT [IS Default] }
  { UPDATE               }
  ECHO
  {AUTO         }
  {AUTO-SKIP    }
  {AUTOTERMINATE}
  {TAB          }
  {UPPER
  {LOWER}
  CURSOR Curs-Offset
  CONTROL Cntrl-String
  {REQUIRED   }
  {EMPTY-CHECK}
  {FULL        }
  {LENGTH-CHECK}
  {ZERO-FILL   }
  {NUMERIC-FILL}
  CONTROL KEY IN Key-Dest
  BEFORE TIME Timeout 
  ALLOWING MESSAGES FROM { THREAD Thread-1 }
Format 4
ACCEPT Dest-Item FROM SCREEN
  AT Screen-Loc
  AT LINE NUMBER Line-Num
  AT {COLUMN  } NUMBER Col-Num
     {COL     }
     {POSITION}
     {POS     }
  SIZE Length 
[END-ACCEPT]
Format 5
ACCEPT Dest-Item FROM {CONFIGURATION} Env-Name
  [ ON EXCEPTION Statement-1 ]
  [ NOT ON EXCEPTION Statement-2 ]
  [END-ACCEPT]
Format 6
ACCEPT {Control-Handle}
       {CONTROL       }
  [ ON {EXCEPTION} [Key-Dest] Statement-1 ]
       {ESCAPE   }
  [ NOT ON {EXCEPTION} Statement-2 ]
  [END-ACCEPT]
Remaining-Phrases are optional, can appear in any order.
  VALUE IN [MULTIPLE] Value
  AT Screen-Loc
  AT LINE NUMBER Line-Num [CELL  ]
  AT {COLUMN  } NUMBER Col-Num [CELL  ]
     {COL     }                [CELLS ]
     {POSITION}                [PIXEL ]
     {POS     }                [PIXELS]
  BEFORE TIME Timeout
  CONTROL KEY IN Key-Dest
  ALLOWING MESSAGES FROM { THREAD Thread-1 }
Format 7
ACCEPT EVENT
  BEFORE TIME Timeout
  ALLOWING MESSAGES FROM { THREAD Thread-1 }
  [ ON {EXCEPTION} [Key-Dest] Statement-1 ]
       {ESCAPE   }
  [ NOT ON {EXCEPTION} Statement-2 ]
  [END-ACCEPT]
Format 8
ACCEPT value FROM ENVIRONMENT-VALUE [END-ACCEPT]
Syntax Rules
1.
 
If a THREAD HANDLE or WINDOW HANDLE phrase is used, Dest-Item must be a USAGE HANDLE data item of the appropriate type. If the WINDOW HANDLE phrase is used, Dest-Item can also be a PIC X(10) item.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
Mnemonic-name-1 can be SYSIN or CRT.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
General Rules
1.
Format 1
2.
3.
4.
A.
B.
Format 2
5.
6.
7.
8.
9.
10.
11.
12.
13.
01  terminal-abilities.
    03  terminal-name                            pic x(10).
    03  filler                                   pic x.
        88  has-reverse                          value "Y".
    03  filler                                   pic x.
        88  has-blink                            value "Y".
    03  filler                                   pic x.
        88  has-underline                        value "Y".
    03  filler                                   pic x.
        88  has-dual-intensity                   value "Y".
    03  filler                                   pic x.
        88  has-132-column-mode                  value "Y".
    03  filler                                   pic x.
        88  has-color                            value "Y".
    03  filler                                   pic x.
        88  has-line-drawing                     value "Y".
    03  number-of-screen-lines                   pic 9(3).
    03  number-of-screen-columns                 pic 9(3).
    03  filler                                   pic x.
        88  has-local-printer                    value "Y".
    03  filler                                   pic x.
        88  has-visible-attributes               value "Y".
    03  filler                                   pic x.
        88  has-graphical-interface              value "Y".
    03  usable-screen-height                     pic x(2comp-x.
    03  usable-screen-width                      pic x(2comp-x.
    03  physical-screen-height                   pic x(2comp-x.
    03  physical-screen-width                    pic x(2comp-x.
    03  filler                                   pic x.
        88  is-remote                            value "Y".
    03  client-machine-name                      pic x(64).
For performance reasons, screen width and screen height are actually inquired only the first time that TERMINAL-INFO is accepted from the TERMINAL-ABILITIES. The next times the runtime returns the stored information. Due to this rule, the returned information becomes unreliable if the user changes the screen resolution in the system during the runtime session. In order to disable the optimization and have the runtime inquire the system every time that TERMINAL-INFO is accepted from TERMINAL-ABILITIES, set iscobol.terminal.info.refresh_monitor (boolean) * to true in the configuration.
14.
01  system-information.
    03  operating-system                         pic x(10).
        88  os-is-msdos                          value "ms-dos".
        88  os-is-os2                            value "OS/2".
        88  os-is-vms                            values "vms""vax/vms".
        88  os-is-unix                           value "Linux""AIX""HP-UX""SunOS""Solaris".
        88  os-is-linux                          value "Linux".
        88  os-is-aos                            value "aos/vs".
        88  os-is-windows                        values "Windows 95""Windows 98""Windows Me".
        88  os-is-win-nt                         values "Windows 20""Windows XP""Windows Vi""Windows 7""WINDOWS""Windows Se""Windows 8""Windows 8.""Windows 10".
        88  os-is-win-family                     values "Windows 95""Windows 98""Windows Me""Windows 20""Windows XP""Windows Vi""WINDOWS""Windows 7""Windows Se""Windows 8""Windows 8.""Windows 10".
        88  os-is-amos                           value "amos".
        88  os-is-mpe                            value "MPE/iX".
        88  os-is-mpeix                          value "MPE/iX".
        88  os-is-mac                            value "Mac OS""Mac OS X".
    03  user-id                                  pic x(12).
    03  station-id                               pic x(12).
    03  filler                                   pic x.
        88  has-indexed-read-previous            value "Y".
    03  filler                                   pic x.
        88  has-relative-read-previous           value "Y".
    03  filler                                   pic x.
        88  can-test-input-status                value "Y".
    03  filler                                   pic x.
        88  is-multi-tasking                     value "Y".
    03  runtime-version.
        05  runtime-major-version                pic 99.
        05  runtime-minor-version                pic 99.
        05  runtime-release                      pic 99.
    03  filler                                   pic x.
        88  is-plugin                            value "Y".
    03  serial-number                            pic x(20).
    03  filler                                   pic x.
        88  has-large-file-support               value "Y".
    03  filler                                   pic x.
    03  filler                                   pic x.
        88  is-64-bit                            value "Y".
The serial-number field receives the serial number associated to the runtime license.
 
Note - If your current JVM was released before the current operating system, then the operating-system field value may not be accurate.
15.
16.
17.
18.
19.
20.
21.
22.
o
o
o
o
o
o
o
o
23.
24.
Format 3
25.
26.
27.
28.
The line and column coordinates can be specified between parenthesis soon after the ACCEPT word. This is a Microsoft COBOL extension and requires the -cms compile flag.
29.
30.
31.
32.
33.
 
The transfer occurs after the operator has been given the opportunity to modify the elementary screen items and the operator has pressed a terminator key or a user-defined or context-dependent function key. This transfer occurs in the following manner:
A.
 
COMPUTE receiving-field = FUNCTION NUMVAL (screen-item)
B.
 
COMPUTE receiving-field = FUNCTION NUMVAL-C (screen-item)
C.
 
MOVE screen-item TO receiving-field
 
where:
 
receiving-field is the data item referenced in the TO or USING clause, and screen-item is the screen item.
34.
35.
Any other keywords and spaces are discarded. If more than one keyword from within the above lines appears in cntrl-string, then only the rightmost one in the data item is used. Each of the keywords performs the same action as the statically declared attribute of the same name. When a CONTROL item conflicts with the statically declared attributes of the ACCEPT statement, the actions specified in the CONTROL item take precedence. The FCOLOR and BCOLOR keywords are used to set foreground and background colors respectively. These keywords must be followed by an equals sign and the name of a color taken from the following list: BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, and WHITE. The named color becomes the default foreground or background color for the window. Note that this is different from the COLOR phrase, which sets the color only for the current ACCEPT statement. The FCOLOR and BCOLOR keywords set the default colors for every subsequent ACCEPT until explicitly changed. “GRAPHICS” allows to create single line boxes.
36.
37.
A.
B.
38.
 
The value of mouse-flags is the sum between one or more of the following values:
For example, in order to intercept all mouse actions, use
The following crt status values are returned by mouse actions:
In the general model for graphical user interfaces, the system directs events to the window where the event occurred. This window owns the event. The effect of this is most noticeable when you examine what happens when controls interact with the mouse. As the mouse moves across the application screen, the various windows that the pointer passes over each receive the appropriate events. If you look at an application screen that has several controls, the application window receives those mouse events that occur when the pointer is in the application window, but not over any of the controls. When the mouse pointer is over a control, that control receives the mouse events. This means that MOUSE FLAGS affects the behavior of the mouse only when it is not over a control. When the mouse is over a control, that control does its own mouse processing.
Format 4
39.
40.
Additional phrases, CURSOR, CONTROL KEY, BEFORE TIME, ON EXCEPTION are described below:
CURSOR Phrase
41.
CONTROL KEY Phrase
42.
43.
BEFORE TIME Phrase
44.
45.
46.
ALLOWING MESSAGES Phrase
47.
A.
B.
C.
48.
49.
A.
B.
50.
51.
ON EXCEPTION Phrase
52.
A.
B.
C.
D.
E.
F.
G.
53.
54.
55.
56.
Format 5
57.
58.
If an entry is found, then its value is moved to dest-item.
If no matching entry is found, or if the Env-Name is the name of a configuration variable whose value cannot be returned, spaces are moved to dest-item and Statement-1, if specified, is executed.
If a legal matching entry is found, then Statement-2 (if specified) is executed.
Format 6
59.
60.
61.
62.
63.
Format 7
64.
65.
66.
Format 8
67.
68.
Examples
Format 1
accept ws-code from console
Format 2 - Several examples
accept my-date from date
accept my-date from date yyyymmdd
*> Accept current day of the year
accept myday from day yyyyddd
accept mydatetime from date-and-time
accept all-param from command-line
Format 3 - Display and Accept a screen defined in Screen Section
       working-storage section.
       01 window-handle usage handle.
       01 cust-values.
          05 ws-cust-code  pic x(5).
          05 ws-cust-name  pic x(50).
       screen section.
       01 screen-1.
          03 scr-cust-code Entry-Field
             using ws-cust-code
             size 12.7 cells 
             lines 3.8 cells 
          03 scr-cust-name Entry-Field
             using ws-cust-name
             size 24.5 cells 
             lines 4.6 cells 
          03 scr-lab-1 Label
             size 13.5 cells 
             lines 3.7 cells 
          03 scr-lab-2 Label
             size 13.5 cells 
             lines 3.7 cells 
          03 scr-pb-save Push-Button
             size 15.5 cells 
             lines 6.4 cells 
       procedure division.
          display standard  window background-low
              handle window-handle.
           display screen-1.
           perform until exit-pushed
              accept screen-1 on exception 
                 perform is-screen-1-evaluate-func
           destroy window-handle.
Format 4 - Get the text displayed on specific position of a character-based screen
display "Customer Name : " line 5 col 10
display cust-name line 5 col 30
accept tmp-cust-name from screen line 5 col 30
Format 5 - Get some configuration properties and environment variable values
accept mytemp-dir from environment "temp"
accept my-file-index from environment "file.index"
accept my-location from environment "mycustom.location"
Format 6 - Display screen defined in screen section, accept only one control
       working-storage section.
       01 window-handle usage handle.
       01 cust-values.
          05 ws-cust-code  pic x(5).
          05 ws-cust-name  pic x(50).
       screen section.
       01 screen-1.
          03 scr-cust-code Entry-Field
             using ws-cust-code
             size 12.7 cells 
             lines 3.8 cells 
          03 scr-cust-name Entry-Field
             using ws-cust-name
             size 24.5 cells 
             lines 4.6 cells 
          03 scr-lab-1 Label
             size 13.5 cells 
             lines 3.7 cells 
          03 scr-lab-2 Label
             size 13.5 cells 
             lines 3.7 cells 
          03 scr-pb-save Push-Button
             size 15.5 cells 
             lines 6.4 cells 
       procedure division.
          display standard  window background-low
              handle window-handle.
           display screen-1.
           perform until exit-pushed
              accept scr-cust-code on exception 
                 perform is-screen-1-evaluate-func
           destroy window-handle.
Format 7 - Accept to wait for an event to terminate it and then display the event
accept event on exception ws-event continue
display message "Event : " ws-event
Format 8 - Accept from environment-value previously setup with display upon
display "envfullname" upon environment-name
display "Adam Smith" upon environment-value
accept f-name from environment-value

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left