Glossary of On-line Help Terms | Examples and Sample Programs |
This tutorial introduces you to character-based programming with NetExpress. The program Adsamp.cbl will show you how to set up a character screen for the user and receive input from it.
You will learn how to use the Enhanced ACCEPT/DISPLAY syntax (Adis) to display a data entry screen in the COBOL text window. Then you will accept input data from the user. This means that you must already have specified which keys can be used to terminate the ACCEPT; you'll do this too.
So, follow the sections below in turn to follow the tutorial step by step:
The ACCEPT/DISPLAY module ("XAF") enables you to specify exactly which keys the user can press to terminate the ACCEPT when all data has been entered. It also enables you to disable other keys.
Set-bit-pairs is the function you want the ACCEPT/DISPLAY module to perform at the moment, setting which function keys you want enabled.
Enable-esc-and-f1 is a group item which is set up to enable only the two function keys Escape and F1. The second elementary parameter is set to the value "1" to denote a user function key.
Here you've used the same function with a different second parameter. Disable-all-other-user-keys is a group item which is set up to disable all function keys other than Escape and F1. The second elementary parameter still has a value "1", as you'd expect.
This statement enables the "/" key so that the user can enter "/h" rather than F1 to get help.
This is a data key rather than a function key, so the second elementary parameter is "3". You'll see how this works in the final tutorial topic.
The cursor-position field is referenced in the Cursor is clause of Special-names.
The data entry screen is displayed in the COBOL text window. You can't enter any data yet, though.
Since you've specifically enabled this function key, you're returned to the program. Pressing Escape or the "/" key would have done the same, but no other function or data key would have terminated the accept.
The key-status parameter is referenced in the crt status clause of Special-names, and contains details of how the accept was terminated.
The "1" condition is true, since this is the code for a user function key (notice the "0" condition, which is true when you press Enter to terminate the ACCEPT).
You'll see that the value is 1, which is the code for the function key F1. The program now knows exactly which key was pressed to terminate the ACCEPT.
The action of clicking F1 tells the program to invoke the Help screen.
The next call to the ACCEPT/DISPLAY module is a different function from the set-bit-pairs call you used before. This time it gets a single character from the user, rather than accepting data as you did before.
Any key returns you from the Help screen to the program.
When you're familiar with the workings of the Adsamp program,
try using the set-bit-pairs call to enable different keys. Then
set a breakpoint at the evaluate key-type statement. Go round the
loop, pressing a different key each time, and seeing what this does to the
values in key-status.
Copyright © 1998 Micro Focus Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
Glossary of On-line Help Terms | Examples and Sample Programs |