E World Writer and Business Unit Security

This appendix contains these topics:

E.1 Background Information

World Writer uses SQL (Structured Query Language) to generate a statement that is used to select fields, omit records and sort the resulting records into report format. The SQL statement can be seen by using Option 7 next to the World Writer version.

World Writer incorporates business unit security ranges into the SQL statement with the following syntax:

Where GLMCU Between ' 1' and ' 200000'.

In this example, the World Writer is written over the F0911 and the user is set up with a range of 1 - 200000 in Business Unit security.

Before you can understand how World Writer reads Business Unit security, you must first understand how characters are read hierarchically on the iSeries (AS/400).

Figure E-1 World Writer Character Hierarchy

Description of Figure E-1 follows
Description of "Figure E-1 World Writer Character Hierarchy"

E.2 How It Works

To determine if data qualifies within a range of Business Units, World Writer starts with the beginning or top range. It is read from left to right, character by character. To qualify for the beginning range, the character must meet either an equal to or greater than test. The compare stops when the first greater than test is found.

The ending or bottom range is also read from left to right, character by character. To qualify for the ending range, the character must meet either an equal to or less than test. The compare stops when the first less than test is found.

Review the following examples as this structure is applied to an example in World Writer:

E.2.1 Example 1

Business Unit range is AA400 through ZZ499. How does A1400 fit into this range?

Beginning comparison:

Is A greater than or equal to A? Equal - continue.

Is 1 greater than or equal to A? 1 is greater than A. 1 qualifies for the beginning range. The first compare stops and the compare for the ending range starts.

Ending comparison:

Is A less than or equal to Z? A is less than Z. A qualifies for the ending range. The compare stops.

A1400 fits within the AA400-ZZ499 range.

E.2.2 Example 2

Selected users are set up with a Business Unit Security range of From: SALARY Thru: SALARY. Users who should not have access to SALARY are set up with a range of From: 1 Thru: 999999. On a World Writer report, these users are seeing records where the Business Unit field is equal to SALARY. How does SALARY fall into the range of 1 thru 999999?

The Business Unit field is an alphanumeric field that is right justified. If one of the fields contains fewer characters than the other, the field with the lesser number of characters is "padded" with leading blanks until the From and Thru fields are the same length. (When an alphanumeric field is left justified, the blanks are placed at the end of the field until the fields are the same length.).

Figure E-3 Example 2 (with Padding for Right Justification)

Description of Figure E-3 follows
Description of "Figure E-3 Example 2 (with Padding for Right Justification)"

Beginning comparison: Is S equal to or greater than∆ (blank)? Greater than - S qualifies, compare stops for beginning range.

Ending comparison: Is S equal to or less than 9? Less than - S qualifies, compare stops. SALARY falls within the 1 - 999999 range.

The ∆ is seen as smaller than 9, so any business unit that is six alpha characters or less, would be considered in the range between ∆ and 9.

For this example, there are two ways around this dilemma:

  1. When setting up Business Units that are alphanumeric, make sure to assign them more characters than your highest numeric business unit. SALARYX is one character longer than the 999999. In the beginning compare S qualifies because it is greater than∆, but in the ending compare S does not qualify because it is not less than∆.

    Figure E-4 Example 2 (for Alphanumeric Business Units)

    Description of Figure E-4 follows
    Description of "Figure E-4 Example 2 (for Alphanumeric Business Units)"

  2. Set up Business Unit Security to make sure that it checks correctly regardless of any alphanumeric/numeric mix of Business Units. Setting up two ranges, 1 thru 99999 and 100000 thru 999999, would allow users access to business units 1 thru 200000 but not to SALARY.

    In the beginning comparison, S qualifies because it is greater than∆, but in the ending compare S does not qualify because it is not less than∆.

    Figure E-5 Example 2 (with Non-Qualifying Character)

    Description of Figure E-5 follows
    Description of "Figure E-5 Example 2 (with Non-Qualifying Character)"

    In the beginning comparison, S does not quality because it is less than 1.

    Figure E-6 Example 2 (Ending Compare)

    Description of Figure E-6 follows
    Description of "Figure E-6 Example 2 (Ending Compare)"

E.3 Other Considerations

World Writer looks for the first data item in a file that has COSTCTRSEC. This is set up in Data Dictionary, field Data Item Class. COSTCTRSEC on a field is what triggers World Writer to look for and incorporate business unit security ranges into the SQL statement.

Typically the first field in a file that has COSTCTRSEC is MCU. If the World Writer version is written over more that one file, it will read and incorporate the first data item with COSTCTRSEC for each file.

The SQL statement below was generated from a World Writer written over F060116 and F06116. In both files, MCU is the first field that has COSTCTRSEC attached to it. Business Unit Security is read on this field in both files.

Figure E-7 Query SQL Statement Display Window

Description of Figure E-7 follows
Description of "Figure E-7 Query SQL Statement Display Window"

In some files the business unit field may be blank. This is valid. However, if business unit security is in effect, a user would have to have a range of *BLANK to *BLANK