Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 22 Coding SQL Access Statements : Coding Considerations

Coding Considerations
Differences to Consider
Since you are accessing a TIBCO Object Service Broker database you must take into account differences between COBOL and TIBCO Object Service Broker. For example:
Valid TIBCO Object Service Broker names could be invalid in COBOL; for example, TIBCO Object Service Broker table.field names are not valid in COBOL.
Assigning Valid Names
Unlike TIBCO Object Service Broker, COBOL does not allow special symbols in table, field, and parameter names. TIBCO Object Service Broker table and field names used in conjunction with a joining period (.) can have a maximum of 33 characters; COBOL names can have a maximum of only 30 characters.
Rename TIBCO Object Service Broker tables, fields, and parameters to valid COBOL names using the Define Table statement in the Working Storage Section of your program.
Underscores (_) in TIBCO Object Service Broker table, field, or parameter names are automatically replaced with hyphens (-) if you do not explicitly rename them. You must assign valid names to names that contain the characters “$”, “@”, or “#”, regardless of whether you refer to them or not. You do not have to rename those that are already valid or converted, but you can if you want.
Renaming Fields Example
Exec Sql
Define Employee Table = #ED_EMPLOYEES
Parameter USER-ID = USERID,
LOCATION77 = LOCATION
Field mgrno = MGR#,
state-prov = PROV,
zipcode = P_CODE
End-Exec
The field MGR# is renamed because the number sign (#) is an invalid COBOL character. Fields STATE_PROV and ZP_CODE did not have to be explicitly renamed. If they were left out of the Define Table statement, their COBOL names would be STATE-PROV and ZP-CODE.
Use the TIBCO Object Service Broker names in SQL statements and use COBOL names in COBOL statements.
The Form of a Statement
 
The Joining Character
Unlike SQL, which uses a period (.) as the joining character to identify a table and field specification, COBOL requires a (-) hyphen to make them usable. For example:
Employee.lname
is valid in SQL, and
Employee-lname
is valid in a COBOL statement. Use the SQL format in SQL statements and use the COBOL format in COBOL statements. An example of specifying a table and field in a COBOL statement in the Procedure Division is:
DISPLAY EMPLOYEE-LNAME
Coding Operators and Expressions
You can use either SQL or TIBCO Object Service Broker relational operators. All data conversions and calculations are done by COBOL.
An expression must be a valid COBOL expression. Since a parameter expression is considered a literal expression in COBOL, you cannot use a parameter with a non-numeric literal with a length of zero. An expression like:
Select EMPNO from EMPLOYEE('') where salary> 400
would be considered invalid. This is an example of a SELECT statement that you can code in your access statement:
Select EMPNO, LNAME, MGR#
From #ED_EMPLOYEES('EDUC',LOCATION77) where
MGR#= 84021
Syntax Mapping
For information on how TIBCO Object Service Broker syntax is mapped to COBOL syntax, refer to Syntax Mapping.
See Also
TIBCO Object Service Broker Programming in Rules about the rules language, rules processing behavior, and TIBCO Object Service Broker syntax.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved