Topics: |
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.
The Applications page opens.
The Connect to Data page opens.
Depending on the type of adapter you chose, one of the following options appears on the context menu.
The button may be labeled Next, Create Synonym, Create Base Synonyms, Create Cluster Synonym, or Update Base Synonyms.
The synonym creation process for most adapters has been consolidated so that you can enter all necessary parameters on one page. However, for some adapters such as LDAP, you must click Next buttons until you get to a page that has a Create Synonym button.
The synonym is created and added under the specified application directory.
Note: When creating a synonym, if you choose the Validate check box (where available), the server adjusts special characters and checks for reserved words. For more information, see Validation for Special Characters and Reserved Words.
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 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'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 available options.
For a list of options, see Synonym Management Options.
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. |
WebFOCUS | |
Feedback |