In this section: |
When the server invokes a transaction or procedure, it needs to know how to build the request, what parameters to pass, and how to format an answer set from the response. For each transaction the server will execute, you must create a synonym that describes the layout of the request/response area.
How to: Reference: |
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.
Using synonyms allows the input parameters and the response layout to be moved while allowing client applications to continue functioning without modification. For example, moving a transaction or procedure from a test region to production. The result of creating a synonym is a Master File and an Access File, which represent the server metadata.
CREATE SYNONYM is based on Local, Parameters, and Global data areas retrieved from the NATURAL ADABAS system file. These areas describe input and output buffers processed by NATURAL programs. If the NATURAL program does not have parameters, or if there are no NATURAL data areas that describe buffers, the CREATE SYNONYM command creates only template Master and Access Files.
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.
A number that identifies the Natural System system file.
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 chose. 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 documention 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 chose the one containing local/global data areas that describe the program's parameters.
Enter the mask for returning a list of the data areas from which you will chose the data area defining the program's 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 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 areas 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.
The following example includes a NATURAL program and local data areas, with corresponding metadata.
IWAYIVPD NATURAL program:
DEFINE DATA LOCAL USING NATTSTI /* INPUT PARMS FOR THE PROGRAM LOCAL USING NATTSTO /* OUTPUT RECORD STRUCTURE LOCAL 1 #FUNC-TYPE 2 #FUNC-GT (A2) INIT<'GT'> 2 #FUNC-PT (A2) INIT<'PT'> 2 #FUNC-LC (A2) INIT<'LC'> 2 #FUNC-LI (A2) INIT<'LI'> 1 #REQUEST-PARMS 2 #FUNCTION (A2) /*GT,PT,LC,LI 2 #OFFSET (I2) /*DATA OFFSET OF INPUT/OUTPUT 2 #LENGTH (I2) /*LENGTH OF DATA TO GET OR PUT 2 #RESPONSE-CODE (I4) 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
/* USE LI FUNCTION TO THE GET LENGTH OF INPUT PARAMETERS */ MOVE #FUNC-LI TO #FUNCTION CALL 'AASSUBC' #REQUEST-PARMS IF #LENGTH LT 16 /*REQUIRED FOR THIS PROGRAM*/ THEN TERMINATE END-IF
/* USE GET FUNCTION TO RETRIEVE INPUT DATA PARMS */ MOVE 8 TO #LENGTH MOVE 0 TO #OFFSET MOVE #FUNC-GT TO #FUNCTION CALL 'AASSUBC' #FUNCTION PERSONNEL-ID-FROM CALL 'AASSUBC' #FUNCTION PERSONNEL-ID-TO MOVE 0 TO #OFFSET MOVE 145 TO #LENGTH MOVE #FUNC-PT TO #FUNCTION 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 MOVE 80 TO #LENGTH MOVE #FUNC-PT TO #FUNCTION CALL 'AASSUBC' #FUNCTION #NATPROG TERMINATE END-NOREC /* CREATE OUTPUT RECORD MOVE BY NAME EMPLOY-VIEW TO OUTPUT-RECORD /* SEND OUPPUT RECORD CALL 'AASSUBC' #FUNCTION OUTPUT-RECORD.PERSONNEL-ID END-FIND
ON ERROR MOVE *PROGRAM TO #NATPROG DECIDE FOR FIRST CONDITION WHEN *ERROR-NR = 1106 MOVE ' EMPLOYEE NUMBER IS TOO LARGE. 8 BYTES IS ' TO #NATMSG MOVE 'THE MAX' TO #NATERR WHEN *ERROR-NR = 3061 MOVE ' INVALID EMPLOYEE NUMBER RANGE SPECIFIED ' TO #NATMSG MOVE ' ' TO #NATERR WHEN NONE MOVE ' HAS DETECTED THE FOLLOWING ERROR NUMBER: ' TO #NATMSG MOVE *ERROR-NR TO #NATERR END-DECIDE MOVE 80 TO #LENGTH CALL 'AASSUBC' #FUNCTION #NATPROG TERMINATE END-ERROR END
NATURAL local data areas:
Local IWAYTSTI 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 IWAYTSTO 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)
Generated Master File: IWAYIVPD
FILENAME=IWAYIVPD, SUFFIX=NATCICS , CODEPAGE=37, $ SEGMENT=SEG1, SEGTYPE=S0, $ GROUP=INPUT_PARMS, ALIAS=E1, USAGE=A16, ACTUAL=A16, $ FIELDNAME=PERSONNEL_ID_FROM, ALIAS=E2, USAGE=A8, ACTUAL=A8, $ FIELDNAME=PERSONNEL_ID_TO, ALIAS=E3, USAGE=A8, ACTUAL=A8, $ 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: IWAYIVPD
SEGNAME=SEG1, CONNECTION=CON3, TRANSACTION=SYSTEM:IWAYIVPD, FLOAT=IBM, INTEGER=BigEndian, $
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. Insert Sample Data. Inserts specified number of sample records, populating all fields with counter values. Reorganize. Recreates the data source table preserving original data. Note: This option is not available in the Web Console. |
Impact Analysis |
Generates reports on procedures, synonyms, and columns that provide information on the flows/stored procedures available on a particular server, and the synonyms and columns they use. These reports enable you to evaluate changes before they are made by showing which components will be affected. See the Server Administration for UNIX, Windows, OpenVMS, IBMÂ i, and z/OS manual for details about Impact Analysis reports. |
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. |
Properties |
Displays the properties of the synonym, including physical location, last modified date, description, and privileges. |
Attribute |
Description |
---|---|
SEGNAME |
The name of the Master File segment that describes the stored procedure's input parameters. If the stored procedure does not have input parameters, the synonym generation process creates a dummy segment. |
CONNECTION |
The connection_name as previously specified in a SET CONNECTION_ATTRIBUTES command. The default connection is used if this parameter omitted. |
TRANACTION |
The names of the NATURAL library and the program to be executed. |
iWay Software |