First, I have to assume that you already know the basics of 2E Entity modeling relations (Owned, Keyed, Has, Includes, Refers) and how they are used in the building of a file.
Sharing is an extension of the ‘Refers’ relation, but only comes into play when you want to ‘Refer’ to the same file more then once and the referenced file has more then one key.
The standard use of the ‘Refer’ relation adds the full key structure of the file you’re referring to into your new file as a foreign key. If you add a second reference to same file, the same key structure is duplicated into your file entity. Then depending on your model YSHRDFT value (*NONE/*ALL) – the sharing action is defaulted or not.
Adding the sharing specification does two things:
1. It adds reference clarity to the model and the physical file fields, by using the ‘FOR TEXT’ – what is this reference for.
2. Define ‘HIGH ORDER’ foreign key usage – either creating separate or shared high order keys in the file.
The sharing information is added by expanding the REFERS TO line with a <b>+</b>
This adds an ‘FOR TEXT’ and ‘SHARING’ area to the REFERS TO line.
The FOR TEXT documents what the refers is for. This will add comments to the physical file and COLHDG values for the subsequent references.
The SHARING regulates the construction and usage of the HIGH ORDER key(s)
*NONE – No sharing of high order key(s) – a separate entry is added to the file for all the fields.
*ALL – High order key(s) is shared – the low order key will always have a separate entry.
Here is an example:
Company Known by 10 FLD Company Key
Customer Owned by 10 FIL Company This is the HIGH ORDER key
Customer Known by 20 FLD Customer key
Customer is owned by Company – This gives the customer master file at least two keys (Company, Customer)
Usage of Customer with *NONE
Order Known by 10 FLD Order Number
Order Refers to 20 FIL Customer
For: Ordering Customer Sharing: *NONE
Order Refers to 30 FIL Customer
For: Invoicing Customer Sharing: *NONE
The generated order file would look like this:
ORDER KEY
COMPANY KEY Ordering Customer
CUSTOMER KEY
COMPANY KEY Invoicing Customer
CUSTOMER KEY
Using *ALL
Order Known by 10 FLD Order Number
Order Refers to 20 FIL Customer
For: Ordering Customer Sharing: *ALL
Order Refers to 30 FIL Customer
For: Invoicing Customer Sharing: *ALL
The generated order file would look like this:
ORDER KEY
COMPANY KEY A shared Company key.
CUSTOMER KEY Ordering Customer
CUSTOMER KEY Invoicing Customer
///
I didn’t understand this completly. I wanted to know what happens if I add Sharing upon a file. What will happen to key fields. What Sharing actually means??? Also, what is the difference between Sharing *all and *none. Please expalin in that way….
Discuss This Question: 4  Replies