• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • VALUES: A Truly Useless DDS Keyword

    October 26, 2011 Hey, Ted

    We had a recent crisis in our shop. When we dug to the root of the problem, we found that one of our files had an invalid value in one of the fields. I don’t understand why this was the case, because the programmer who wrote the DDS used the VALUES keyword on the field in question. Does the VALUES keyword not prevent invalid data from entering the database?

    –Paul

    No, Paul. One would think it does, but use of the VALUES keyword only applies to the workstation controller. That is, only the green-screen interface is restricted by the VALUES keyword. There’s nothing to stop an SQL interface or a high-level language program from writing another value to the database.

    Here’s an example of a physical file that uses the VALUES keyword.

    A          R MYREC
    A            ONEFIELD       5A
    A            TWOFIELD       2A
    A            REDFIELD       1P 0       VALUES(1 2 3)
    A            BLUEFIELD      5P 2
    A          K ONEFIELD
    

    Obviously the author’s intention is that REDFIELD must have a whole-number value from 1 to 3.

    However, there is another way. Use a check constraint in SQL, as the following CREATE TABLE command illustrates.

    create table tholtp/qad3020pf
       (onefield  char(5),
        twofield  char(2),
        redfield  dec(1)
           check (redfield between 1 and 3),
        bluefield dec(5,2),
        primary key (onefield))
    

    Now the rule is defined in the database, and nothing can write a value other than 1, 2, or 3 into REDFIELD. Any attempt to write another value will raise error CPF502F (Check constraint violation on member MYFILE).

    Here’s yet one more reason to quit using DDS and start using SQL to define database tables.

    –Ted

    RELATED STORIES

    Handling Constraint Violations in RPG

    Simulate a Boolean Data Type in a Database Table

    Implementing Check Constraints in Referential Integrity



                         Post this story to del.icio.us
                   Post this story to Digg
        Post this story to Slashdot

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    VISUAL LANSA 16 WEBINAR

    Trying to balance stability and agility in your IBM i environment?

    Join this webinar and explore Visual LANSA 16 – our enhanced professional low-code platform designed to help organizations running on IBM i evolve seamlessly for what’s next.

    🎙️VISUAL LANSA 16 WEBINAR

    Break Monolithic IBM i Applications and Unlock New Value

    Explore modernization without rewriting. Decouple monolithic applications and extend their value through integration with modern services, web frameworks, and cloud technologies.

    🗓️ July 10, 2025

    ⏰ 9 AM – 10 AM CDT (4 PM to 5 PM CEST)

    See the webinar schedule in your time zone

    Register to join the webinar now

    What to Expect

    • Get to know Visual LANSA 16, its core features, latest enhancements, and use cases
    • Understand how you can transition to a MACH-aligned architecture to enable faster innovation
    • Discover native REST APIs, WebView2 support, cloud-ready Azure licensing, and more to help transform and scale your IBM i applications

    Read more about V16 here.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    New Generation Software:  FREE Business Intelligence Webinar. November 9
    Dan Riehl Presents:  Fall Training Sale – Discounts up to 40%! RPG IV COBOL CL Admin Security
    Connectria Hosting:  What's your IBM System i strategy? Download our FREE report

    IT Jungle Store Top Book Picks

    BACK IN STOCK: Easy Steps to Internet Programming for System i: List Price, $49.95

    The iSeries Express Web Implementer's Guide: List Price, $49.95
    The iSeries Pocket Database Guide: List Price, $59
    The iSeries Pocket SQL Guide: List Price, $59
    The iSeries Pocket WebFacing Primer: List Price, $39
    Migrating to WebSphere Express for iSeries: List Price, $49
    Getting Started with WebSphere Express for iSeries: List Price, $49
    The All-Everything Operating System: List Price, $35
    The Best Joomla! Tutorial Ever!: List Price, $19.95

    On ‘GTFM’ and a Place for Experts Bang For The Buck on Power7 Gen 2 Servers

    Leave a Reply Cancel reply

Volume 11, Number 32 -- October 26, 2011
THIS ISSUE SPONSORED BY:

ProData Computer Services
WorksRight Software
The 400 School

Table of Contents

  • 10 Facts You Should Know about Special Values
  • VALUES: A Truly Useless DDS Keyword
  • Limiting How Much Memory a Storage Pool Can Allocate

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Liam Allan Shares What’s Coming Next With Code For IBM i
  • From Stable To Scalable: Visual LANSA 16 Powers IBM i Growth – Launching July 8
  • VS Code Will Be The Heart Of The Modern IBM i Platform
  • The AS/400: A 37-Year-Old Dog That Loves To Learn New Tricks
  • IBM i PTF Guide, Volume 27, Number 25
  • Meet The Next Gen Of IBMers Helping To Build IBM i
  • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
  • Will Independent IBM i Clouds Survive PowerVS?
  • Now, IBM Is Jacking Up Hardware Maintenance Prices
  • IBM i PTF Guide, Volume 27, Number 24

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle