Nonstandard File Names and SQL

SQL
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Using SQL on the AS/400 is a very fast and useful feature for finding information quickly and efficiently. However, what do you do when you want to retrieve information from a file which contains a period (.) in its name? For example, if you try to select file AP.MASTER through SQL, you will get error message SQL0104 ("Token . was not valid..."). I called IBM's Level 1 support and asked how to get around this. They told me to execute the Override with Database File (OVRDBF) command to override the nonstandard file name to a name that is standard; and then, use the standard name in my SQL statement.

Determined to find an easier way, I discovered that you can save a lot of keystrokes and time by simply putting the file name in quotes, (e.g., "AP.MASTER") in your SQL statement. This method still allows you to prompt the SELECT fields line, plus it saves you time and aggravation by eliminating the need for the OVRDBF command for each file. The best thing about using the quotes is that you won't have to exit and restart SQL to do an override if you decide to search for records in different files.

5 illustrates the SQL statement I used for the AP.MASTER file. If you have the same file name in two different libraries you may have to qualify the file name. For example, type QS36F/"AP.MASTER" for the LIBRARY/FILE that you want to select on the FROM line. Type the file name in capitals or SQL will not find the file.

Figure 5 illustrates the SQL statement I used for the AP.MASTER file. If you have the same file name in two different libraries you may have to qualify the file name. For example, type QS36F/"AP.MASTER" for the LIBRARY/FILE that you want to select on the FROM line. Type the file name in capitals or SQL will not find the file.


Nonstandard File Names and SQL

Figure 5 Referencing Nonstandard File Names in SQL

 SELECT * FROM "AP.MASTER" WHERE PAYDTE = 940101 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: