The records on the TWA file have various different keys that identify what they are for; however, in all cases the keys (cont.) are eight characters long and begin with the four-character terminal ID that makes the keys unique. This scheme also (cont.) gathers all records for a given terminal in physical proximity to one another. *Regular reorganizations of the TWA file are highly recommended.* All of the records on the TWA file are dynamically created (added) whenever they are first needed, then they are reused (cont.) (updated) as they are subsequently needed. For example, online documentation records will be created the first time (cont.) that online documentation is used at a given terminal, then merely updated as online documentation is subsequently used (cont.) at that terminal. This scheme works well and reduces overhead significantly; however, it has one drawback. The TWA file can become (cont.) over-populated with records for terminals that are no longer active. There are three good methods for solving this (cont.) problem. *First*. You can totally purge the TWA file and re-initialize it. This lets MAGEC dynamically re-add any needed records (cont.) as the need for them arises. The adding of records is less efficient than updating in place, but the penalty is usually (cont.) small and this method is a sure-fire way to solve the over-population problem. To do this you should execute the IDCAMS DELETE/DEFINE, then execute MAGINIT to initialize the file. This could even be done in the online startup JCL, if desired. *Second*. You can selectively purge the records for inactive (or any other) terminals via an online function. The command to do so is: TWAPUR tttt where tttt is the desired terminal ID. If you omit the terminal ID, all records for all terminals (except for the (cont.) terminal where you are) will be purged (deleted). If you subsequently (after the online system is down, or the TWA file (cont.) closed to it) reorganize the file, performance will benefit greatly. *Third*. You can automatically selectively purge records from the file that seem to be inactive (have not been used in (cont.) thirty days or more) by executing the TWAUTIL batch utility program. Following that up with a reorganization is not (cont.) mandatory, but it is a good idea since it will improve online performance. Active records will remain on file and not (cont.) need to be re-created. Since TWAUTIL also "cleans up" some other types of conditions on the TWA file, some users (cont.) execute it in either the TP monitor (e.g. CICS) startup or shut down procedure. Be sure that CICS is down before running TWAUTIL. If CICS is up a SOC1 will result. TWAUTIL performs the following functions: Deletes TWA records that are more than 30 days old Deletes CUTB, USR, DOC, and POP records Deletes SPLR if no terminal references Deletes any other TWA records not in the following format: Term ID valid terminal ID Split Code 0 or W User-view 1 thru 8 User-modes T or P REC-NUMBERS 1 thru 4 OS ** //U2MSI1TX JOB (MSI),TWAUTIL,CLASS=M,MSGCLASS=X, **// MSGLEVEL=(1,1),NOTIFY=U2MSI2,REGION=4M //TWADELET EXEC PGM=TWAUTIL,REGION=4096K //* STEPLIB DD DSN=MAGEC.LOADLIB,DISP=SHR //STEPLIB DD DSN=MAGEC.LOADLB74,DISP=SHR // DD DSN=MAGEC.LOADLIB,DISP=SHR //ALGK1 DD DSN=MAGEC.ALG.CLUSTER,DISP=SHR, // AMP=('BUFND=11,BUFNI=3,STRNO=1') //DCLK1 DD DSN=MAGEC.DCL.CLUSTER,DISP=SHR //DITK1 DD DSN=MAGEC.DIT.CLUSTER,DISP=SHR, // AMP=('BUFND=11,BUFNI=3,STRNO=1') //DOCK1 DD DSN=MAGEC.DOC.CLUSTER,DISP=SHR //ELTK1 DD DSN=MAGEC.ELT.CLUSTER,DISP=SHR //ERRK1 DD DSN=MAGEC.ERR.CLUSTER,DISP=SHR //FCDK1 DD DSN=MAGEC.FCD.CLUSTER,DISP=SHR //KYFK1 DD DSN=MAGEC.KYF.CLUSTER,DISP=SHR //LAPK1 DD DSN=MAGEC.LAP.CLUSTER,DISP=SHR //MMPK1 DD DSN=MAGEC.MMP.CLUSTER,DISP=SHR //PRMK1 DD DSN=MAGEC.PRM.CLUSTER,DISP=SHR //REFK1 DD DSN=MAGEC.REF.CLUSTER,DISP=SHR //SCFK1 DD DSN=MAGEC.SCF.CLUSTER,DISP=SHR //SHDK1 DD DSN=MAGEC.SHD.CLUSTER,DISP=SHR //SIFK1 DD DSN=MAGEC.SIF.CLUSTER,DISP=SHR //TBLK1 DD DSN=MAGEC.TBL.CLUSTER,DISP=SHR //TWAK1 DD DSN=MAGEC.TWA.CLUSTER,DISP=SHR //DVCK1 DD DSN=MAGEC.DVC.CLUSTER,DISP=SHR //SYS005 DD DUMMY,DCB=(LRECL=80,BLKSIZE=80,RECFM=FB) //SYS007 DD SYSOUT=* //SYSOUT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSPRINT DD SYSOUT=* PC ** c: **CD\MAGEC SET SYS006=TWAUTIL.RDR[N] SET SYS007=CON[N] TWAUTIL RE_SET If you are using MAGEC on a PC or LAN (using MicroFocus Cobol), and if the TWA file is located on your local disk dirve (cont.) (as opposed to a LAN server drive), then you can simply delete the TWA file and its index at any time that you are not (cont.) actually executing MAGEC. To do this, type: ERASE TWAK1.* at the prompt. MAGEC will automatically create a new TWA file when it is needed. This is an effective way to eliminate wasted space (cont.) and cluttered indices. You can also do this same thing if the TWA file is being shared on a LAN server drive if you (cont.) first determine that all users are off the system when you do it. # Domain Definition ## What is a Domain? A Domain is a global data definition that is not associated with any particular Data Class (file) or Element; rather, (cont.) it is used as a model for the Data Item definitions (DIT's) within many Elements throughout your systems. A Domain is (cont.) not itself a Data Item, though its definition very strongly resembles the definition of a Data Item, but it can be used (cont.) to enforce standardized definition of Data Items. As an example: you could define a Domain named "ZIP-CODE" (cont.) thatspecifies five (5) digits numeric and includes a descriptive narrative thatexplains what a zip code is. Then, in (cont.) all your Data Item (DIT) definition for a field that is a zip code you could specify "ZIP-CODE" in the Domain Name (cont.) parameter. This would indicate that each of these fields belongs to the Domain named ZIP-CODE. MAGEC will verify that each of the Data Items belonging to ZIP-CODE has a definition compatible with the Domain's (cont.) definition, e.g.: five-digit numeric. This helps you to ensure uniform definitions for similar data, in this example: (cont.) zip codes. When you are adding new definitions for Data Items that are to belong to an existing Domain, MAGEC can save you some (cont.) effort. If you fill in the Domain Name and leave all or some of the other specifications on the DITADD screen blank, (cont.) MAGEC will fill them in automatically from the Domain definition. Refer to the topic *DIT Entry Formats* earlier in (cont.) this section. If you need to know how many, and which, Data Items belong to any given Domain, you can use the where-used facilities (cont.) of MAGEC to provide either an online display or a batch report listing all Data Items belonging to any particular (cont.) Domain. If you wish to alter the definitions of all Data Items belonging to a given Domain, that can be done (cont.) automatically using MAGEC's batch Global Change facility for Domains. Refer to the section, Where-Used Reporting, and (cont.) the section, Domains-Global Changes, earlier in this chapter. Using the Domain definitions, MAGEC can fully automate the logical joining of data from multiple Data Classes (files), (cont.) eliminating the need for the application developer to do any coding at all when developing multi-file accessing (cont.) applications. Refer to the section, Logical Join, earlier in this chapter. This does not mean that the developer cannot (cont.) code logic to access other files if he/she wishes. Domains can help you to save time in documenting your data definitions. If you provide a narrative description with (cont.) your Domain definition, that description will automatically be applied to any Data Items thatbelong to that Domain if (cont.) the narrative description for that Data Item is left blank. This means that for field-level help, if the narrative for (cont.) the source/target field has been left blank, and if it belongs to a Domain, MAGEC will automatically display the (cont.) Domain's narrative on the screen. NOTE: ** The *Tutorials* manual contains further explanation regarding Domains in the "Data Definition" chapter under the section, Domains. ## DOMxxx Functions To add or maintain Domain definitions, use the DOMxxx functions. The screen and functions are very similar to the (cont.) DITxxx functions and screen. Only the differences will be described in this topic since you can refer to the discussion (cont.) for the *DITxxx Functions* earlier in this chapter. **(DOM)//nnnnnn** is the key thatuniquely identifies the Domain. The prefix of "(DOM)" is constant. The two slashes (cont.) indicate that the second component of the key is null. The nnnnnn is the sequence number, that is the actual unique ID (cont.) of the Domain. The numbers 000000 through 000100 are reserved for *figurative constant Domains*, thatwe will discuss (cont.) later. The remaining numbers are for your use in defining your own Domains. **Level** must be a numeric value from 50 thru 65. These are not valid level numbers to the Cobol compiler; they merely (cont.) help you to identify this item as a Domain, not a Data Item. In a planned future release of MAGEC you may be allowed to (cont.) define structures (group items with subordinates) in your Domains--as of the current version, only elementary (cont.) definitions are supported. You should probably always specify a level number of 50 until such time as structures are (cont.) supported for Domains. **Dom. Name** is the one-to-twenty character Domain name. It is similar to a Cobol dataname and follows the same rules (cont.) for format except that you are limited to twenty characters. This is *not* a Cobol dataname, it is the Domain name. You (cont.) do not specify a Cobol dataname for a Domain since it is not the definition of any particular Data Item (field), but (cont.) rather the definition of a category of Data Items. **Lgth** has the same meaning as for a Data Item definition, except that if the Domain is a figurative constant Domain the length will be ignored (may be set to 00001). **Pattern** is the edit pattern associated with Edit Types "P" or "#", just as it is for Data Item definitions. In the (cont.) Data Item definitions, however, this field on the screen is also used for the value associated with a condition name (cont.) (88 level item). There can be no 88 level items among your Domain definitions, therefore, the prompt on the screen (cont.) omits any mention of "88-Val/". **PF6** is specified on this screen to invoke a Where-used display showing a list of Data Items thatbelong to this Domain. ** NOTE: ** The definitions of all the Data Items belonging to a given Domain need not be identical, they must simply be (cont.) compatible. As a rule-of-thumb, you should be able to do a Cobol MOVE from any one Data Item to any other Data Item (cont.) belonging to the same Domain and the resulting value should remain intact. It is permissible for some of the Data Items (cont.) to be numeric binary (COMP) while others are zoned decimal or packed (COMP-3). Certain other differences will be (cont.) permitted, but with a warning message. For example: having some of the Data Items signed numeric while some are (cont.) unsigned numeric would be accepted, but you would be given a warning that a sign could be lost. | ``` ** DOMxxx (DOM)//nnnnnn M A G E C D o m a i n Field Seq#: ...... Mode :. Level: Dom. Name: Sig Dec Sign: Usage: __ ____________________ PIC 9( __ )V9( __ ) _ _ EditType: _ Tbl: ___ Req: _ Lgth: PIC X( _____ ) Just: _ Occurs: _____ Depending On: ____________________ Redefines: ____________________ Pattern: ____________________ Prompt: ____________________ Data Item Narrative: ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ Press PF4 for browse (LOC) screen Press PF6 for Where-used Summary Press PF16 to Copy field to buffer Press PF17 to Paste data from buffer Press PF2 for field-level HELP ```** Figure 05 -- Domain Definition Screen ## Figurative Constants Domains defined with a sequence number less than 000101 are considered to be figurative constant Domains by MAGEC. (cont.) These have meaning in the fully-automated logical join process. A figurative constant Domain name must be one of the (cont.) valid Cobol figurative constants (e.g.: ZERO, SPACES, etc.), or a standard MAGEC-defined constant (e.g.: ONE, TWO, (cont.) etc.) . In the fully-automated logical join matching process MAGEC knows that it does not need to find a matching (cont.) Domain in order to fill in a Data Item (which is part of the primary key of a target joined Element) if it is specified (cont.) with a Domain that is a figurative constant. This gives your developers the advantage of being able to automatically join to Data Classes whose keys include some (cont.) constant prefix or suffix. For example, the SIF Data Class (Security Information File) has a key that is composed of (cont.) two component fields: a key prefix that is always valued ZERO, plus an employee number. MAGEC knows that by moving ZERO (cont.) to the key prefix and moving an employee number into the employee number portion of the key it can construct a full-key (cont.) read of the SIF data. Imagine, for example, a purchase order file with the header records having a key prefix of ONE, (cont.) the detail records having a prefix of TWO, and the trailer records having a prefix of THREE. Each of these record types (cont.) could be defined as a separate Data Class with individual KYF (key), ELT ( Element), and DIT (Data Item) (cont.) definitions. The length or number of digits (significant or decimal places) have no real meaning for figurative constant Domains. (cont.) When you define the Domain you can specify any value greater than zero. When you define Data Items belonging to such a (cont.) Domain, MAGEC will not care whether the length of the Data Item matches the length of the Domain (cont.) definition. # Compressed Data MAGEC includes the ability to compress data files in order to save disk space. This feature is included in the PC and (cont.) Next: https://magec.com/DOC/markdown/db07.md.txt