File Management Software

Data Dictionary Maintenance - Views

Last Revised: 02/25/14

The Views option of Data Dictionary Maintenance is used to describe a view.  There are several different types of views, but the most popular type of view, called a standard view, is simply an ordered list of fields within a data structure.  Views can be used in File Maintenance applications and by applications using the View Manager CDS550.  Standard Views can be used in Dynaweb applications using CDW550. Defining one or more standard views is required for File Maintenance applications.

The following screen shot is an example of a Standard View.

Standard views can be used in File Maintenance, Dynaweb, and other applications.  When used in File Maintenance, the views to be included are defined using the File Maintenance Option in Data Dictionary Maintenance.  When used within an application program, a Standard View is referenced by calling the View Manager CDS550.  When used with Dynaweb, a Standard View is accessed using the Web based View Manager CDW550. The View Manager can display the background text, display the view of a particular record or data structure, and allow changes to the fields in the view if desired.

View A letter or number to define the view.  You can have multiple views per file name.
Title Descriptive Information about what the view is used for.  During File Maintenance that includes multiple views, this View Tile is displayed to allow the operator to select the desired view of the data file to maintain.
Security Level Used to restrict file maintenance of this view to operators that have a security level at or higher than the security level assigned to the view.  For example, an operator with a security level of 5 would not be permitted to access views with a security level higher than 5.
Type
V Standard View - an ordered list of fields in the data structure
P Called Program - this type of view is used when a custom program is required for any purpose during File Maintenance
F Subsidiary File Maintenance - this type of view is used to describe a subsidiary file that should also be maintained using file maintenance.  For example, a warehouse file with a key of item# + warehouse code might be a subsidiary file to the item file.  A ship to address file with a key of customer# + sequence# might be a subsidiary file to the customer file. 
Program The use of the Program field varies with the View Type above.
View TypeUse of Program Field
V Standard ViewView Validation Routine - Program is called before the View Manager CDS550 exits the view.  The  View Validation routine can perform additional data tests or activity logging and either accept the data, modify the data, or reject the view returning the operator to view to make corrections to the data.  The View Validation routine should have an ENTER list of ENTER Y$,REC$,RECOLD$,D1$,D2$,S039$.  Each field is described in the table below.  The View Validation routine should EXIT 99 when it is necessary to return to the view for additional operator editing.  See example below.
Y$Standard session control variable
REC$The templated data structure as modified by the operator, i.e., CM01$.
RECA$The templated data structure before any modifications were made by the operator, i.e., CM01A$.
D1$ This templated data structure contains information about the view.  Each field is described in the table below.
FLDSThe number of fields in the view
ROWWhen the view is displayed in a separate window, D1.ROW refers to the row where the window is displayed.  In file maintenance, this is the row where the yellow line with the view description is printed
KEYSEGSDISPThe number of key segments that are displayed in this view
MAXTITLEThe length of the longest field description of the fields in the view
COLENTThe column number where data entries will take place, or data is displayed for display only views
MAP$A variable length string containing a pointer to each maintainable field in the view.  The view can contain heading fields and display-only fields.  Each position in D1.MAP$ contains the reference to the actual field#.  For example, the field that is numbered 5 would point to the 6th field if there was one heading line in the earlier fields of the view.  In this example D1.MAP$(5,1) would contain CHR(6).
MAINT$ A variable length string containing the view field type for each numbered field in the view.
blankNormal maintainable field
SSkip this field when entering all fields on a new record
BSkip this field when entering all fields if it is non-blank
FLDINFO$Used to store the S039$ template for each field in the view
VDT$Used to store the display background text for the view
D2$This templated data structure contains the field data (S039$) for each field in the view.

D2.FLD$[1] contains the S039$ string for the first field in the view.

D2.FLD$[D1.FLDS] contains the S039$ string for the last field in the view.

S039$The template for CDS039 is passed to eliminate the need for the view validation program to retrieve the template, and to inform the Field Change Program what field was being entered when called.
P Called Program

Program to be called.  The ENTER list for the Called Program should be Y$,REC$.  The Called Program can change any field in REC$ except segments of the primary key.

When used in File Maintenance applications, the Called Program should EXIT 98 to re-fresh the display of the primary view.  To have File Maintenance write the record to disc, as if the operator touched F4 at the list of views, the Called Program should EXIT 99.

F Subsidiary File Maintenancenot used in Standard Views
Field Change Program The view manager can call an operator defined Field Change Program after the operator enters each field in the view.  Such a program could be used to compute totals or validate the view immediately upon entry of each field instead of waiting until the operator exits the view.  The ENTER list for the field change program should be ENTER Y$,REC$,RECA$,D1$,D2$,S039$.  Refer to the information above for field definitions.  Applies only to Standard (Type V) Views.  The Field Change program can EXIT 99 to inform the View Manager to return to the entry of the current field, as would be necessary if the Field Change Program determined the entry was invalid.  The Field Change program can EXIT 98 to inform the View Manager to re-display all fields in the View.

Note that the Field Change Program is also called once after displaying a view.  This is done so that any information such as a computation result can be displayed when the view is displayed.  In this case S039$ will be an initialized templated string that does not have any values.  The EXIT options are ignored during this initial CALL.

Subsidiary F/M File Name This field only applies to Type F (File Maintenance) views and should contain the name of the subsidiary file to be maintained in this view.  This is the file name as stored in the data dictionary so it would exclude the company code.
Subsidiary F/M VDT Suffix The VDT Suffix is required for Type F (File Maintenance) views and refers to the VDT suffix used when defining the File Maintenance Configuration for the subsidiary file to be maintained.  It is typically the letter A for the first file maintenance, and B for the second, although most files do not require more than one File Maintenance Configuration.
Top Row File Maintenance will position any secondary view window at the bottom of the display to retain as much of the primary view on the display as possible.  You can specify a top row for the view when it is necessary to override the default view position.
Detail Only applies to type V (Standard) views and is a list of each field to be included in the view.  Fields are displayed in a single column, so if you have more fields than would fit in a single column, then create a second view.  The data elements that make up the view detail are described below.
Column Heading Definition
M Field Modes
blankstandard field from data dictionary
OOmit this field from the view.  You could also delete the field, but the Omit option is useful if there may be a need to un-omit the field in the same position in the view in the future.
BOmit this field from the view if the numeric field is zero, or a string field is null or blank.  Note that this Mode only applies when calling the View Manager CDS550 with S550.BKG=1 (display background) and S550.DISP=1 (display record).
CConditionally omit the field from the view.  This field will be dynamically omitted based on the conditions specified below.
HUse to insert a heading row (or blank row) on the display
Field NameEnter the field name or use the F2 option to select a field name from the data dictionary that is not yet included in this view.  For Heading type fields, the heading text is entered here.
O Maintenance Option
blankField can be maintained
QField is displayed but not maintained (inquiry only)
SSkip this field when entering all fields on a new record
BSkip this field when entering all fields on a new record if the field is non-blank
Type/Condition For normal fields the field type information is displayed from the data dictionary for convenience.  For fields with a Mode of C (Conditionally Omit), the condition to omit the field is described here.
Module CodeA two character code that describes a Dynamo Parameter record.  A Dynamo Parameter File contains a single Dynamo Parameter Record with a key of XX where XX is the module code, i.e., AP, GL, SO, PO, TO, etc.
Field NameThe Field name from the Dynamo Parameter Record that is used for the conditional test
Field Value(s)A list of values which if the Dynamo Parameter Record Field contains one of the values entered, then the field will be included in the view, otherwise it is omitted.  For example, if the Module Code is PO, and the Field Name is SERIALIZED, and the Field Value is FP, then the field will be shown if PO00.SERIALIZED$ contains F or P.  Note that the view manager uses SW005 to retrieve the Module Parameter Record.

Example - Called Program View type.

Example - Subsidiary File Maintenance View type.

Example - View Validation Routine

This example is used in Purchase Order processing to perform some additional processing when exiting the view that contains the warehouse code or date ordered.  The program copies the warehouse and date ordered fields to each line item on the purchase order as they are used in keys in the PO detail record.
0100 REM "PO130 - 10/09/06 POP Validate All Heading Views
0110 SETESC 8000; SETERR 8000
0120 ENTER Y$,PO40$,PO40A$,D1$,D2$,S039$,ERR=0130
0130 IF LEN(PO40A$)=0 OR FNC("WHS") OR FNC("DATEORD") THEN GOSUB DODETAIL
0140 GOTO EOJ

1000 DODETAIL:
1010 IF PO40.DATEORD=0 THEN LET PO40.DATEORD$=$FFFFFF$
1020 CALL "PO111",Y$,PO40$
1030 CALL "CDS095",PO41,"XXPO41","YUY",PO41$
1040 READ (PO41,KNUM=1,KEY=PO40.PONO$,DOM=1050)
1050 LET K$=KEY(PO41,END=1110)
1060 IF K$(1,8)<>PO40.PONO$ THEN GOTO 1110
1070 EXTRACT RECORD(PO41)PO41$
1080 LET PO41.WHS$=PO40.WHS$,PO41.DATEORD=PO40.DATEORD
1090 WRITE RECORD(PO41)PO41$
1100 GOTO 1050
1110 RETURN

1200 FUNCTIONS:
1210 DEF FNC(FLDNAM$)=FIELD(PO40$,FLDNAM$)<>FIELD(PO40A$,FLDNAM$)
 

8000 REM "Call Error/Escape Routine
8010 CALL "CDS063",STR(TCB(5)),Y$,PGM(-2)
8020 ON Y.ERRSTS GOTO 8030,8040,8050,8060
8030 SETERR 0
8040 RETRY
8050 RETURN
8060 RETRY

9000 EOJ:
9010 IF TCB(13) THEN EXIT
9020 RUN "CDS001"

9100 EOJERR:
9110 EXIT ERR

Field Change Program Example

This example, also from Purchase Order Processing is used whenever a field is changed on a line item such as QTY, COST, MULT, etc.  it will re-compute all line item extensions and display the extended amounts to the right of the view fields below the 'Total' heading.  See screen shot below example code.
0100 REM "PO128 - 03/02/07 POP Extend PO Detail
0110 SETESC 8000; SETERR 8000
0120 ENTER Y$,PO41$,PO41A$,D1$,D2$,S039$,ERR=0130
0130 IF PO41.OPEN$="C" OR FIELD(S039$,"FLDNAM",ERR=0140)="QTY" THEN GOSUB CHKQTY
0140 CALL "DIS010",PO41.CU$,CUQTY
0150 LET PO41.EXTCOST=PO41.QTY*PO41.COST*(100-PO41.DISCPCT)/100/CUQTY
0160 IF PO41.MULT THEN LET PO41.EXTCOST=PO41.EXTCOST*PO41.MULT
0170 LET PO41.EXTFET=PO41.QTY*PO41.FET
0180 LET PO41.EXTCORE=PO41.QTY*PO41.CORE
0190 LET PO41.EXTWEIGHT=PO41.QTY*PO41.WEIGHT/MAX(1,PO41.PKGQTY)
0200 LET PO41.EXTCUBE=PO41.QTY*PO41.CUBE/MAX(1,PO41.PKGQTY)
0210 IF LEN(D1$) THEN GOSUB DISP
0220 EXIT

1000 DISP:
1010 LET FLDNAM$="COST",MASK$="#,###,###.00"; GOSUB DISPFLD
1015 LET FLDNAM$="CORE",MASK$="#,###,###.00"; GOSUB DISPFLD
1020 LET FLDNAM$="FET",MASK$="#,###,###.00"; GOSUB DISPFLD
1040 LET FLDNAM$="WEIGHT",MASK$="N12.4"; GOSUB DISPFLD
1050 LET FLDNAM$="CUBE",MASK$="N12.4"; GOSUB DISPFLD
1060 RETURN


1100 DISPFLD:
1110 FOR I=1 TO D1.FLDS
1120 LET S039$=D2.FLD$[I]
1130 IF S039.FLDNAM$=FLDNAM$ THEN GOSUB DISPEXT; BREAK
1140 NEXT I
1150 RETURN

1160 DISPEXT:
1162 IF FLDNAM$="COST" THEN PRINT @(S039.COL+12,S039.ROW-1),'SB','BU',PAD("Total",12,"R"),'EU','SF',
1165 LET VAL=NFIELD(PO41$,"EXT"+FLDNAM$),OUT$=FILL(12)
1170 IF VAL THEN IF MASK$(1,1)="N" THEN CALL "CDS359",12,VAL,OUT$ ELSE LET OUT$=FILL(12,"*"),OUT$=STR(VAL:MASK$,ERR=1175)
1175 PRINT @(S039.COL+12,S039.ROW),OUT$,
1180 RETURN

1200 CHKQTY:
1205 IF PO41.QTY<0 THEN LET PO41.QTY=1; CALL "CDS069",0,0,0,0,'RB'+"Quantity Ordered cannot be negative-"; EXIT 99
1210 CALL "PO131",Y$,PO41$,PO131$
1220 IF PO41.QTY<PO131.QTYRCVD THEN LET PO41.QTY=PO131.QTYRCVD; CALL "CDS069",0,0,0,0,'RB'+"Quantity Ordered cannot be changed to be less than Quantity already received of "+STR(PO131.QTYRCVD)+"-"; EXIT 99
1230 IF PO41.QTY>PO131.QTYRCVD THEN LET PO41.OPEN$=" "; REM "Re-open line item if qty was changed
1240 RETURN

8000 REM "Call Error/Escape Routine
8010 CALL "CDS063",STR(TCB(5)),Y$,PGM(-2)
8020 ON Y.ERRSTS GOTO 8030,8040,8050,8060
8030 SETERR 0
8040 RETRY
8050 RETURN
8060 RETRY

9000 EOJ:
9010 IF TCB(13) THEN EXIT
9020 RUN "CDS001"

9100 EOJERR:
9110 EXIT ERR

Example of a Field Change Program where a total field is computed and re-displayed when its value has changed.
0100 REM "PO603 - 01/07/10 POP Invoice Reconciliation Field Change Routine
0110 SETESC 8000; SETERR 8000
0120 ENTER Y$,PO60$,PO60A$,D1$,D2$,S039$
0130 LET INVAMT=PO60.SUBTOTAL-PO60.DISCOUNT+PO60.SHIPPING
0140 IF PO60.INVAMT<>INVAMT THEN GOSUB DISP
0150 EXIT

1000 DISP:
1010 LET PO60.INVAMT=INVAMT
1020 DIM S039A$:FATTR(S039$)
1030 FOR I=1 TO D1.FLDS
1040 LET S039A$=D2.FLD$[I]
1050 IF S039A.FLDNAM$="INVAMT" THEN LET S039A.TYPE$="Q"+S039A.TYPE$; CALL "CDS039",S039A$,PO60$; BREAK
1060 NEXT I
1070 RETURN

8000 REM "Call Error/Escape Routine

8010 CALL "CDS063",STR(TCB(5)),Y$,PGM(-2)
8020 ON Y.ERRSTS GOTO 8030,8040,8050,8060
8030 SETERR 0
8040 RETRY
8050 RETURN
8060 RETRY

9000 EOJ:
9010 IF TCB(13) THEN EXIT
9020 RUN "CDS001"