Features Added in FOCUS 7.7.06

In this section:

The following features were added as of FOCUS 7.7.06.

Adding a Value Test to RESTRICT=NOPRINT

Under prior releases, a RESTRICT=NOPRINT DBA restriction displayed all values or only default values (blank, zero, or MISSING).

This optional extension to RESTRICT=NOPRINT enables you to use a VALUE=expression clause in the RESTRICT command. The expression will be evaluated, and the value will display only if the expression evaluates to true for that value. Any value for which the expression evaluates to false will be replaced on the output by one of the default values.

Therefore, a DBA command that includes the following restriction will only display the true value of SEATS when COUNTRY has the value 'ENGLAND'. Otherwise, default values are displayed:

RESTRICT=NOPRINT, NAME=SEATS, VALUE= COUNTRY EQ 'ENGLAND';,$

Using ACCEPT=SYNONYM in a Master File

How to:

The functionality of ACCEPT in a Master File has been extended.

While normally used in the MODIFY and FSCAN environments to validate data, ACCEPT can be used in FOCUS TABLETALK.

The ACCEPT attribute supports the following types of operations:

Syntax: How to Use ACCEPT = SYNONYM in a Master File

ACCEPT=SYNONYM(lookup_field AS display_field IN lookup_synonym)

where:

lookup_field

Is the field in the lookup_synonym whose value will be used in the filter (WHERE dialogue) or by the amper autoprompt facility that will be compared with the field that has the ACCEPT attribute.

display_field

Is the field in the lookup_synonym, whose value will be displayed for selection in the filter dialogue or amper autoprompt drop-down list.

lookup_synonym

Is the name of the synonym that describes the lookup data.

Storing Localized Metadata in Language Files

How to:

Localized column titles and description attributes can be stored in a Master File using the TITLE_lng and DESC_lng attributes.

However, if you want to centralize localized column titles, descriptions, and prompts, and apply them to multiple Master Files, you can create a set of translation files and use the TRANS_FILE attribute in a Master File to invoke them.

Syntax: How to Create and Invoke Metadata Translation Files

Translation File Naming Conventions

The translation files have names of the following form:

prefixlng.lng

where:

prefix

Is a group of characters prepended to each related translation file.

lng

Is a language code.

For example, if the common prefix is dt, the French translation file would be named dtfre.lng, and the English translation file would be named dteng.lng.

Translation File Contents

The prefixeng.lng file must contain any title, description, and prompt values that you want translated as they appear in the Master File, whether they are in English or another language:

  1. Copy each attribute value from the Master File that you want translated into the default (eng) translation file, and assign it an index number. The index numbers do not need to be consecutive or in order. For example:
    39 = Product,Category
  2. Add the translations of those attribute values to the translation files for the other languages in which you want to display the metadata. Assign the same index number to the translations. For example, in the French translation file:
    39 = Produit,Catégorie

Identifying the Translation Files to Use For a Master File

To specify that a Master File should use a particular set of translation files, identify the common prefix in the FILE declaration of the Master File:

FILENAME=filename,  TRANS_FILE=[path/]prefix, ...

where:

filename

Is the name specified in the FILE= attribute.

path

Is the information needed for locating the set of translation files. It can be a data set in the concatenation of datasets allocated to DDNAME ERRNLS on z/OS, a full path on distributed systems, or an app reference. If there is one set of translation files with the prefix being used and it is on the app path, this can be omitted.

prefix

Is the common prefix for the set of translation files.

Invoking the Translation Files for a Request

  1. Make sure FOCUS and your terminal editor are using a code page that supports the languages to be used.
  2. Set the LANGUAGE parameter to the language in which the metadata should be displayed.
  3. Run the request.

Example: Using Translation Files

The following request uses the WFLITE data source:

TABLE FILE WFLITE
SUM REVENUE_US 
BY PRODUCT_CATEGORY
BY PRODUCT_SUBCATEG
ON TABLE SET PAGE NOPAGE
END

The output is:

Product                 Product                                   
Category                Subcategory                       Revenue 
--------                -----------                       ------- 
Accessories             Charger                        $17,040.04 
                        Headphones                    $296,969.43 
                        Universal Remot               $185,541.93 
Camcorder               Handheld                      $183,951.08 
                        Professional                  $198,254.50 
                        Standard                      $285,048.90 
Computers               Smartphone                    $179,761.46 
Media Player            Blu Ray                       $968,763.75 
                        DVD Players                    $23,668.08 
                        Streaming                      $17,358.73 
Stereo Systems          iPod Docking St               $172,500.36 
                        Home Theater Sy               $366,928.87 
                        Receivers                     $223,366.55 
                        Speaker Kits                  $453,598.11 
Televisions             Flat Panel TV                 $286,160.68 
Video Production        Video Editing                 $259,179.84 

The Master File contains the following TRANS_FILE attribute:

FILENAME=WFLITE,  TRANS_FILE=dt, ...

The TRANS_FILE attribute points to files that start with the characters dt that are in the NLS folder under the EDAHOME directory for distributed systems, and that are members in the ERRNLS concatenation on z/OS. The following sample shows some of the contents of the default translation file, dteng.lng on distributed systems, member DTENG on z/OS:

1 = Age
2 = Age Range
3 = Age Group
6 = Gender
9 = Discount,Rate
10 = Discount,Price,Multiplier
15 = Country
17 = State
19 = City
31 = Customer,Income Range
32 = Customer,Income Subrange
33 = Households
34 = Number of,Earners
35 = Household,Size
36 = Industry
38 = Occupation
39 = Product,Category
40 = Product,Subcategory
41 = Brand Type

The text assigned to each number can be found in one of the Master Files associated with the WFLITE Master File. WFLITE is a cluster Master File that references fact and dimension Master Files to create a star schema.

The following sample shows the corresponding contents of the French translation file, dtfre.lng on distributed systems, member DTFRE on z/OS:

1 = Age
2 = Tranche d'âge
3 = Groupe d'âge
6 = Sexe
9 = Remise,Taux
10 = Remise,Prix,Multiplicateur
15 = Pays
17 = Département
19 = Ville
31 = Client,Tranche de revenus
32 = Client,Sous-tranche de revenus
33 = Ménages
34 = Nombre de,Salariés
35 = Ménage,Taille
36 = Secteur d'activité
38 = Profession
39 = Produit,Catégorie
40 = Produit,Sous-catégorie
41 = Type de marque

When the language is set to French, any text to be displayed that is an exact match to an index number in the dteng.lng file will be substituted with the text for the same index number in the dtfre.lng file.

The following version of the request adds the SET LANG=FRE command. The FOCUS code page supports English and French:

SET LANG = FRE
TABLE FILE WFLITE
SUM REVENUE_US 
BY PRODUCT_CATEGORY
BY PRODUCT_SUBCATEG
ON TABLE SET PAGE NOPAGE
END

The output has translated column titles:

Produit                 Produit                                  
Catégorie               Sous-catégorie                   Recettes
---------               --------------                   --------
Accessories             Charger                        $17,040.04
                        Headphones                    $296,969.43
                        Universal Remot               $185,541.93
Camcorder               Handheld                      $183,951.08
                        Professional                  $198,254.50
                        Standard                      $285,048.90
Computers               Smartphone                    $179,761.46
Media Player            Blu Ray                       $968,763.75
                        DVD Players                    $23,668.08
                        Streaming                      $17,358.73
Stereo Systems          iPod Docking St               $172,500.36
                        Home Theater Sy               $366,928.87
                        Receivers                     $223,366.55
                        Speaker Kits                  $453,598.11
Televisions             Flat Panel TV                 $286,160.68
Video Production        Video Editing                 $259,179.84

Including Sort Objects in the Master File

How to:

Reference:

You can now define sort phrases and attributes in a Master File and reference them by name in a request against the Master File. The entire text of the sort object is substituted at the point in the TABLE request where the sort object is referenced. The sort phrases in the sort object are not verified prior to this substitution. The only verification is that there is a sort object name and an equal sign in the Master File SORTOBJ record.

Reference: Usage Notes for Sort Objects in a Master File

  • The sort object declaration can appear anywhere after the first SEGNAME/SEGMENT record. However, it must appear after all fields mentioned by it in the Master File, including virtual fields.
  • A sort object can use both Master File and local virtual fields.
  • Unlimited sort object declarations may appear in a Master File, but the number referenced by a TABLE request cannot result in more than the maximum number of sort phrases in the request.
  • The sort object declaration can include a description for the object.
  • If a sort object has the same name as a field, the sort object will be used when referenced in a request.

Syntax: How to Declare a Sort Object in a Master File

FILE= ...
SEG= ...
FIELD= ...
SORTOBJ sortname = {BY|ACROSS} sortfield1 [attributes]
  [{BY|ACROSS} sortfield2 ... ] ;
  [DESC[RIPTION]='desc',]
  [DESC_ln='descln', ... ],$

where:

sortname

Is a name for the sort object.

sortfield1, sortfield2 ...

Are fields from the Master File or local DEFINE fields that will be used to sort the report output.

attributes

Are any valid sort attributes, including SKIP-LINE, UNDER-LINE, FOLD-LINE. SUBHEAD, SUBFOOT, SUBTOTAL, and RECOMPUTE.

;

Is required syntax for delimiting the end of the sort object expression.

DESC[RIPTION]=’desc

Is a description for the sort object in the default language.

DESC_ln=’descln

Is a description for the sort object in the language specified by the language code ln.

Syntax: How to Reference a Sort Object in a Request

TABLE FILE ...
   .
   .
   .
BY sortname   .
   .
   .
END

where:

sortname

Is the sort object to be inserted into the request.

Example: Declaring and Referencing a Sort Object

The following sort object for the GGSALES Master File is named CRSORT. It defines two sort phrases:

  • BY the REGION field, with a SKIP-LINE attribute.
  • ACROSS the CATEGORY field.
SORTOBJ CRSORT = ACROSS CATEGORY BY REGION SKIP-LINE ; ,$

The following request references the CRSORT sort object.

TABLE FILE GGSALES
SUM DOLLARS
BY CRSORT
ON TABLE SET PAGE NOPAGE
END

The output is:

             Category
Region       Coffee        Food          Gifts
-------------------------------------------------------
Midwest           4178513       4404483       2931349
Northeast         4201057       4445197       2848289
Southeast         4435134       4308731       3037420
West              4493483       4204333       2977092

Creating and Using a Master File Profile

How to:

Reference:

This release introduces a profile that you can reference in the Master File and is executed during Master File processing. The Master File profile (MFD_PROFILE) is a FOCEXEC that suspends processing of the Master File for a request, executes, and then returns to processing of the Master File. The profile can be used for many purposes, but is especially useful for:

Syntax: How to Invoke a Master File Profile

Add the MFD_PROFILE attribute to the FILE declaration in the Master File:

FILE=filename, SUFFIX=suffix, MFD_PROFILE=app/fexname,$

where:

filename

Is any valid file name.

suffix

Is the suffix value that specifies the file type described by the Master File. MFD_PROFILE is supported for any file type.

app

Is the name of the application containing the FOCEXEC to be executed. Specifying the application name ensures that the correct version of the profile is executed, in case there is another FOCEXEC with the same name higher on the application path.

fexname

Is the name of the MFD_PROFILE FOCEXEC.

Reference: Usage Notes for MFD_PROFILE

  • The MFD_PROFILE is executed for every TABLE, TABLEF, MATCH, GRAPH, CREATE, DEFINE, CHECK, ?F, and ?FF request against a Master File that contains the MFD_PROFILE attribute.

    In a MATCH request or a request using MORE, all of the MFD_PROFILE procedures specified in any of the Master Files involved in the request will be executed prior to the request. The profiles will execute in the reverse of their order in the request (the profile for the Master File mentioned last in the request executes first).

  • The MFD_PROFILE is not executed as a result of commands, such as MODIFY, MAINTAIN, or -READFILE.
  • If multiple MFD_PROFILEs set values for the same global variables, the resulting variable values will depend on the order in which the profile procedures run.
  • In a join between multiple Master Files that have MFD_PROFILE attributes, the profiles will all be executed.
  • The name of the calling Master File is passed as the first parameter (&1) to the MFD_PROFILE procedure.
  • If the MFD_PROFILE contains sensitive information, it should be encrypted. If it creates a file (such as a DBAFILE) that contains sensitive information, that file should also be encrypted.
  • If the MFD_PROFILE is not on the application path, the following warning message will be issued.
    FOC(36373)  WARNING: MFD_PROFILE DOES NOT EXIST

    If you want the lack of the profile to terminate processing, turn the ERROROUT parameter to ON.

  • The MFD_PROFILE procedure must not issue a request against its calling Master File.
  • A request against a Business View will invoke the MFD_PROFILE from the original Master File.
  • If the MFD_PROFILE creates a DBAFILE, an initial DBAFILE specifying authorized users and any restrictions at the SEGMENT or FIELD level must exist prior to using commands other than TABLE, TABLEF, GRAPH, or MATCH. The initial DBAFILE may be created without VALUE restrictions. When the actual TABLE request runs, or you click Run from a tool, the MFD_PROFILE procedure is executed, and VALUE restrictions are applied.
  • Be careful not to issue any command that affects the environment that was established prior to executing the MFD_PROFILE. For example, if the MFD_PROFILE establishes any joins that you want to clear before exiting the MFD_PROFILE, give those joins unique names and issue a JOIN CLEAR command that clears only those joins. Do not issue the JOIN CLEAR * command as that will clear any joins established prior to executing the MFD_PROFILE.

Example: Creating a Lookup File and Setting a Global Variable Using an MFD_PROFILE

The following version of the EMPDATA Master File:

  • Specifies an MFD_PROFILE named DDBAEMP.
  • Defines a variable to be used as the TITLE attribute for the PIN field.
  • Defines the fields TYPE_EMP and EMP_TYPE to classify employees as full-time or part-time based on the values in the JOBS lookup file.
  • Has DBA restrictions. For user HR3, the VALUE clause does a lookup of values in the JOBS lookup file.

The edited EMPDATA Master File is:

FILENAME=EMPDATA, SUFFIX=FOC, MFD_PROFILE=baseapp/DDBAEMP,$
VARIABLE NAME = Emptitle, USAGE=A30, DEFAULT=EMPID,$
SEGMENT=EMPDATA,SEGTYPE=S0, $
 FIELDNAME=PIN   , ALIAS=ID, USAGE=A9, INDEX=I,   TITLE='&&Emptitle',$
 FIELDNAME=LASTNAME,     ALIAS=LN,       FORMAT=A15,             $
 FIELDNAME=FIRSTNAME,    ALIAS=FN,       FORMAT=A10,             $
 FIELDNAME=MIDINITIAL,   ALIAS=MI,       FORMAT=A1,              $
 FIELDNAME=DIV,          ALIAS=CDIV,     FORMAT=A4,              $
 FIELDNAME=DEPT,         ALIAS=CDEPT,    FORMAT=A20,             $
 FIELDNAME=JOBCLASS,     ALIAS=CJCLAS,   FORMAT=A8,              $
 FIELDNAME=TITLE,        ALIAS=CFUNC,    FORMAT=A20,             $
 FIELDNAME=SALARY,       ALIAS=CSAL,     FORMAT=D12.2M,          $
 FIELDNAME=HIREDATE,     ALIAS=HDAT,     FORMAT=YMD,             $
$
DEFINE AREA/A13=DECODE DIV (NE 'NORTH EASTERN' SE 'SOUTH EASTERN'
CE 'CENTRAL' WE 'WESTERN' CORP 'CORPORATE' ELSE 'INVALID AREA');$
DEFINE TYPE_EMP/I1 = DECODE JOBCLASS(JOBS ELSE 1);,$
DEFINE EMP_TYPE/A10 = IF TYPE_EMP EQ 1
          THEN 'FULL_TIME'  ELSE 'PART_TIME';
END
DBA=USERD,$
USER=USER1,ACCESS=R,RESTRICT=FIELD,NAME=SALARY,$
USER=USER2,ACCESS=R,RESTRICT=VALUE,NAME=SYSTEM,
                VALUE=DEPT EQ SALES OR MARKETING,$
USER=HR1,ACCESS=R,RESTRICT=VALUE,NAME=SYSTEM,
            VALUE=SALARY FROM 20000 TO 35000,$
USER=HR2,ACCESS=R,RESTRICT=VALUE,NAME=EMPDATA,VALUE=SALARY GT 0,$
USER=HR3,ACCESS=R,RESTRICT=VALUE,NAME=SYSTEM,VALUE=JOBCLASS EQ (JOBS),$

The DDBAEMP procedure sets a value for the global variable &&Emptitle and creates the JOBS lookup file.

On UNIX or Windows, issue a FILEDEF command.

FILEDEF JOBS DISK jobs.ftm

On z/OS, issue a DYNAM command.

DYNAM ALLOC DD JOBS DA USER1.JOBS.FTM SHR REU
-RUN
-SET &&Emptitle = 'Employee ID';
TABLE FILE JOBLIST
PRINT JOBCLASS
WHERE JOBDESC  CONTAINS '2ND' OR '3RD'
ON TABLE HOLD AS JOBS
END

The following request against the EMPDATA data source allocates the JOBS file and sets the user password to HR3. The EMP_TYPE field and the DBA VALUE restriction for user HR3 uses the JOBS file created by the MFD_PROFILE as a lookup table.

On UNIX or Windows, issue a FILEDEF command.

FILEDEF JOBS DISK jobs.ftm

On z/OS, issue a DYNAM command.

DYNAM ALLOC DD JOBS DA USER1.JOBS.FTM SHR REU
-SET &PASS = 'HR3';
SET PASS = &PASS
-RUN
TABLE FILE EMPDATA
" Password used is &PASS "
" "
"USER1 -- Can't see Salary, reject request"
"USER2 -- Can see Sales and Marketing departments only"
"HR1   -- Can see  salaries from 20 TO 35 K "
"HR2   -- Can see everyone "
"HR3   -- Can see Part Time only "
" "
PRINT PIN SALARY DEPT EMP_TYPE
ON TABLE HOLD FORMAT HTMLON TABLE SET PAGE NOPAGE
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, FONT=ARIAL,$
END

On the output, the column title for the PIN field is the value of the &&Emptitle variable set in the MFD_PROFILE procedure, and the JOBS file created by the profile is used in limiting the report output to Part Time employees, which are the only ones user HR3 is allowed to see.

Example: Creating a DBAFILE Using an MFD_PROFILE

The following version of the EMPDATA Master File specifies an MFD_PROFILE named DDEMP2 and a DBAFILE named DBAEMP2. The MFD_PROFILE will create the DBAFILE by reading security attributes from a sequential file named security.data.

The Master File is:

FILENAME=EMPDATA, SUFFIX=FOC, MFD_PROFILE=DDEMP2,$
SEGMENT=EMPDATA,SEGTYPE=S0, $
 FIELDNAME=PIN   , ALIAS=ID, USAGE=A9, INDEX=I,   TITLE='Employee Id',$
 FIELDNAME=LASTNAME,     ALIAS=LN,       FORMAT=A15,             $
 FIELDNAME=FIRSTNAME,    ALIAS=FN,       FORMAT=A10,             $
 FIELDNAME=MIDINITIAL,   ALIAS=MI,       FORMAT=A1,              $
 FIELDNAME=DIV,          ALIAS=CDIV,     FORMAT=A4,              $
 FIELDNAME=DEPT,         ALIAS=CDEPT,    FORMAT=A20,             $
 FIELDNAME=JOBCLASS,     ALIAS=CJCLAS,   FORMAT=A8,              $
 FIELDNAME=TITLE,        ALIAS=CFUNC,    FORMAT=A20,             $
 FIELDNAME=SALARY,       ALIAS=CSAL,     FORMAT=D12.2M,          $
 FIELDNAME=HIREDATE,     ALIAS=HDAT,     FORMAT=YMD,             $
$
DEFINE AREA/A13=DECODE DIV (NE 'NORTH EASTERN' SE 'SOUTH EASTERN'
CE 'CENTRAL' WE 'WESTERN' CORP 'CORPORATE' ELSE 'INVALID AREA');$
END
DBA=USERD,DBAFILE=DBAEMP2,$

The file with the security attributes (security.data) follows. The security attributes are the USER, ACCESS, RESTRICT, NAME, and VALUE attributes.

USER1       R   NOPRINT     SALARY
USER2       R   VALUE       SYSTEM  DEPT EQ SALES OR MARKETING
HR1         R   VALUE       SYSTEM  SALARY FROM 20000 TO 35000
HR1         W   SEGMENT     EMPDATA
HR2         R   VALUE       EMPDATA SALARY GT 0

According to these attributes, a user with the password:

  • USER1, cannot print the values in the SALARY field.
  • USER2, can only see the SALES and MARKETING departments.
  • HR1, can only see salaries from 20000 to 35000. HR1 can also write to the EMPDATA segment.
  • HR2, can see everything in the EMPDATA segment.

The DDEMP2 profile procedure:

  • Uses the Dialogue Manager command -WRITE to write records into the DBAEMP2 Master File. It first writes the FILE declaration, a SEGMENT declaration, a FIELD declaration, the END declaration that starts the DBA section of the Master File, and the DBA password (which must be the same as the DBA password in the EMPDATA Master File).

    The rest of the DBA section will be created by reading each record from the security.data file and writing a corresponding DBA record to the DBAEMP2 Master File.

  • Uses the Master File name passed as argument &1 to write a FILE declaration for the EMPDATA Master File, which will then be followed by the DBA declarations specific to that Master File.
  • Loops to read each record in the security.data file using the Dialogue Manager command -READFILE. It checks if there is a RESTRICT attribute and if so, checks if it has a VALUE attribute. Depending on which attributes are present, it writes a record to the DBAEMP2 Master File.

The DDEMP2 profile procedure follows.

First, on UNIX or Windows, issue a FILEDEF command.

-* FILEDEF the input security.data file
FILEDEF SECURITY DISK c:\ibi\apps\baseapp\security.data (LRECL 81

First, on z/OS, issue a DYNAM command.

-* DYNAM the output DBAEMP2 Master File and the input file
DYNAM OUTFI DA USER1.DBAEMP2.MASTER SHR REU
DYNAM SECURITY DA USER1.SECURITY.DATA SHR REU

The remainder of the MFD_PROFILE follows.

-RUN
-* Write out the first part of the DBAEMP2 Master File
-WRITE OUTFI FILE=DBAEMP2,SUFFIX=FIX,$
-WRITE OUTFI SEGNAME=ONE,SEGTYPE=S0
-WRITE OUTFI   FIELD=ONE,,A1,A1,$
-WRITE OUTFI END
-WRITE OUTFI DBA=USERD,$
-* Write out a FILE declaration for the calling Master File, passed as &1
-WRITE OUTFI FILE=&1,$
-* Initialize the variables to be read from the security.data file
-SET &USER=' ';
-SET &ACCESS=' ';
-SET &RESTRICT=' ';
-SET &NAME = ' ';
-SET &VALUE = ' ';
-* Establish the loop for each record of the security.data file
-SET &DONE =  N ;
-REPEAT ENDLP WHILE &DONE EQ N ;
-* Read a record from security.data
-READFILE SECURITY
-* Check if the end of the security.data file was reached and,
-*   if so, branch out of the loop
-SET &DONE =  IF &IORETURN EQ 1 THEN 'Y' ELSE 'N';
-IF &DONE EQ 'Y' GOTO ENDLP1;
-* If there is a RESTRICT attribute, go to the label -CHKSTR. 
-IF &RESTRICT NE ' ' THEN GOTO CHKRSTR;
-* If there is no RESTRICT attribute, 
-*  write the USER and ACCESS attributes, and loop for the next record
-WRITE OUTFI USER=&USER , ACCESS=&ACCESS ,$
-GOTO ENDLP
-CHKRSTR
-* If there is a RESTRICT attribute, check if it has a VALUE attribute
-* and, if so, go to the label -CHKVAL
-IF &VALUE NE ' ' THEN GOTO CHKVAL;
-* If there is no VALUE attribute, 
-*  write USER, ACCESS, RESTRICT, and NAME, and loop for next record
-WRITE OUTFI USER=&USER, ACCESS=&ACCESS, RESTRICT=&RESTRICT, NAME=&NAME,$
-GOTO ENDLP
-CHKVAL
-* If there is a VALUE attribute, write out USER, ACCESS, RESTRICT, 
-*  NAME, and VALUE, and loop for next record
-WRITE OUTFI  USER=&USER, ACCESS=&ACCESS,RESTRICT=&RESTRICT,NAME=&NAME, VALUE = &VALUE ,$
-ENDLP
-ENDLP1

When run, this procedure creates the following DBAFILE:

FILE=DBAEMP2,SUFFIX=FIX,$
SEGNAME=ONE,SEGTYPE=S0
  FIELD=ONE,,A1,A1,$
END
DBA=USERD,$
FILE=EMPDATA,$
USER=USER1,ACCESS=R,RESTRICT=NOPRINT,NAME=SALARY   ,$
USER=USER2, ACCESS=R, RESTRICT=VALUE, NAME=SYSTEM,
  VALUE=DEPT EQ SALES OR MARKETING ,$
USER=HR1,   ACCESS=R, RESTRICT=VALUE, NAME=SYSTEM,
  VALUE = SALARY FROM 20000 TO 35000,$
USER=HR1,   ACCESS=W, RESTRICT=SEGMENT, NAME=EMPDATA  ,$
USER=HR2,   ACCESS=R, RESTRICT=VALUE, NAME=EMPDATA, 
  VALUE = SALARY GT 0 ,$

The following request prints the PIN, SALARY, TITLE, and DEPT fields from EMPDATA.

TABLE FILE EMPDATA
PRINT SALARY TITLE DEPT
BY PIN
WHERE PIN GE '000000010'  AND PIN LE  '000000200'
ON TABLE SET PAGE NOPAGE
ON TABLE HOLD FORMAT PDF
END

To run the request, you must first set a valid user password. The MFD_PROFILE procedure will be run first and will create the dbaemp2.mas DBAFILE.

Running the request by first issuing the SET PASS=USER1 command produces the following report in which the salaries display as zeros because of the RESTRICT=NOPRINT attribute for the SALARY field.

Running the request by first issuing the SET PASS=USER2 command produces the following report in which only the SALES and MARKETING departments display because of the VALUE restriction for the DEPT field.

Running the request by first issuing the SET PASS=HR1 command produces the following report in which only the salaries between 20000 and 35000 display because of the VALUE restriction for the DEPT field.

Using Global Amper Variables to Create Dynamic DBA Rules

How to:

The DBA attributes USER and VALUE can be parameterized using global Dialogue Manager variables. Using this technique, you can create dynamic DBA rules for the connected user without creating a DBAFILE that contains rules for all users. You can obtain the user ID of the connected user and, optionally, a value restriction for that user and insert them directly into the DBA section of the Master File. One convenient way to do this is to use a Master File profile. For information about Master File profiles, see Creating and Using a Master File Profile in the Describing Data Manual.

Note: All Master Files that contain DBA rules should be encrypted.

Syntax: How to Use Global Variables in the DBA Section of a Master File

First assign the variables names after the FILE declaration in the Master File:

VARIABLE NAME=[&&]var, USAGE=Aln, [DEFAULT=defvalue,]
 [QUOTED={OFF|ON},] $

where:

var

Is the name you are assigning to the global variable. When you reference the variable in the Master File or Access File, you must prepend the name with two ampersands (&&). However, the ampersands are optional when defining the variable.

ln

Is the maximum length for the variable value.

defvalue

Is the default value for the variable. If no value is set at run time, this value is used.

QUOTED={OFF|ON}

ON adds single quotation marks around the assigned string for the variable. A single quotation mark within the string is converted to two single quotation marks. OFF is the default value.

Next, reference the global variables in the DBA section of the Master File:

USER={user|&&uid},ACCESS=a[,RESTRICT=VALUE,NAME=name,VALUE={value|&&val}] ,$

Example: Creating a Dynamic DBA Rule in a Master File

The sequential data source named VALTEST.DATA contains a list of user names and their associated value restrictions.

SALLY               CURR_SAL LT 20000
JOHN                DEPARTMENT EQ PRODUCTION
TOM                 CURR_SAL GE 20000

Before reading this file, you must FILEDEF or allocate it.

FILEDEF VALTEST DISK baseapp/valtest.data

Or, on z/OS:

DYNAM ALLOC DD VALTEST DA USER1.VALTEST.DATA SHR REU

The following Master File named EMPDBA is a view of the EMPLOYEE data source. It has a DBA section that uses the global variable &&UID for the USER attribute and the global variable &&VAL for the value test against the EMPINFO segment. It also identifies a Master File profile named DBAEMP3. This profile will obtain the user ID of the connected user and find the correct VALUE restriction by reading the VALTEST.DATA file. By setting the global variables to the correct values, it will insert the appropriate DBA rule into the Master File.

FILENAME=EMPLOYEE, SUFFIX=FOC, MFD_PROFILE=DBAEMP3,$
VARIABLE NAME=&&UID, USAGE=A8 , $
VARIABLE NAME=&&VAL, USAGE=A25, $
SEGNAME=EMPINFO,  SEGTYPE=S1
 FIELDNAME=EMP_ID,       ALIAS=EID,     FORMAT=A9,       $
 FIELDNAME=LAST_NAME,    ALIAS=LN,      FORMAT=A15,      $
 FIELDNAME=FIRST_NAME,   ALIAS=FN,      FORMAT=A10,      $
 FIELDNAME=HIRE_DATE,    ALIAS=HDT,     FORMAT=I6YMD,    $
 FIELDNAME=DEPARTMENT,   ALIAS=DPT,     FORMAT=A10,      $
 FIELDNAME=CURR_SAL,     ALIAS=CSAL,    FORMAT=D12.2M,   $
 FIELDNAME=CURR_JOBCODE, ALIAS=CJC,     FORMAT=A3,       $
 FIELDNAME=ED_HRS,       ALIAS=OJT,     FORMAT=F6.2,     $
END
DBA=DBAUSER1,$
USER=&&UID,ACCESS=R,RESTRICT=VALUE,NAME=EMPINFO,VALUE=&&VAL ,$

The following is the MFD_PROFILE procedure.

SET MESSAGE = OFF
-SET &VALUETEST = 'NOTFOUND';
-* Find the user ID of the connected user
-SET &&UID = GETUSER('A20');
-SET &&UID = TRUNCATE(&&UID);
-* Create a HOLD file with the value test for the connected user
TABLE FILE VALTEST
PRINT VALUETEST
WHERE USERNAME EQ '&&UID'
ON TABLE HOLD AS USERVAL FORMAT ALPHA
END
-RUN
-READ USERVAL &VALUETEST.A30
-* If the user name was not in the file, type a message and exit
-IF &VALUETEST NE 'NOTFOUND' GOTO SETVALUE;
-TYPE USER WASN'T THERE
-EXIT
-SETVALUE
-* Set the global variable for the value test to the correct test
-SET &&VAL = ''|&VALUETEST||'';
-* Set the USER parameter to the user ID of the connected user
SET USER = &&UID

The following request displays a report against the EMPDBA view of the EMPLOYEE data source.

USE
EMPLOYEE AS EMPDBA
END
-RUN
TABLE FILE EMPDBA
PRINT LN FN CURR_SAL
BY DEPARTMENT
ON TABLE SET PAGE NOPAGE
END

Running the request when SALLY is the connected user produces a report of employees whose salaries are less than $20,000.

DEPARTMENT  LAST_NAME        FIRST_NAME         CURR_SAL
----------  ---------        ----------         --------
MIS         SMITH            MARY             $13,200.00
            JONES            DIANE            $18,480.00
            MCCOY            JOHN             $18,480.00
            GREENSPAN        MARY              $9,000.00
PRODUCTION  STEVENS          ALFRED           $11,000.00
            SMITH            RICHARD           $9,500.00
            MCKNIGHT         ROGER            $16,100.00

Running the request when TOM is the connected user produces a report of employees whose salaries are greater than or equal to $20,000.

DEPARTMENT  LAST_NAME        FIRST_NAME         CURR_SAL
----------  ---------        ----------         --------
MIS         BLACKWOOD        ROSEMARIE        $21,780.00
            CROSS            BARBARA          $27,062.00
PRODUCTION  BANNING          JOHN             $29,700.00
            IRVING           JOAN             $26,862.00
            ROMANS           ANTHONY          $21,120.00

Running the request when JOHN is the connected user produces a report that includes only the PRODUCTION department.

DEPARTMENT  LAST_NAME        FIRST_NAME         CURR_SAL
----------  ---------        ----------         --------
PRODUCTION  STEVENS          ALFRED           $11,000.00
            SMITH            RICHARD           $9,500.00
            BANNING          JOHN             $29,700.00
            IRVING           JOAN             $26,862.00
            ROMANS           ANTHONY          $21,120.00
            MCKNIGHT         ROGER            $16,100.00

Preserving Blank Space in Delimited Sequential Files

How to:

Reference:

By default, when a delimited file is created using HOLD FORMAT DFIX, trailing blank spaces are removed from alphanumeric data unless they are included within specified enclosure characters. The PRESERVESPACE YES option in the HOLD FORMAT DFIX command preserves leading and trailing blank spaces in the data, even when there is no enclosure character sequence. Using this option in the HOLD command adds the attribute PRESERVESPACE=YES in the FORMAT DFIX Access File. In addition, having PRESERVESPACE=YES in the Access File causes leading and trailing blank spaces to be preserved when reading a FORMAT DFIX file.

Syntax: How to Preserve Leading and Trailing Blank Spaces in a HOLD FORMAT DFIX File

[ON TABLE] {HOLD|PCHOLD} [AS filename] FORMAT DFIX
  DELIMITER delimiter [ENCLOSURE enclosure]
   [HEADER {YES|NO}] [PRESERVESPACE {YES|NO}]

where:

filename

Is the name of the file to be created. If you do not specify a name, the default name is HOLD.

delimiter

Is the delimiter sequence consisting of up to 30 printable or non-printable non-null characters. (This represents character semantics. For example, if you are using DBCS characters, the delimiter can be up to 60 bytes.) For a non-printable character, enter the hexadecimal value that represents the character. If you use a mixture of printable and non-printable characters, you must enter them all as hexadecimal values. For printable characters, you can either use the characters themselves or their hexadecimal equivalents (for example, the ampersand character may be interpreted as the beginning of a variable name rather than as part of the delimiter.) To create a tab-delimited file, you can specify the delimiter value as TAB or as its hexadecimal equivalent (0x09 on ASCII platforms or 0x05 on EBCDIC platforms).

enclosure

Is the enclosure sequence. It can be up to four printable or non-printable characters used to enclose each alphanumeric value in the file. (This represents character semantics. For example, if you are using DBCS characters, the delimiter can be up to 8 bytes.) Most alphanumeric characters can be used as all or part of the enclosure sequence. However, numeric digits and symbols used in numbers, such as a period (.), plus sign (+), or minus sign (-), cannot be used in the enclosure sequence. Also note that in order to specify a single quotation mark as the enclosure character, you must enter four consecutive single quotation marks. The most common enclosure is one double quotation mark.

If you use a mixture of printable and non-printable characters, you must enter them all as hexadecimal values. For printable characters, you can either use the characters themselves or their hexadecimal equivalents (for example, the ampersand character may be interpreted as the beginning of a variable name rather than as part of the enclosure).

HEADER {YES|NO}

Specifies whether to include a header record that contains the names of the fields in the delimited sequential file generated by the request.

PRESERVESPACE {YES|NO}

Specifies whether to retain leading and trailing blanks in alphanumeric data. YES preserves leading and trailing blanks. NO only preserves leading and trailing blanks that are included within the enclosure characters. NO is the default value.

Note: PRESERVESPACE is overridden by the ENCLOSURE option. Therefore, exclude the enclosure option in order to have the PRESERVESPACE setting respected.

Reference: Access File Attributes for a FORMAT DFIX File

DELIMITER=delimiter, [ENCLOSURE=enclosure,] 
  HEADER={YES|NO}, PRESERVESPACE={YES|NO}, $

where:

delimiter

Is the delimiter sequence consisting of up to 30 printable or non-printable non-null characters. (This represents character semantics. For example, if you are using DBCS characters, the delimiter can be up to 60 bytes.) For a non-printable character, enter the hexadecimal value that represents the character. If you use a mixture of printable and non-printable characters, you must enter them all as hexadecimal values. For printable characters, you can either use the characters themselves or their hexadecimal equivalents. For example, the ampersand character (&) may be interpreted as the beginning of a variable name rather than as part of the delimiter. To create a tab-delimited file, you can specify the delimiter value as TAB or as its hexadecimal equivalent (0x09 on ASCII platforms or 0x05 on EBCDIC platforms).

enclosure

Is the enclosure sequence. It can be up to four printable or non-printable characters used to enclose each alphanumeric value in the file. (This represents character semantics. For example, if you are using DBCS characters, the delimiter can be up to 8 bytes.) Most alphanumeric characters can be used as all or part of the enclosure sequence. However, numeric digits and symbols used in numbers, such as a period (.), plus sign (+), or minus sign (-), cannot be used in the enclosure sequence. Also note that, in order to specify a single quotation mark as the enclosure character, you must enter four consecutive single quotation marks. The most common enclosure is one double quotation mark (").

If you use a mixture of printable and non-printable characters, you must enter them all as hexadecimal values. For printable characters, you can either use the characters themselves or their hexadecimal equivalents (for example, the ampersand character (&) may be interpreted as the beginning of a variable name rather than as part of the enclosure).

HEADER = {YES|NO}

Specifies whether to include a header record that contains the names of the fields in the delimited sequential file generated by the request. NO is the default value.

PRESERVESPACE={YES|NO}

Specifies whether to retain leading and trailing blanks in alphanumeric data. YES preserves leading and trailing blanks. NO only preserves leading and trailing blanks that are included within the enclosure characters. NO is the default value.

Note: PRESERVESPACE is overridden by the ENCLOSURE option. Therefore, exclude the enclosure option in order to have the PRESERVESPACE setting respected.

Example: Creating a Delimited File With Blank Spaces Preserved

The following request against the GGSALES data source creates a comma-delimited file. The original alphanumeric data has trailing blank spaces. The PRESERVESPACE YES option in the HOLD command preserves these trailing blank spaces.

APP HOLDDATA APP1
APP HOLDMETA APP1
TABLE FILE GGSALES
SUM DOLLARS UNITS
BY REGION
BY CATEGORY
BY PRODUCT
ON TABLE HOLD AS DFIX1 FORMAT DFIX DELIMITER , PRESERVESPACE YES
END

The following Master File is generated:

FILENAME=DFIX1   , SUFFIX=DFIX    , $
  SEGMENT=DFIX1, SEGTYPE=S3, $
    FIELDNAME=REGION, ALIAS=E01, USAGE=A11, ACTUAL=A11, $
    FIELDNAME=CATEGORY, ALIAS=E02, USAGE=A11, ACTUAL=A11, $
    FIELDNAME=PRODUCT, ALIAS=E03, USAGE=A16, ACTUAL=A16, $
    FIELDNAME=DOLLARS, ALIAS=E04, USAGE=I08, ACTUAL=A08, $
    FIELDNAME=UNITS, ALIAS=E05, USAGE=I08, ACTUAL=A08, $

The following Access File is generated:

SEGNAME=DFIX1, DELIMITER=',', HEADER=NO, PRESERVESPACE=YES, $

In the DFIX1 file, the alphanumeric fields contain all of the blank spaces that existed in the original file.

Midwest    ,Coffee     ,Espresso        ,1294947,101154
Midwest    ,Coffee     ,Latte           ,2883566,231623
Midwest    ,Food       ,Biscotti        ,1091727,86105
Midwest    ,Food       ,Croissant       ,1751124,139182
Midwest    ,Food       ,Scone           ,1495420,116127
Midwest    ,Gifts      ,Coffee Grinder  ,619154,50393
Midwest    ,Gifts      ,Coffee Pot      ,599878,47156
Midwest    ,Gifts      ,Mug             ,1086943,86718
Midwest    ,Gifts      ,Thermos         ,577906,46587
Northeast  ,Coffee     ,Capuccino       ,542095,44785
Northeast  ,Coffee     ,Espresso        ,850107,68127
Northeast  ,Coffee     ,Latte           ,2771815,222866
Northeast  ,Food       ,Biscotti        ,1802005,145242
Northeast  ,Food       ,Croissant       ,1670818,137394
Northeast  ,Food       ,Scone           ,907171,70732
Northeast  ,Gifts      ,Coffee Grinder  ,509200,40977
Northeast  ,Gifts      ,Coffee Pot      ,590780,46185
Northeast  ,Gifts      ,Mug             ,1144211,91497
Northeast  ,Gifts      ,Thermos         ,604098,48870
Southeast  ,Coffee     ,Capuccino       ,944000,73264
Southeast  ,Coffee     ,Espresso        ,853572,68030
Southeast  ,Coffee     ,Latte           ,2617836,209654
Southeast  ,Food       ,Biscotti        ,1505717,119594
Southeast  ,Food       ,Croissant       ,1902359,156456
Southeast  ,Food       ,Scone           ,900655,73779
Southeast  ,Gifts      ,Coffee Grinder  ,605777,47083
Southeast  ,Gifts      ,Coffee Pot      ,645303,49922
Southeast  ,Gifts      ,Mug             ,1102703,88474
Southeast  ,Gifts      ,Thermos         ,632457,48976
West       ,Coffee     ,Capuccino       ,895495,71168
West       ,Coffee     ,Espresso        ,907617,71675
West       ,Coffee     ,Latte           ,2670405,213920
West       ,Food       ,Biscotti        ,863868,70436
West       ,Food       ,Croissant       ,2425601,197022
West       ,Food       ,Scone           ,912868,72776
West       ,Gifts      ,Coffee Grinder  ,603436,48081
West       ,Gifts      ,Coffee Pot      ,613624,47432
West       ,Gifts      ,Mug             ,1188664,93881
West       ,Gifts      ,Thermos         ,571368,45648

Creating the same file with PRESERVESPACE NO removes the trailing blank spaces.

Midwest,Coffee,Espresso,1294947,101154
Midwest,Coffee,Latte,2883566,231623
Midwest,Food,Biscotti,1091727,86105
Midwest,Food,Croissant,1751124,139182
Midwest,Food,Scone,1495420,116127
Midwest,Gifts,Coffee Grinder,619154,50393
Midwest,Gifts,Coffee Pot,599878,47156
Midwest,Gifts,Mug,1086943,86718
Midwest,Gifts,Thermos,577906,46587
Northeast,Coffee,Capuccino,542095,44785
Northeast,Coffee,Espresso,850107,68127
Northeast,Coffee,Latte,2771815,222866
Northeast,Food,Biscotti,1802005,145242
Northeast,Food,Croissant,1670818,137394
Northeast,Food,Scone,907171,70732
Northeast,Gifts,Coffee Grinder,509200,40977
Northeast,Gifts,Coffee Pot,590780,46185
Northeast,Gifts,Mug,1144211,91497
Northeast,Gifts,Thermos,604098,48870
Southeast,Coffee,Capuccino,944000,73264
Southeast,Coffee,Espresso,853572,68030
Southeast,Coffee,Latte,2617836,209654
Southeast,Food,Biscotti,1505717,119594
Southeast,Food,Croissant,1902359,156456
Southeast,Food,Scone,900655,73779
Southeast,Gifts,Coffee Grinder,605777,47083
Southeast,Gifts,Coffee Pot,645303,49922
Southeast,Gifts,Mug,1102703,88474
Southeast,Gifts,Thermos,632457,48976
West,Coffee,Capuccino,895495,71168
West,Coffee,Espresso,907617,71675
West,Coffee,Latte,2670405,213920
West,Food,Biscotti,863868,70436
West,Food,Croissant,2425601,197022
West,Food,Scone,912868,72776
West,Gifts,Coffee Grinder,603436,48081
West,Gifts,Coffee Pot,613624,47432
West,Gifts,Mug,1188664,93881
West,Gifts,Thermos,571368,45648

Zero Removal in Date-Time Formats

The components in date-time formats can be displayed using a number of options. For example, when a day number is less than 10, you can display it with zero suppression. Zero suppression replaces the zero with a blank space, leaving the remaining digit in the same position it occupied when the zero was displayed.

There are now zero removal options for month and day numbers. Zero removal eliminates the zero and moves the remaining portion of the field one position to the left.

The option for zero removal of a month number is the lowercase letter o. The option for zero removal of the day number is the lowercase letter e. Use of these options also requires a date separator. The N option to remove the separator is not supported with zero removal.

Using the o option for the month forces the day component to use the e option, even if d or D is specified for the day component in the format.

Example: Using Zero Removal for Date-Time Month and Day Numbers

The following request creates the date-time value 01/01/2013. It then displays this value using:

  • Normal month and day numbers, format HMDYY.
  • Month removal and day removal, format HoeYY.
  • Month removal without day removal (which forces day removal), format HodYY.
  • Day removal without month removal, format HMeYY. Note that month removal is not forced by day removal.
DEFINE FILE GGSALES           
DATE1A/HMDYY = DT(01/01/2013);
DATE1B/HoeYY = DATE1A;        
DATE1C/HodYY = DATE1A;        
DATE1D/HMeYY = DATE1A;        
END                           
TABLE FILE GGSALES            
SUM DOLLARS NOPRINT           
DATE1A AS 'HMDYY'             
DATE1B AS 'HoeYY'             
DATE1C AS 'HodYY'             
DATE1D AS 'HMeYY'             
ON TABLE SET PAGE NOPAGE      
END                           

The output is:

HMDYY       HoeYY       HodYY       HMeYY    
-----       -----       -----       -----    
01/01/2013  1/1/2013    1/1/2013    01/1/2013

Example: Comparing Zero Suppression With Zero Removal

The following request creates two dates with date-time formats in which the date component has a leading zero (01). In the first date, the day component is the first component and displays on the left. In the second date, the day component is the second component and displays in the middle. The request prints these dates:

  • With all zeros displayed, format HDMYY.
  • With zero suppression for the day component, format HdMYY.
  • With zero removal for the day component, format HeMYY.
DEFINE FILE GGSALES           
DATE1A/HDMYY = DT(01/12/2012);
DATE2A/HMDYY = DT(12/01/2012);
DATE1B/HdMYY = DATE1A;        
DATE2B/HMdYY = DATE2A;        
DATE1C/HeMYY = DATE1A;        
DATE2C/HMeYY = DATE2A;        
END                           
TABLE FILE GGSALES            
SUM DOLLARS NOPRINT           
DATE1A AS 'HDMYY'             
DATE2A AS ''      OVER        
DATE1B AS 'HdMYY'             
DATE2B AS ''      OVER        
DATE1C AS 'HeMYY'             
DATE2C AS ''                  
ON TABLE SET PAGE NOPAGE      

On the output, the first row shows the date with all zeros displayed. The second row shows zero suppression of the day number, where the zero has been replaced by a blank space so that all the components are aligned with the components on row 1. The last row shows zero removal, where the zero has been removed from the day number, and all of the remaining characters have been shifted over to the left:

HDMYY  01/12/2012    12/01/2012
HdMYY   1/12/2012    12/ 1/2012
HeMYY  1/12/2012     12/1/2012 

EDAPUT: Writing a Sequential File of a Specified Type

How to:

Using the EDAPUT command, you can write any number of lines and save them as common FOCUS file types, either in memory or on disk.

The -WRITE command only writes one line at a time, so this is a way to avoid issuing repeated commands for writing a single file.

Syntax: How to Write a Sequential File of a Specified Type

EX -LINES n EDAPUT filetype,[app/]filename,type,location

where:

n

Is the number of lines that will be written, including the EDAPUT line.

filetype

Is the type of file. You specify the file type and, on Windows and UNIX, the file is saved with the associated extension. On z/OS, this is a DDNAME and the file is stored in the PDS associated with the DDNAME. The following table lists some of the most common FOCUS file types. Other FOCUS-readable files use the standard extensions, and the file types match the extensions:

File Type

Extension

MASTER

.mas

ACCESS

.acx

FOCEXEC

.fex

FOCSQL

.acx

FOCSTYLE

.sty

DATA

.dat

FOCCOMP

.fcm

FOCTEMP

.ftm

FOCUS

.foc

HOLDMAST

.mas

HOLDACC

.acx

HTML

.htm

EXCEL

.xls

MAINTAIN

.mnt

FOCPSB

.psb

WINFORMS

.wfm

TTEDIT

.tte

app

Is an optional application name under which to store the file. On z/OS, you can specify an app if you have enabled application logic in the EDASERVE configuration file and created the data sets associated with the application.

filename

Is the file name.

type

Is the creation type. Valid values are:

  • CV, create variable.
  • C, create fixed
  • A, append to file.
location

Is the location for the created file. Valid values are:

  • FILE, write to current location (this will overwrite an existing file of the same name and extension in the same location).
  • MEM, write to memory only (this will not overwrite an existing file on disk). Files written to memory are first in the path.

Example: Writing a Master File to Disk

The following EDAPUT command writes a Master File named tempmast.mas to the app1 application directory in variable format. On z/OS, it writes member TEMPMAST to the APP1.MASTER.DATA data set under the high-level qualifier assigned as approot in the EDASERVE configuration file:

EX -LINES 5 EDAPUT MASTER,app1/tempmast,CV,FILE,
FILENAME=TEMPMAST, SUFFIX=FIX,$
SEGNAME=ONE, SEGTYPE=S1 ,$
  FIELD=FIELD1  ,ALIAS=  ,A10 ,A10 ,$ 
  FIELD=FIELD2  ,ALIAS=  ,P18 ,A18 ,$

EDAGET: Reading a Sequential File of a Specified Type

How to:

Using the EDAGET command, you can retrieve and display an entire file.

The -READ command only reads one line at a time, so this is a way to avoid issuing repeated commands for reading a single file.

Syntax: How to Read a Sequential File of a Specified Type

EX EDAGET filetype,[app/]filename,content-type

where:

filetype

Is the type of file. On z/OS, this is a DDNAME. The following table lists some of the most common FOCUS file types. Other FOCUS-readable files use the standard extensions, and the file types match the extensions:

File Type

Extension

MASTER

.mas

ACCESS

.acx

FOCEXEC

.fex

FOCSQL

.acx

FOCSTYLE

.sty

DATA

.dat

FOCCOMP

.fcm

FOCTEMP

.ftm

FOCUS

.foc

HOLDMAST

.mas

HOLDACC

.acx

HTML

.htm

EXCEL

.xls

MAINTAIN

.mnt

FOCPSB

.psb

WINFORMS

.wfm

TTEDIT

.tte

app

Is an optional application name where the file resides. On z/OS, you can specify an app if you have enabled application logic in the EDASERVE configuration file and created the data sets associated with the application.

filename

Is the file name.

content-type

Is the type of data in the file. Valid values are:

  • T, which means a text file.
  • B, which means a binary file.

Note: EDAGET cannot retrieve a file that was written to memory by EDAPUT.

Example: Reading a File Using EDAGET

The following EDAGET command reads a Master File named tempmas.mas in the app1 application. The content type is text:

EX EDAget MASTER,app1/tempmast,T

Using the tempmas.mas file created in EDAPUT: Writing a Sequential File of a Specified Type, the output is:

FILENAME=TEMPMAST, SUFFIX=FIX,$ SEGNAME=ONE, SEGTYPE=S1 ,$ FIELD=FIELD1 ,ALIAS= ,A10 ,A10 ,$ FIELD=FIELD2 ,ALIAS= ,P18 ,A18 ,$

DESCRIPTION Attribute Available in DEFINE FUNCTION Definition

The DESCRIPTION attribute is now supported in a DEFINE FUNCTION definition. This enables you to document the purpose of the function.

Calling a DEFINE FUNCTION in a Master File

How to:

You can reference a DEFINE FUNCTION in an expression in a Master File DEFINE, COMPUTE, or FILTER field. The DEFINE FUNCTION will be loaded into memory when its associated expression is used in a request.

Note: A DEFINE FUNCTION cannot be used in a multi-root Master File.

Syntax: How to Call a DEFINE FUNCTION in a Master File Expression

DF.[appname/]filename.functionname(parm1, parm2, ...);
  [DESCRIPTION='description'],$

where:

appname

Is an optional application name under which the DEFINE FUNCTION FOCEXEC is stored.

filename

Is the name of the FOCEXEC that contains the DEFINE FUNCTION definition. The FOCEXEC can contain multiple DEFINE FUNCTION definitions.

functionname(parm1, parm2, ...)

Is the function name with the parameters to be used in the expression.

'description'

Is an optional description enclosed in single quotation marks.

Example: Using a DEFINE FUNCTION in a Master File

The following DEFINE FUNCTION is stored in the DMFUNCS FOCEXEC. Given a last name and first name, it generates a full name in the format Lastname, Firstname:

DEFINE FUNCTION DMPROPER
DESCRIPTION 'Convert name to proper case and last, first format‘
(LASTNAME/A17, FIRSTNAME/A14) 
DMPROPER/A34V=LCWORD(17, LASTNAME, 'A17') 
             || (', ' | LCWORD(14, FIRSTNAME, 'A14')); 
END

The following is the DEFINE field named WHOLENAME added to the CUSTOMER Master File that calls the DEFINE FUNCTION:

DEFINE WHOLENAME/A40 = DF.DMFUNCS.DMPROPER(LASTNAME, FIRSTNAME); 
     DESCRIPTION = 'Calls DMPROPER to create full name',$

The following request uses the DEFINE field WHOLENAME:

TABLE FILE CUSTOMER
PRINT WHOLENAME AS Whole,Name
BY ID_CUSTOMER
WHERE ID_CUSTOMER LT 600
ON TABLE SET PAGE NOPAGE
END

The output is:

             Whole                       
ID Customer  Name                                   
-----------  -----                                  
         15  Nolan, Tyler                            
         20  Bull, Joshua                            
         78  Wood, Zara                              
        124  Mckenzie, Callum                        
        125  Charlton, Bradley                       
        132  Griffiths, Henry                        
        152  Rowe, Anthony                           
        161  Storey, Max                             
        185  Thomas, Evie                            
        201  Birch, Brandon                          
        213  Parry, Maisie                           
        239  Barrett, Taylor                         
        258  Lord, Harvey                            
        270  Bell, Jay                               
        312  Dunn, Daisy                             
        352  Mckenzie, Callum                        
        379  Fisher, Leo                             
        454  Day, Zak                                
        472  Howarth, Molly                          
        503  Barrett, Daniel                         
        531  Hargreaves, Chloe                       
        566  Fitzgerald, Bethany

Information Builders