Download presentation
Presentation is loading. Please wait.
Published byLesley Wells Modified over 9 years ago
1
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. by Tim Jannsen ASNA © Copyright 2007 by ASNA. All rights reserved. Open Query File Dynamically creating logical views. 1
2
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. OPNQRYF Heritage DclDiskfile at design time: File name Properties at runtime:
3
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Implementation Differs With Engine DataGate Windows – Simple Query Implements Select/Omit DB2/400 – OPNQRYF Implements QRYSLT & KEYFLD parameters SQL Server – SQL Implements SELECT WHERE
4
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. 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)
5
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. QRYSELECT for DataGate Windows Select/Omit Rule Relational Operators: Use either ' or " for literal token Field to Field comparison allowed No built in functions > GTGreater than >= GEGreater than or equal < LTLess than <= LELess than or equal = EQEqual != <> NENot equal & AND | OR
6
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. DataGate Windows Examples
7
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. 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 > *GTGreater than>= *GEGreater than or equal < *LTLess than<= *LELess than or equal = *EQEqual¬= *NENot equal ¬> *NGNot greater than¬< *NLNot less than & *AND And| *OROr && *XORExclusive OR*CTContains || *CATConcatenate*NOTNot
8
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. DB2/400 Examples
9
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. 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 >Greater than>=Greater than or equal <Less than<=Less than or equal =Equal<> !=Not equal !>Not greater than!<Not less than AND AndOROr +ConcatenateNOT
10
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. SQL Server Examples
11
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. 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)
12
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. When Things Go Wrong – DG Windows
13
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Copy and Paste QRYSelect
14
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Need A Little Help? Use Default Select Tab Notice the Drop Downs
15
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. When Things Go Wrong – DB2/400 What's wrong with this?
16
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Check the Job Log for DataGate Job WRKACTJOB
17
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. When Things Go Wrong – SQL Server What's wrong with this?
18
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Use SQL Server Management Studio
19
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Use SQL Server Management Studio
20
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. 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
21
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. 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?
22
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Database Class Members
23
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Database Properties
24
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Distinguishing DB Object Properties 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
25
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. 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
26
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Use Port Property? 0 or 5042 – *LOCAL 5042 – Required for Remote DG SQL Server – Default for DG iSeries nnnn – Multiple DG iSeries versions
27
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Use PlatformAttribute Property? *DATALINK – Native DataGate protocol DG iSeries DG Windows *SQLOLEDB – SQL Server 2000 & 2005
28
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. 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"
29
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Mix in ADO for Embedded SQL
30
ASNApalooza 2007 © Copyright 2007 by ASNA. All rights reserved. Open Query File 30
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.