In this section: |
When the adapter invokes a Natural program, it needs to know where to find the program and how to process its parameters. For each Natural program the adapter will access, you create a synonym that describes this information.
How to: Reference: |
A synonym defines a unique logical name (also known as an alias) for each Natural file, and one set of input/output parameters. The adapter requires that you generate a synonym for each Natural file you want to invoke with the adapter.
Synonyms define unique names (or aliases) for each transaction or procedure that is accessible from the server. Synonyms are useful because they hide the underlying transaction or procedure from client applications. They also provide support for extended metadata features of the server, such as virtual fields and additional security mechanisms.
Creating a synonym generates a Master File and an Access File. These are metadata that describe to the server the Natural program name, parameters, and options.
To create a synonym, you must have previously configured the adapter. You can create a synonym from the Applications or Adapters pages of the Web Console.
The Applications page opens.
The Select adapter to configure or Select connection to create synonym pane opens.
The first of a series of synonym creation panes opens.
The Status pane indicates that the synonym was created successfully.
The synonym is created and added under the specified application directory.
Note:
The following list describes the parameters for which you will need to supply values, and related tasks you will need to complete in order to create a synonym for the adapter. These options may appear on multiple panes. To advance from pane to pane, click the buttons provided, ending with the Create Synonym button, which generates the synonym based on your entries.
Natural System/User file with program libraries:
The database ID.
If set, the password associated with the Natural system file.
Natural library with Natural programs.
Enter a string for filtering library names, inserting the wildcard character (%) at the beginning and/or end of the string.
For example, enter ABC% to display libraries whose names begin with the letters ABC; %ABC to display libraries whose names end with the letters ABC; %ABC% to display libraries whose names contain the letters ABC at the beginning, middle, or end; or % to display all libraries.
The mask for returning a list of program name from which to choose. Enter a string for filtering program names, inserting the wildcard character (%) at the beginning and/or end of the string.
Choose a program from the drop-down list.
Check this box if your data is defined in either a local data area or a parameter data area. For more information, see the Software AG documentation on data area.
Note: If you check this box, you are re-prompted for database, file and password information on the next Create Synonym pane.
Leave this box unchecked if you are not using defined data.
Natural System/User file with data area definitions:
The database ID.
A number that identifies the Natural System user file.
If set, the password associated with the Natural system file.
The mask for returning a list of libraries from which to choose the one containing local/global data areas that describe the program parameters.
Enter the mask for returning a list of the data areas from which you will choose the data area defining the program parameters.
Select a library from the drop-down list.
The name of the synonym. You can retain the current name or change it.
Changing a synonym's name enables you to manage multiple synonym versions to reflect, for example, multiple environments, or synonyms with different application logic such as different sets of Master File DEFINE attributes.
Select an application directory. The default value is baseapp.
If you have tables with identical table names, assign a prefix or a suffix to distinguish them. For example, if you have identically named human resources and payroll tables, assign the prefix HR to distinguish the synonyms for the human resources tables. Note that the resulting synonym name cannot exceed 64 characters.
If all tables and views have unique names, leave the prefix and suffix fields blank.
To specify that this synonym should overwrite any earlier synonym with the same fully qualified name, select the Overwrite existing synonyms check box.
Note: The connected user must have operating system write privileges in order to recreate a synonym.
Specifies which data area's are for input parameters and which are for output parameters. You can specify the same data area as the source of both the input and output parameters.
Once you have created a synonym, you can right-click the synonym name in the Adapter navigation pane of either the Web Console or the Data Management Console to access the following options.
Option |
Description |
---|---|
Open |
Opens the Master File for viewing and editing using a graphical interface. If an Access file is used it will be also available. |
Edit as Text |
Enables you to view and manually edit the Master File synonym. Note: To update the synonym, it is strongly recommended that you use the graphical interface provided by the Open option, rather than manually editing the Master File. |
Edit Access File as Text |
Enables you to view and manually edit the Access File synonym. Note: This option is available only when an Access File is created as part of the synonym. |
Sample Data |
Retrieves up to 20 rows from the associated data source. |
Data Profiling |
Data Profiling provides the data characteristics for synonym columns. Alphanumeric columns provide the count of distinct values, total count, maximum, minimum, average length, and number of nulls. Numeric columns provide the count of distinct values, total count, maximum, minimum, average value, and number of nulls. |
Refresh Synonym (if applicable) |
Regenerates the synonym. Use this option if the underlying object has been altered. |
Data Management |
Followed by these options, if applicable: Recreate DBMS Table. Recreates the data source table. You are asked to confirm this selection before the table is regenerated. (Note that the table will be dropped and recreated. During the process, data may be lost.) Delete All Data. Deletes all existing data. You are asked to confirm this selection before the data is deleted. Drop Table. Drops the table so that it is removed from the DBMS. Insert Sample Data. Inserts specified number of sample records, populating all fields with counter values. Show/Modify Data. Opens a window that shows the data in the data source with buttons you can click to insert values, filter values, reload the data source, and customize the view. Reorganize. Recreates the data source table preserving original data. Note: This option is not available in the Web Console. |
Impact Analysis |
Generates a report showing where this synonym is stored and used, with links to the synonym instances. Impact Analysis reports enable you to evaluate changes before they are made by showing which components will be affected. See the Server Administration manual for details about Impact Analysis reports. |
Dependencies Analysis |
Generates a report showing information about the synonym and other synonyms and objects that are referenced within it. |
Copy |
Copies the synonym to the clipboard. |
Delete |
Deletes the synonym. You are asked to confirm this selection before the synonym is deleted. |
Cut |
Deletes the synonym and places it on the clipboard. |
Privileges |
Shows the security subjects on the server and the privileges they have to this synonym. |
Properties |
Displays the properties of the synonym, including physical location, last modified date, description, and privileges. |
To be invoked from the adapter, a NATURAL program must conform to the following rules:
WRITE WORK FILE 32 VARIABLE #LEN MEM-LIST
where:
Contains the length of the structure MEM-LIST.
The following example includes a NATURAL program and local data areas, with corresponding metadata.
/**********************************************************************/ /* IWAYIVPB - Sample Natural Program for Natural Batch Adapter */ /* */ /* Input parameters for IWAYIVPB defined in LDA IWAYTSTI. */ /* Output parameters for IWAYIVPB defined in LDA IWAYTSTO. */ /*--------------------------------------------------------------------*/ DEFINE DATA LOCAL USING IWAYTSTI /* INPUT PARMS FOR THE PROGRAM LOCAL USING IWAYTSTO /* OUTPUT RECORD STRUCTURE LOCAL
1 #LEN (I2) /*LENGTH OF DATA TO GET OR PUT 1 #MF (L) INIT <TRUE> 1 #OPSYS (A8) 1 REDEFINE #OPSYS 2 #OP (A3) 1 EMPLOY-VIEW VIEW OF EMPLOYEES 2 PERSONNEL-ID 2 FIRST-NAME 2 NAME 2 MAR-STAT 2 SEX 2 BIRTH 2 DEPT 2 JOB-TITLE 2 CURR-CODE(1:5) 2 SALARY(N9/1:5) 1 #ERROR-PARMS 2 #NATPROG (A8) 2 #NATMSG (A65) 2 #NATERR (A7) END-DEFINE
/* MOVE *OPSYS TO #OPSYS IF #OP NE 'MVS' #MF := FALSE END-IF
/* IF #MF READ WORK FILE 31 ONCE #LEN INPUT-PARMS ELSE READ WORK FILE 31 ONCE INPUT-PARMS END-IF
/* IF #MF AND #LEN LT 16 /*REQUIRED FOR THIS PROGRAM*/ MOVE ' INPUT PARAMETERS HAVE TO BE 16 BYTES' TO #NATMSG MOVE 80 TO #LEN WRITE WORK FILE 32 VARIABLE #LEN #ERROR-PARMS ESCAPE ROUTINE END-IF
MOVE 145 TO #LEN FIND ALL EMPLOY-VIEW WITH PERSONNEL-ID = PERSONNEL-ID-FROM THRU PERSONNEL-ID-TO IF NO RECORDS FOUND MOVE *PROGRAM TO #NATPROG MOVE ' REQUESTED EMPLOYEE NUMBERS NOT IN THE DATABASE' TO #NATMSG IF #MF MOVE 80 TO #LEN WRITE WORK FILE 32 VARIABLE #LEN #ERROR-PARMS ELSE WRITE WORK FILE 32 VARIABLE #ERROR-PARMS END-IF ESCAPE ROUTINE END-NOREC /* Create output record: MOVE BY NAME EMPLOY-VIEW TO OUTPUT-RECORD /* Send output record: IF #MF WRITE WORK FILE 32 VARIABLE #LEN OUTPUT-RECORD ELSE WRITE WORK FILE 32 VARIABLE OUTPUT-RECORD END-IF END-FIND END
NATURAL local data areas:
Local NATTSTI Library SYSTEM DBID 3 FNR 9 I T L Name F Leng Index/Init/EM/Name/Comment 1 INPUT-PARMS 2 PERSONNEL-ID-FROM A 8 2 PERSONNEL-ID-TO A 8 Local NATTSTO Library SYSTEM DBID 3 FNR 9 I T L Name F Leng Index/Init/EM/Name/Comment 1 OUTPUT-RECORD 2 PERSONNEL-ID A 8 2 FIRST-NAME A 20 2 NAME A 20 2 MAR-STAT A 1 2 SEX A 1 2 BIRTH D 2 DEPT A 6 2 JOB-TITLE A 25 2 CUR-CODE A 3 (1:5) 2 SALARY N 9 (1:5)
To generate a synonym for the NATURAL program IWAYIVPB, enter the following information on the Create Synonym panes of the Web Console or the Data Management Console:
A status window displays the message: All Synonyms Created Successfully
Generated Master File
FILENAME=IWAYIVPB, SUFFIX=NATB , $ SEGMENT=SEG1, SEGTYPE=S0, $ GROUP=INPUT_PARMS, ALIAS=E1, USAGE=A16, ACTUAL=A16, ACCESS_PROPERTY=(INTERNAL),$ FIELDNAME=PERSONNEL_ID_FROM, ALIAS=E2, USAGE=A8, ACTUAL=A8, ACCESS_PROPERTY=(NEED_VALUE), $ FIELDNAME=PERSONNEL_ID_TO, ALIAS=E3, USAGE=A8, ACTUAL=A8, ACCESS_PROPERTY=(NEED_VALUE), $ SEGMENT=SEG11, SEGTYPE=S0, PARENT=SEG1, $ GROUP=OUTPUT_RECORD, ALIAS=E1, USAGE=A149, ACTUAL=A145, $ FIELDNAME=PERSONNEL_ID, ALIAS=E2, USAGE=A8, ACTUAL=A8, $ FIELDNAME=FIRST_NAME, ALIAS=E3, USAGE=A20, ACTUAL=A20, $ FIELDNAME=NAME, ALIAS=E4, USAGE=A20, ACTUAL=A20, $ FIELDNAME=MAR_STAT, ALIAS=E5, USAGE=A1, ACTUAL=A1, $ FIELDNAME=SEX, ALIAS=E6, USAGE=A1, ACTUAL=A1, $ FIELDNAME=BIRTH, ALIAS=E7, USAGE=P7, ACTUAL=P4, $ FIELDNAME=DEPT, ALIAS=E8, USAGE=A6, ACTUAL=A6, $ FIELDNAME=JOB_TITLE, ALIAS=E9, USAGE=A25, ACTUAL=A25, $ FIELDNAME=CUR_CODE_POSN, ALIAS=E10, USAGE=A15, ACTUAL=A15, $ FIELDNAME=SALARY_POSN, ALIAS=E11, USAGE=A45, ACTUAL=A45, $ DEFINE BIRTH_DAT/YYMD=BIRTH - 694324; $ SEGMENT=SEG2, SEGTYPE=S0, PARENT=SEG11, OCCURS=5, POSITION=CUR_CODE_POSN, $ FIELDNAME=CUR_CODE, ALIAS=E12, USAGE=A3, ACTUAL=A3, $ SEGMENT=SEG3, SEGTYPE=S0, PARENT=SEG11, OCCURS=5, POSITION=SALARY_POSN, $ FIELDNAME=SALARY, ALIAS=E13, USAGE=P10, ACTUAL=Z9, $
Generated Access File
SEGNAME=SEG1, CONNECTION=NAT1, TRANSACTION=SYSTEM:IWAYIVPB, $
The following Master File attributes describe Natural data segments:
Attribute |
Description |
---|---|
FILENAME |
The Master File name. This name may or may not match the stored procedure name. |
SUFFIX |
Identifies the adapter, and is always ADANAT. |
SEGMENT |
The segments in the description that are created when the synonym is generated. The segment names follow a logical format to provide uniqueness within the file. |
FIELDNAME |
The field name from the data area. |
ALIAS |
The real name of the field in the Natural file. |
GROUP |
The fields from the data areas that were redefined or that were defined as arrays. |
USAGE |
The display format and length of the field. This attribute determines how the value is displayed in reports. Values are determined based on the format and length specified by the ACTUAL attribute. |
ACTUAL |
The format and length of the field as described in the data area. |
Attribute |
Description |
---|---|
SEGNAME |
Is the name of the input segment in the Master File. |
CONNECTION |
Indicates the connection_name as previously specified in a SET CONNECTION_ATTRIBUTES command. Defaults to the default connection. |
TRANSACTION |
Is the name of the library:program to be executed. |
WebFOCUS |