IBM WebSphere Adapters for IBM i are prebuilt software integration components compliant with Java™ Connector Architecture 1.5 (JCA). The IBM i adapter provides bi-directional connectivity between enterprise information system (EIS) and business applications through configuration only (without any coding approach) and can run on multiple application runtimes, such as IBM Process Center, IBM Process Server or IBM WebSphere Enterprise Service Bus (WebSphere ESB).
Using an inbound operation on the IBM i adapter, you can receive messages from a data queue present in the IBM i system. Two CL programs (I5INBOUND.clle and I5ARCHFAIL.clle) shipped as part of the samples with WebSphere Adapters for IBM i. These CL programs can now support the various date formats such as YMD, MDY, DMY, and JUL.
This article explains:
- Inbound configuration for IBM i adapters
- Supported date formats of the previous version of CL programs
- Changes in the CL program to support different date formats
Prior knowledge on the IBM i adapter and basic knowledge of the IBM i enterprise information system is recommended for this article.
- IBM Integration Designer V22.214.171.124 (formerly called WebSphere Integration Developer)
- WebSphere Adapter Version 126.96.36.199 with IBM i Adapter
- IBM Business Process Manager V188.8.131.52
- IBM i Enterprise Information System of V7R1 version
Inbound configuration for the IBM i adapter
Using inbound operation on an IBM i adapter, you can receive messages from a source data queue (can be simple or keyed data queue) present in the IBM i system. The IBM i adapter uses a staging data queue (a keyed data queue with a fixed key length of 18) and CL programs (provided as samples with adapter) for inbound processing. The CL programs transfer inbound events from the source queue to the staging queue to support persistence and assured event delivery. The events will be stored in the staging queue in the same order in which they are placed in the source queue.
The enterprise metadata discovery tooling is used to discover the business objects corresponding to the IBM i system (in this case, data queues). In this process, you need to provide information about the location of:
- Staging data queue
- Failed events data queue
- Compiled CL programs
Note: You can find more information about the staging queue and failed events queue in the adapter documentation (available in the References section).
Figure 1 shows how to configure the above specified properties in the enterprise metadata discovery.
Figure 1: Inbound configuration
Supported date formats of the previous version of CL programs
Until IBM i adapter version 184.108.40.206, the CL programs were designed to work with the MDY date format of IBM i systems only. When the date format on the IBM i system were changed, the CL programs supplied with the samples had to be updated and compiled accordingly and had to be used, which was a tedious process.
The Julian date format is commonly used in astronomy, which is a serial date system starting from a reference.
The CL programs have been hard-coded in such a way that the date format has to be only in the MDY format. Users need to either change their IBM i system date format or change the hard-coded date format supported by CL programs to match with the IBM i system date format and compile it before running the CL programs.
Changes in the CL program to support different date formats
You can update these CL programs and can enable them to support any type of date format (irrespective of the date format of the IBM i system) as shown below.
YMD, MDY, DMY and JUL are the four date formats supported by the IBM i system. The first three date formats (YMD, MDY and DMY) represent the date with six digits and JUL represents the date with five digits. Two additional variables are added for this change. one with six characters and one with five characters.
DCL VAR(&DATE) TYPE(*CHAR) LEN(6) DCL VAR(&JDATE) TYPE(*CHAR) LEN(5)
The date format of the IBM i system is retrieved by using the following command.
RTVSYSVAL SYSVAL(QDATFMT) RTNVAR(&DATFMT)
If the application requires the date in the YMD format, then the date format can be retrieved from the IBM i system and then converted to the YMD date format using the following commands:
/* CONVERT DATE FORMAT FROM JUL TO YMD */ if (&DATFMT='JUL') THEN(DO) RTVSYSVAL SYSVAL(QDATE) RTNVAR(&JDATE) CVTDAT DATE(&JDATE) TOVAR(&CVTDATE) FROMFMT(*JUL) TOFMT(*YMD) + TOSEP(*NONE) GOTO CMDLBL(CONTINUE) ENDDO /* CONVERT DATE FORMAT FROM non-JUL TO YMD */ RTVSYSVAL SYSVAL(QDATE) RTNVAR(&DATE) CVTDAT DATE(&DATE) TOVAR(&CVTDATE) FROMFMT(*SYSVAL) TOFMT(*YMD) + TOSEP(*NONE)
Now, CVTDATE will have the date format as YMD.
The above code snippets can be used to convert any of the IBM i system date formats to the YMD date format in the CL program.
Note: In case your application requires the non-YMD date format, in the TOFMT(*FMT) field, replace FMT with the required date format.
In this article, you learned how to update the CL programs to support various date formats, irrespective of the date format of the IBM i system.
- IBM i Adapter - WebSphere Adapters V220.127.116.11
- WebSphere Adapters Product Page provides sample applications that show you how to use various WebSphere Adapters.
The authors would like to thank Raja Sreenivasan for reviewing and providing valuable suggestions for this article.
Dig deeper into IBM i on developerWorks
Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.
Experiment with new directions in software development.
Software development in the cloud. Register today to create a project.
Evaluate IBM software and solutions, and transform challenges into opportunities.