What is the difference between DDS and SQL Tables?

You're asking about two fundamental ways of defining and working with data on IBM i (formerly AS400). Here's a breakdown of the key differences between DDS and SQL tables:

DDS (Data Description Specifications) :

  • Traditional Approach: DDS is the older, more traditional method for defining files (tables) on IBM i. It's been around for a long time and is deeply ingrained in the system's architecture.
  • File-based: DDS focuses on describing the physical layout of files, including record formats, field names, data types, and key fields.
  • Record-oriented: When you work with DDS-defined files in RPG or other languages, you typically process data one record at a time.
  • Data Validation at Read Time: Data validation (checking if data meets the defined rules) typically occurs when data is read from a DDS file.
  • Limited Functionality: DDS has some limitations in terms of data manipulation and querying compared to SQL.

SQL Tables :

  • Modern Approach: SQL (Structured Query Language) is a more modern and standardized way of defining and working with data. It's widely used across different database systems.
  • Table-based: SQL focuses on defining tables with columns, data types, and constraints.
  • Set-oriented: SQL allows you to work with sets of data using powerful queries. You can retrieve, insert, update, or delete multiple rows at once.
  • Data Validation at Write Time: Data validation in SQL typically happens when data is written to a table. This ensures data integrity from the start.
  • Rich Functionality: SQL provides a wide range of features for data manipulation, querying, and management, including joins, subqueries, aggregate functions, and more.

Key Differences Summarized :

Feature DDS SQL Tables
Approach Traditional, file-based Modern, table-based
Data Validation Read time Write time
Data Access Record-oriented Set-oriented
Functionality More limited Rich and extensive
Standardization IBM i specific Industry standard

Which to use?

  • New Development: For new applications, SQL tables are generally recommended. They offer better functionality, performance, and standardization.
  • Legacy Systems: You'll likely encounter DDS-defined files when working with older IBM i applications. It's important to understand DDS for maintenance or migration purposes.
  • Coexistence: You can use both DDS and SQL together. For example, you might have some data in DDS files and other data in SQL tables. You can even use SQL to query data in DDS files.

Important Considerations:

  • Performance: SQL can often provide better performance, especially for complex queries, due to its query optimizer.
  • Data Integrity: SQL's data validation at write time can help ensure data consistency.
  • Developer Skills: SQL is a widely known and taught language, so it might be easier to find developers with SQL skills.