IBM ShopIBM Support Download
HomeNewsProductsservicesSolutionsAbout IBM
Search 
   
 

IBM Global Services

 

IBM EDI Services

   
 

DataInterchange

 

Overview

 

Highlights

 

Download

 

Library

 

FAQs

   
 
 

Web services

 

Products and services

   
 
 

Customer care

 

Surveys

   
 
 

Related links:

 

Year 2000 Readiness

 

Technical bulletins

 

Education

   
ContactLegalPrivacy
 

Year 2000 Readiness

Y2K note on mapping:
Expressions that reference variables

 Description

A particular way of mapping a 6-byte date (YYMMDD) will yield undesirable results when dealing with Y2K dates. When a variable is referenced in an expression, DataInterchange implicitly derives the variable's data type based solely on the contents therein, as documented under "Expressions" in Chapter 9 of the DataInterchange Administrator's Guide. That is, if a variable contains only numeric digits, DataInterchage assumes it is numeric and proceeds to normalize as such, which includes the removal of leading zeros. An exception is when a variable is in an expression that involves an FD/TD (from date/to date) operation; in which case, the result includes leading zeros. Therefore, leading zeros are not dropped in example 2 until variable2 is referenced within an expression.

 Examples

Example 1

A 6 byte inbound data element of type DT mapped to a 6-byte application field of type DT:

(input data value of "000101")

      &SAVE variable
      &FORCE &E(variable)

(output data value of "101")

Example 2

An 8-byte inbound data element of type DT mapped to a 6-byte application field of type DT:

(input data value of "000101")

      &SAVE variable
      &SET variable2 &E(variable FD 'CCYYMMDD' TD 'YYMMDD')
      &FORCE &E(variable2)

(output data value of "101")

 Solutions

Numeric normalization is preventable. The CHAR operator explicitly designates a variable's type as character. This prevents suppression of leading zeros. The same two examples are shown below to demonstrate where CHAR is necessary.

Examples 1

A 6-byte inbound data element of type DT mapped to a 6-byte application field of type DT:

(input data value of "000101")

      &SAVE variable
     
&FORCE &E(CHAR(variable))

(output data value of "000101")

Note: An alternative solution is to employ &USE instead:

      &SAVE variable
      &USE variable

Example 2

An 8-byte inbound data element of type DT mapped to a 6-byte application field of type DT:

(input data value of "000101")

      &SAVE variable
      &SET variable2 &E(variable FD 'CCYYMMDD' TD 'YYMMDD')
      &FORCE &E(CHAR(variable2))

(output data value of "000101")

Note: An alternative solution is to eliminate the &SET statement. That is, directly force the result of the expression which is performing the FD/TD operation:

      &SAVE variable
      &FORCE &E(variable FD 'CCYYMMDD' TD 'YYMMDD')