310 likes | 418 Views
Open Query File. Dynamically creating logical views. OPNQRYF Heritage. DclDiskfile at design time:. File name Properties at runtime:. Implementation Differs With Engine. DataGate Windows Simple Query Implements Select/Omit DB2/400 OPNQRYF Implements QRYSLT & KEYFLD parameters
E N D
Open Query File Dynamically creating logical views.
OPNQRYF Heritage • DclDiskfile at design time: • File name Properties at runtime:
Implementation Differs With Engine • DataGate Windows • Simple Query • Implements Select/Omit • DB2/400 • OPNQRYF • Implements QRYSLT & KEYFLD parameters • SQL Server • SQL • Implements SELECT WHERE
Basics • File created in QTEMP • QTEMP in SQL Server introduced: DG-SQL 8.1.433 • Give File any name you wish‡ • *NAME uses DclDiskFile Name keyword value ‡ • *UNIQUE creates a unique name ‡ Avoids risk of duplicate file names • Sequential Access is Intended • Random Access Allowed (some restrictions apply)
QRYSELECT for DataGate Windows • Select/Omit Rule • Relational Operators: • Use either ' or " for literal token • Field to Field comparison allowed • No built in functions
QRYSELECT for DB2/400 • Whatever is valid in QRYSLT • Relational Operators: • Use either ' or " for literal token • Field to Field comparison allowed • Lots of built in functions
QRYSELECT for SQL Server • Whatever is valid following Select From WHERE • Relational Operators: • Use only ' for literal token • Field to Field comparison allowed • Lots of built in functions • Wildcards allowed
QRYKEYFLDS • Specifies presentation sequence of records • ORG( *indexed and *Arrival ) • Target File can be Logical or Physical • Syntax • Field name • Ascending or Descending • Absolute value (numeric fields only)
Need A Little Help? Use Default Select Tab Notice the Drop Downs
What's wrong with this? When Things Go Wrong – DB2/400
WRKACTJOB Check the Job Log for DataGate Job
What's wrong with this? When Things Go Wrong – SQL Server
Random or Sequential Processing? • Open Query intended to be sequential • Random Access commands: • CHAIN; SETLL; SETGT; nnnRANGE • Random is OK • If QRYKeyFlds matches compiled file's key parts • If you say so (see Random keyword) • dclDiskFile's Random Keyword • Tells Compiler of your intention • *NO raises compiler error if you use random commands
Single Source? • Syntax and punctuation differences can be normalized in code • e.g., use <>instead of*NE • How do you do know to which engine application is connected at runtime?
Server Host Name or IP address of DB server Port IP Port for DB service Label Identifies DB Instance PlatformAttribute Identifies server linkage PoolingTimout 0 = No pooling 1-255 = Pool Idle TimeOut User User ID or *DOMAIN Password User password if not *DOMAIN Distinguishing DB Object Properties
Use Server Property? • IP Address • 10.1.3.25 • Host Name • "S1055523" • "NetServ3500\MySQLServerName" • Not cast in bronze • *LOCAL • My Computer for DG Windows instances • My Computer for Default SQL Server instance
Use Port Property? • 0 or 5042 • *LOCAL • 5042 • Required for Remote DG SQL Server • Default for DG iSeries • nnnn • Multiple DG iSeries versions
Use PlatformAttribute Property? • *DATALINK • Native DataGate protocol • DG iSeries • DG Windows • *SQLOLEDB • SQL Server 2000 & 2005
Use Label Property? • Identifies DG Windows DG location • Not meaningful for DG iSeries or DG SQL Server • PlatformAttribute Property distinguishes iSeries from SQL Server • So, use meaningful Label to identify iSeries • e.g., "AS400", "iSERIES", "SYSTEM i"