• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Declare the BINARY Data Type Using DDS

    October 18, 2006 Michael Sansoterra

    We’ve all heard by now that defining tables using DDS is becoming outdated and that developers need to use SQL in order to access the relatively new data types, including DATALINK and Large Objects (BLOB, CLOB, and DBCLOB).

    I recently ran into a situation where I wanted to change a field in an existing table to use the new (as of V5R3) BINARY data type for encrypting credit card data. (Recall that the BINARY data type is similar to character data tagged with a CCSID of 65535. However, data in a BINARY column will never be translated whereas the character data tagged with CCSID 65535 may still be translated depending on the environment settings.) Because it is a “new” SQL data type, I figured the BINARY data type wasn’t available in DDS.

    However, because of issues with the customer’s source management software, I still wanted to re-define the table using the existing DDS rather than change the table definition and related indexes to SQL. It was at this time that I did a little snooping and found that the BINARY data type is definable using DDS. The trick to getting this to work is by specifying a data type of ‘5’ in the data type column of the field definition. Here is an example:

    R DATAFILER                                                 
      CHARDATA     200A         TEXT('EQUIV TO SQL CHAR(200)')  
      BINARYDATA   2005         TEXT('EQUIV TO SQL BINARY(200)')
    

    To create a VARBINARY field instead of BINARY, just add the VARLEN keyword to the field definition.

    The main stumbling block here is that this information is documented in the DDS manual but is not documented in the SEU help on V5R3 or V5R4. After checking the SEU help I almost gave up! I constantly need to remind myself to check multiple sources before giving up on a problem.

    Incidentally, as far as converting an existing field, a character field can be converted to a binary field using the CHGPF command as long as the character field is tagged with CCSID 65535. If the character field is not tagged with CCSID 65535, you’ll have to change the table definition twice: once to change the CCSID of the column to 65535 and then again in order to change the field type from character to binary.

    In case you’re like me and assumed that BINARY isn’t definable with DDS, remember to use data type ‘5’. While it is helpful to know SQL for using the new data types, for legacy files it is handy to be able to use binary columns in existing DDS definitions.

    Michael Sansoterra is a programmer/analyst for i3 Business Solutions, an IT services firm based in Grand Rapids, Michigan. Click here to contact Michael Sansoterra by e-mail.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Rocket Software

    Meet digital age demands while maximizing your IT investment.

    Future-proof your mission-critical applications with Rocket® Solutions for IBM® i that keep your business ahead of the curve.

    Learn More

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    Canvas Systems:  We build and deliver custom iSeries rental solutions
    Integrated Print Solutions:  Print AFP/IPDS documents to any network printer
    COMMON:  Join us at the Spring 2007 conference, April 29 – May 3, in Anaheim, California

    Rimini Street Hires SAP Execs as TomorrowNow Expands Operations Will New Rebates on Standard Edition i5s Boost Sales?

    Leave a Reply Cancel reply

Volume 6, Number 38 -- October 18, 2006
THIS ISSUE SPONSORED BY:

ProData Computer Services
Advanced Systems Concepts
Asymex

Table of Contents

  • The SPACE Function Takes Up a Lot of Space
  • Declare the BINARY Data Type Using DDS
  • Using FTP to Transfer Multiple Files Between Windows and the i5

Content archive

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

Recent Posts

  • POWERUp 2025 –Your Source For IBM i 7.6 Information
  • Maxava Consulting Services Does More Than HA/DR Project Management – A Lot More
  • Guru: Creating An SQL Stored Procedure That Returns A Result Set
  • As I See It: At Any Cost
  • IBM i PTF Guide, Volume 27, Number 19
  • IBM Unveils Manzan, A New Open Source Event Monitor For IBM i
  • Say Goodbye To Downtime: Update Your Database Without Taking Your Business Offline
  • i-Rays Brings Observability To IBM i Performance Problems
  • Another Non-TR “Technology Refresh” Happens With IBM i TR6
  • IBM i PTF Guide, Volume 27, Number 18

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