CDS028

File Maintenance

Last Revised: 02/02/15

This program can be run or called to provide file maintenance for files described in the Data Dictionary.  File Maintenance applications provide the ability for users to add, modify, delete, and view records from data files. Each File Maintenance includes at least one Standard View, but frequently also includes additional Views.  The data file must be defined using Data Dictionary Maintenance (FMS).  The Views must be defined using the Views Option of Data Dictionary Maintenance (FMS). The Views to be included in the File Maintenance are specified in the File Maintenance Option of Data Dictionary Maintenance (FMS). CDS028 can also be used in 'inquiry only mode' where records can be displayed but not modified, added, nor deleted.  Inquiry only mode is also enabled when the user does not have write permissions to the primary data file.

CDS028 is typically RUN from the menu; however, applications can also RUN or CALL CDS028 as needed. 

When CDS028 is run, the following variables are used.  All other variables are cleared.  The Data Dictionary company code and Data Dictionary File Name are derived from Y.APPID$Y.VDTSFX$ is used for the File Maintenance VDT Suffix.  When the user exits, the Dynamo menu CDS001 will be run.

CDS028 is also run from the Dynamo menu when the menu selection type is set to "F" for File Maintenance.  In most cases, the data file to be maintained can be determined by the Application ID.  When the data file name does not match the data dictionary file name, you can specify the data file name as File 1 in Menu Maintenance.

Effective with CDS028 dated 02/24/14 or later, if the record has changed, it will be written to disc on multiple-view maintenance whenever the user selects a view option. This ensures that any routine that reads the record from disc will always have the latest version of the record.

Y$ Session Control Variable.  Optional.
Y.APPID$Used to determine FILENAME$ when FILENAME$ is not provided.
Y.APPID$(1,2)Used to determine Data Dictionary Code (S028.DDCC$)
Y.APPID$(3)Used to determine Data Dictionary File Name (S028.DDFN$)
Y.VDTSFX$Used to determine File Maintenance suffix code (S028.VDT$)
Y.PASSPARM$"Q" indicates inquiry only mode
Y.SECLEVOperator's security level which can limit which views the operator can access based on the security level specified in View Maintenance.
FILENAME$ The data file name to be maintained, including a company code if applicable.  Required.  May begin with XX indicating the current company code.

The following variables are used when CDS028 is called.

CALL "CDS028", Y$, S028$ {, RECMAIN$ }

Y$ Session Control Variable.  Optional.
S028$
S028.DDCC$ Company Code for Data Dictionary.  Optional.  If blank or XX, then Y.COMPCODE$ will be used.
S028.DDFN$ Data Dictionary File Name.  Required.  This is the key to the Data Dictionary which excludes any company code if applicable.
S028.VDT$ File Maintenance suffix code as specified in File Maintenance Configuration.  Required.
S028.FILENAME$ The data file name to be maintained, including a company code if applicable.  Required.  May begin with XX indicating the current company code.
S028.KEYPFX$ Only used when CDS028 is CALLed, as in Subsidiary File Maintenance and represents the key of the primary record being maintained
S028.PFXKNO This field is no longer used.  The KNUM must be specified using File Maintenance Configuration Maintenance. Previously only used when CDS028 was CALLed, as in Subsidiary File Maintenance and represents the KNUM of the Subsidiary File to be maintained.
S028.MAXDESC Only used when CDS028 is CALLed, as in Subsidiary File Maintenance and is used to indicate the longest Description field on initial view of the primary file in order to pad out the field Descriptions to match the initial view.
S028.TOPROW Used to indicate the top most display row to be used.
RECMAIN$

The templated string can be used to pass key segments of a specific record to be maintained to CDS028 eliminating the need for the operator to enter any key segments.

It is also used with Subsidiary File Maintenance where RECMAIN$ is the templated record of the primary file being maintained.

The key segments in the subsidiary file will be derived from RECMAIN$ instead of operator entry.  This mapping is based on common field names so be sure that the key segment fields of the data file being maintained match the type and size of the fields in RECMAIN$.

In most cases, the operator enters the various key segments that make up the key to the primary data file being maintained.  CDS028 will provide default values and allow use of the ArrowUp and Down keys to step forward and backward through the file.

When multiple records already exist in the file, the user will also be presented with the option to 'Select existing record from list'.  This option will call CDS037 to display the fields specified using File Maintenance Configuration (FMS).  Search capabilities also exist to allow the user to select a record based on an entered search argument.

If the primary key to the data file only has a single value, then the key entry routines are not required.  This is useful when creating File Maintenance for single records in control or parameter files.

RUN Example
0180 IF OPT=2 THEN LET Y.APPID$="XXDD00",Y.VDTSFX$="A",FILENAME$=""; RUN "CDS028"
CALL Example
4225 CALL "CDS041","CDS028",S028$,"YY"
4226 LET S028.DDCC$="CD",S028.DDFN$="SM13",S028.VDT$="A",S028,FILENAME$="CDSM13"
4227 LET S028.TOPROW=2
4230 PRINT 'PUSH',@(0,2),'CE',
4240 CALL "CDS028",Y$,S028$
4250 PRINT 'CS','POP',
Company Information Maintenance (SMC) is an example of File Maintenance with a single view.
This example also does not have a 'key' field that is entered by the operator.  The Key field is specified in the data dictionary with a single value of "DD".  When there is only one choice for the valid value of a key field, the value is assumed and not entered by the operator.
Note that field 3 is a T type external called routine that is used for the entry of the Zip Code, City, and State.
Field 9 is also a T type external called routine used for the entry of prefix segments.
Location & Device Maintenance (SMC) is an example of File Maintenance with two views.
The first view is a Standard View that simply allows the user to maintain fields within the primary data file.
Upon exiting the primary view, the user is presented with a list of views that they are authorized to select.
In this case, the first view 'Locations' is the primary view already accessed.  The Devices View is a called program view, which allows the software developer to link any custom programming required to the File Maintenance application.  In this example, the CDS352 Dynamo Tool was used to maintain an unordered list of devices.
If the user selects a device and touches enter, the user can maintain any of the device properties.  This is done using CDS550.
Item Maintenance is an example of File Maintenance with several views.
The primary view is shown below.
The list of views is displayed when exiting the primary view.
Each view can be a:

a) standard view which allows the user to maintain fields specified in the view using View Maintenance (FML), or
b) called program view which allows the software developer to write custom code interfaced as a view to File Maintenance, or
c) subsidiary file maintenance which allows complete multi-record file maintenance to a subsidiary file with one or more key segment fields that are common with the primary data file.
Refer to File Maintenance Configuration documentation for additional details.

The Alternate Item Maintenance is an example of a standard view, although custom code was provided with a T type external routine for the Alternate Item#.
Vendor Part Numbers is a Called Program view, as the application designer preferred to display multiple vendor part numbers on the screen at the same time.  This data is also stored in a subsidiary file.  A subsidiary file maintenance view could also be used, with the limitation of only displaying one record on the display at a time.
Vendor Pricing is an example of a Subsidiary File Maintenance view.  In this case the Vendor Prices are stored in a separate file which includes the ITEMNO in the key.  The ITEMNO is the primary key to the Item file being maintained.   The Pricing Start Date and Promo Pricing End Date are also key segments of the Vendor Pricing (subsidiary) file.  Note the user did not need to re-enter the item# when maintaining the subsidiary file, as it was derived from the primary record.  The user has the same options to enter key segments, select existing record from list, and search the subsidiary file as they have with the primary file.
Example calling CDS028 passing key segments using RECMAIN$
2000 BEGIN
2010 CALL "CDS091",Y$
2020 DIM RECMAIN$:"CUSTNO:C(6)"
2030 LET RECMAIN.CUSTNO$=" 100"
2040 CALL "CDS041","CDS028",S028$,"YY"
2050 LET S028.DDFN$="CM01",S028.VDT$="A",S028.TOPROW=2
2060 CALL "CDS028",Y$,S028$,RECMAIN$