=========================================================================
M I C R O F O C U S
V4.0.5
Running Under The DG/UX
Operating System Version 5.4R3.10
On The AViiON
=========================================================================
USING THE SCREENS UTILITY
=========================
This document should be regarded as an supplement to the chapter
"Screens" in your Toolbox Operating Guide. It introduces the Screens
utility by means of a tutorial. This will help you learn the major
facilities available in Screens.
TABLE OF CONTENTS
=================
INTRODUCTION
TUTORIAL
Designing the Sample Form
Defining and Manipulating Blocks of Text and Data
Altering the Input Field Acceptance Order
Generating COBOL
Creating an Index Program
Saving the Form
INTRODUCTION
============
The following section is a step-by-step tutorial provided to familiarize
you with some of the features of the Screens utility. This section will
show you how to:
o Design the sample form
o Alter attributes
o Define fields
o Define groups
o Define and manipulate a block of text
o Define an input field acceptance order
o Generate COBOL for the sample form
TUTORIAL
========
Invoking Screens
================
To invoke screens enter:
screens
at the operating system prompt.
Designing the Sample Form
=========================
Having invoked Screens, use text characters and the cursor movement keys
to create on your screen the form shown below:
-------------------------------------------------------------------------
! !
!Name: Tel No: !
! !
! !
!Address: !
! !
! !
! !
! !
! !
! !
! !
! !
! !
! !
! WARNING !
! MESSAGE !
! !
! !
! !
! !
! !
! !
! !
! !
! !
!New form---Attribute------------------Row:14-Col:35-Ins-Caps-Num-Scroll!
!F1=help F2=mark/unmark F3=field F4=group F5=paint-attrib F6=attrib-roll!
!F7=cut-to-blk F8=copy-to-blk F9=restore-blk F10=field-order Alt Ctl Esc!
-------------------------------------------------------------------------
Altering the Current Attribute
==============================
We will now change the attribute of the message.
1. Position the cursor under the W in WARNING MESSAGE.
2. Press F6 repeatedly to roll through the available attributes. Notice
how the word "Attribute" changes on the information line.
3. Select the desired attribute and press F5. This assigns the desired
attribute to the character at the cursor position and moves the
cursor one character to the right.
Continue to press F5 until WARNING is displayed with the new
attribute setting. Move the cursor to the M of MESSAGE and press F5
until this is displayed with the new attribute setting.
You can set the attributes for "Name:", "Tel No:", "Address:" and any
other part of the screen by following the steps outlined above.
Defining Fields
===============
1. Position the cursor at the first character position after "Name:".
2. Enter carets (^ ) to begin defining the "Name:" field. Notice that
the carets (^ ) that you are entering are displayed in the current
attribute setting. This screen now appears as shown:
-------------------------------------------------------------------------
! !
!Name: ^^^^^^^^^^^^^^^^^^^^^^^^ Tel No: ^^^^^^^^^^^^^^^ !
! !
! !
!Address: ^^^^^^^^^^^^^^^^^^^^^^^^ !
! !
! !
! !
! !
! !
! !
! !
! !
! !
! !
! WARNING !
! MESSAGE !
! !
! !
! !
! !
! !
! !
! !
! !
! !
!Group---Attribute-ADDRESS----Group----Row:05-Col:34-Ins-Caps-Num-Scroll!
!F1=help F2=assign-properties F3=repeat-horizontally F4=repeat-vertically
!F5=delete-horizontally F6=delete-vertically Escape !
-------------------------------------------------------------------------
3. Position the cursor in the carets.
4. Press F3 to define the carets as a field.
The carets are replaced by a COBOL picture-string (X's), and a popup
menu of Screen Section clauses appears. The word "Field" appears on
the information line:
-------------------------------------------------------------------------
! | <Field name> | !
!Name: XXXXXXXXXXXXXXXXXXXXXXXX | AUTO Tel No: ^^^| !
! | FULL | !
!Address: | PROMPT | !
! | REQUIRED | !
! | NO ECHO | !
! | ZERO FILL | !
! |>BLANK WHEN ZERO <| !
! | JUSTIFIED RIGHT | !
! | SIZE | !
! | BELL | !
! WARNING +-------------------+ !
! MESSAGE | TO | !
! | FROM | !
! | USING | !
! +-------------------+ !
! !
! !
! !
! !
! !
! !
! !
! !
! !
!Field---Attribute-----------Field-----Row:03-Col:10-Ins-Caps-Num-Scroll!
!F1=help F2=select/unselect-clause F3=edit-clause F4=num/alphanum Esc !
-------------------------------------------------------------------------
We will use the AUTO clause as an example of how to select Screen
Section clauses to be included in your program. (Information about
this clause is found later in this document and in your Language
Reference.)
Note: You can select more than one Screen Section clause to be included
in your program. Some require additional input (for example, a
COBOL identifier for the TO clause). You can also assign a Screen
Section name to the current field by selecting <Field name> in the
popup menu. See the section "Field" later in this document for
details.
5. Use the cursor-up key to move the pointer (">" and "<") to the AUTO
clause in the popup menu.
6. Select the AUTO clause by pressing F2.
7. Use the cursor-down key to move the pointer to the USING clause.
8. Press F3 to edit the USING clause.
9. Enter ORDER-NAME as the name of this field and press Enter.
10. Now press Escape to return to the main menu. The selection of the
AUTO clause is saved. The COBOL picture-string is replaced by carets.
11. Now define the "Tel No:" and "Address:" fields following the steps
outlined above. Note that you might want to define the "Tel No:"
field with numeric characters. This option (F4) is available on the
Field menu. You can also define any legal COBOL picture-string.
Defining Groups
===============
We will now define the "Address:" field as a group. Note that before you
can define groups, you must define all fields that are to be repeated;
there must be at least one.
1. Define the Address field immediately after "Address:" by following
the steps outlined in the section Defining Fields above.
2. Position the cursor at the first caret in the "Address" field.
3. Press F2 to activate the mark option. A reverse video attribute is
painted over the character at the cursor position.
4. Use the cursor-right key to move the cursor to the right so that it
expands the marked area to cover the entire "Address:" field.
5. Press F4. This defines the marked area as a group and invokes the
Group menu.
6. Press F4 four times to vertically repeat the defined area to a total
of five lines.
7. Press Escape to fix the group definition and return to the main menu.
This removes the highlighting and restores the field to its original
attribute setting.
Defining and Manipulating Blocks of Text and Data
=================================================
We will now move the highlighted WARNING MESSAGE down one line.
1. Position the cursor on the W in WARNING MESSAGE.
2. Press F2 to set the mark option. A reversed video attribute is
painted over the character under the cursor.
3. Use the cursor-left and cursor-right keys to expand the marked area to
cover all of the characters.
4. Press F7. The marked area is now separated from the rest of the form
although its appearance does not change. The Block menu appears on
the screen, as shown:
-------------------------------------------------------------------------
! !
! !
!Name: ^^^^^^^^^^^^^^^^^^^^^^^^ Tel No: ^^^^^^^^^^^^^^^ !
! !
! !
!Address: ^^^^^^^^^^^^^^^^^^^^^^^^ !
! ^^^^^^^^^^^^^^^^^^^^^^^^ !
! ^^^^^^^^^^^^^^^^^^^^^^^^ !
! ^^^^^^^^^^^^^^^^^^^^^^^^ !
! !
! !
! !
! !
! !
! !
! !
! !
! !
! !
! WARNING !
! MESSAGE !
! !
! !
! !
! !
! !
! !
! !
! !
! !
!Block---Attribute---------------------Row:13-Col:28-Ins-Caps-Num-Scroll!
!F1=help F2=paste-block F3=copy-from-block F4=store-block !
!cursor-keys=move-block Escape !
-------------------------------------------------------------------------
5. Use the cursor-down key to move the block down one line.
6. Press F2 to paste the block to its current position. The highlighting
disappears and you are returned to the main menu.
Altering the Input Field Acceptance Order
=========================================
If more than one input field exists on a form, you can define the order
of field input when the form is accepted. To demonstrate this, we will
enter the fields in the following order: Name, Address, Tel No.
1. Press F10 to set the field input order. The three defined fields
display 5's by default.
2. Position the cursor inside the "Name:" field.
3. Press 4. This field now displays 4's and will be accepted before the
other two fields at run time.
4. Now position the cursor on the "Tel No:" field.
5. Press 6. The "Tel No:" field displays 6's and will be the last field
accepted at run time.
6. Now press F10 to turn off the field-order option. The order is saved.
Generating COBOL
================
You can now generate COBOL code for the form you have just created.
1. Press Alt+F5. The filename prompt appears at which you enter the name
of the COBOL file you want to generate.
2. Type myform and press Enter. The Generate-COBOL menu appears.
3. Press F3 from this menu. This generates the skeleton program
myform.cbl for the form you have just created.
The program contains a DISPLAY statement. It also contains an ACCEPT
statement since the form contains defined fields. Two other files are
also created in the process: a file with generated Working-Storage
data (myform.wks) and a Screen Section copyfile (myform.ss). You can
now syntax check and run this skeleton program.
After this program is generated, the system returns you to the main
menu and displays the program-name myform at the beginning of the
information line.
Creating an Index Program
=========================
The Screens facility also lets you generate an entire COBOL program based
on a screen that you design. The program generated allows you to key data
into the screen. The data is then stored as records in an indexed
sequential file.
An indexed sequential file is a data file for which an alphabetic index
is automatically maintained. The index is based on a prime key (and
optionally three alternate keys) that you specify on your screen form.
In addition to storing data, the index program lets you recall any record
from disk, change or delete records, and conduct an alphabetic search
through the file regardless of the order in which files were entered.
Selecting Code Type
-------------------
The Screens index generator can produce two different versions of the
index program. The first (marked IDX on the generation menu) generates
code that relies purely on the Screen Section. The second (marked
advanced-IDX on the generation menu) generates code that makes reference
to Micro Focus add-on products. You cannot use this if you do not have
these products. You select the version by using the F8 toggle within the
Generate-COBOL menu.
This toggle only works with Micro Focus add-on products.
Selecting Index Keys
--------------------
1. Press F7 in the Generate-COBOL menu. This will take you into the
mark-fields submenu.
2. Using the cursor keys move the cursor onto the "Name:" field. Press
F2. You will notice that the field has been marked as the PRIME KEY
field. Now, when the index program is generated it will store the
records in NAME order.
3. Using the cursor keys move the cursor onto the "TelNo.:" field. Press
F3. You will notice that the field has been marked as the ALT2 KEY
field. Now, when the index program is generated it will still store
the records in NAME order but you will have the option of retrieving
them in TEL NO. order.
4. If you had more fields on your screen you could now go on and mark up
to two more alternate key fields.
5. If you mark a key field incorrectly you can remove the mark using the
F6=unmark-key-field option.
6. Press Escape to return to the generate-COBOL menu.
7. Press F5 to generate the index program. The program will be named
myform.cbl.
8. You can now leave Screens. The program you have generated can be used
to create and maintain your index program. You might also find it
useful as an example of indexed file handling.
Saving the Form
===============
You can now save your form to be used at another time.
1. Press Alt+F4 from the main menu. The filename prompt appears and
displays myform.srn (The extension .srn is assigned by the system as
the default file extension for a form created with the Screens
facility.)
2. Press Enter to save the form. The system once again returns you to
the main menu.
=========================================================================
Micro Focus is a registered trademark of Micro Focus Limited.
Micro Focus COBOL is a trademark of Micro Focus Limited.
UNIX is a registered trademark of X/Open Company Limited.
=========================================================================
@(#)Vrn/screens.1/4.0.00/06Sep95/nrV
Copyright (C) 1992-95 Micro Focus Limited