What is Automatic Access to Files in UFO ?
A UFO application can automatically access files without the need for any procedural code. This native UFO access strategy is known as Automatic Access. It is designed to read and write at specific places in the UFO/Forms cycle and is activated on the DDX, which describes the file(s) to be processed automatically. Up to 4 files can be accessed automatically in one application.
This is the first of a two-part article that will discuss the different modes of Automatic File Access: Browse Mode and Direct Mode. This article will provide an example of Automatic Access using Browse Mode.
Browse Mode | In browse mode, Advantage UFO reads the file sequentially. A full or partial value for the key can optionally be provided to return the first record. If the record cannot be found for the key supplied, the next higher record is displayed. |
A Sample Automatic Access "Browse Mode" Application
The following illustration of Automatic Access using Browse Mode will use the basic UFO components:
DD (Display Definition)
DDX (Display Definition Extension)
DSD (Data Structure Definition)
CATVIEW
Since UFO Automatic Access is being used, no application procedural code (PDS component) is needed. All the I/O for this application will be done by Automatic Access.
DD (Display Definition)
The display definition or DD named CUSTAUTO for this application is shown below. Notice the fields in bold. Fields CUSTNUM and CUSTNAME have 0 as the File Number (F#). This indicates that file number 0 is being used. For browse mode, up to two files can be accessed, using file numbers 0 or 1. The file number must match the file number specific for the file on the DDX component. If not, a screen compilation error will occur when the application is executed.
UFODD REVIEW/UPDATE/CREATE MODE=2 DISPLAY DEFINITIONS FUNCTION--> *
DISPLAY.. CUSTAUTO STATUS. VML.. 1.41 DATE CHANGED 03/24/04
CONTINUED ALARM.. N AUTH. TIME CHANGED 11:54:10.3
CURSOR... CUSTNUM TERMINAL.... U047
PROCEDURE DDXNAME CUSTAUTO OPERATOR....
ROW COL FOR- **NAME** ********* DESCRIPTION ********* US- F R ATT EDIT T
MAT AGE # # F D CD F F
01 1 20 F CUSTOMER LIST 0 0 8 00
02 3 1 NUMBER NAME 0 0 0 8 00
03 4 1 H CUSTNUM 0 0 8 00 3
04 CUSTNAME 0 0 0 8 00
05 24 1 F /MSG 0 0 0 8 00
DDX (Display Definition Extension)
The corresponding DDX component named CUSTAUTO which follows specifies file number 0 for the Auto Access Sequence value and also for the specified file/view name CUSTOMER.
UFODDX REVIEW/UPDATE/CREATE DDX'S FUNCTION--> *
DDX NAME. CUSTAUTO STATUS. VML 1.17 DATE CHANGED 03/24/04
DESC..... TIME CHANGED 11:42:17.5
AUTHOR... REPORT NAME TERMINAL.... U047
ALT SCRN. PRIORITY +0 HELP NAME OPERATOR....
PSB NAME. DBD POSN +0 DBD NAME
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
AUTO ACCESS SEQUENCE: 0 USER FUNCTION FIELD:
0 CUSTOMER 5 VALUE FUNCTION ACBNAME KEY
1 6
2 7
3 8
4 9
PRIVATE WORK STORAGE
SHARED WORK STORAGE
TWA WORK STORAGE
LWS WORK STORAGE
DSD (Data Structure Definition)
The DSD component defined for the view/file CUSTOMER follows:
UFODSD REVIEW/UPDATE/CREATE DSD'S FUNCTION--> *
DSD (VIEW) NAME---------------> CUSTOMER ACCESS METHOD (KEY TYPE)--> I
ACTUAL FILE (OR SEGMENT) NAME-> CUSTOMER ISC OPTION (Y OR N)------->
KEY GROUP HEADER NAME---------> CUSTNUM STATUS CODE--------------->
I/O SIZE ---------------------> INITIALIZE? (Y OR N)------> Y
DETAIL INFORMATION SOURCE-----> C SOURCE NAME --------------> USRIOX
(C=CAT, S=SQL, F=FDS X=EXIT) (LIBR NAME (C), EXIT NAME (X)
(DEFAULT DEPENDS ON SOURCE NAME) RECORD FORMAT (V)--------->
(VARIABLE VSAM/DL/I FILE ONLY)
FOR DL/I ONLY: FOR COPIES ONLY (SEE NOTE):
PSB NAME--------------------> SUFFIX/PREFIX? (S OR P)->
DBD NAME--------------------> NEW SUFFIX/PREFIX------->
DBD POSITION----------------> REPLACES OLD (OPTIONAL)->
CATVIEW
The CATVIEW component defined for the view/file CUSTOMER follows:
CAT Data Dictionary Definition Facility R3.2.0
Command: ________ View: CUSTOMER Library: USRIOX
Level T I Current Position: 1
or y n
Start Field-Name p d Len Scl Occur FLV-Name
CUSTNUM Z U 5
CUSTSTAT C 1 CUSTSTAT
CUSTNAME C 20
CUSTADDR C 71
Sample Output
The execution of our application will display all of the records in the file on the screen. The sample screen display follows:
|
For more information, see the CA UFO Application Programmer Guide and CA UFO Application Supplemental Guide.