Topics: |
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.
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.
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 available options.
For a list of options, see Synonym Management Options.
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 | |
Feedback |