CICS VSAM Transparency for z/OS, Version 1.2


DATE picture strings

When you map a field to a DB2® DATE column, you must supply a picture clause.

A typical picture clause for a DATE column is a series of 2-byte constants, where CC represents century, YY represents year, MM represents month, and DD represents day. In the sample VIDKSDS file, the field VIDF007 is mapped to the DATE column ITEM_DATE_FSHIP. The mapping for VIDF007 is shown in Figure 1.

Figure 1. Mapping to a DATE column
 --------------------------- CICS VT: Display field -------------------------
Command ===> ________________________________________________ Scroll ===> CSR
                                                                             
Data set name  . : VIDKSDS                                                   
Creator  . . . . : CIRDL                                                    +
Table  . . . . . : VID_ITEM                                                 +
Data set length  : 00080                                                     
                                                                             
Field name . . . : VIDF007                                                   
Field length . . : 00005                                                     
Field type . . . : P                                                         
Column name  . . : ITEM_DATE_FSHIP                                          +
Starting position: 00039                                                     
                                                                             
Picture or FBE . : CCYYMMDD                                                  
Parameters . . . :                                                           
                                                                             
Special function :                                                           
Mapped from table: P                                                         
Build order  . . : 00008                                                     
                                                                             
                                                                             
Press:  PF3=Exit  PF1=Help                                                   
 
Other characters can be specified in the picture string, and Table 1 shows a number of examples of the data conversion that is performed with various picture strings. In this case, the source data is in VSAM: ZZ in the picture string can be any characters apart from C, Y, M, or D.
Table 1. Picture strings for converting to DB2 DATE columns
Picture Source value Converted value
CCYY/MM/DD 2008/12/31 2008-12-31
CCYY:MM:DD 2008:12:31 2008-12-31
ZZCCMMDD 20081231 1908-12-31
CCZZMMDD 20081231 2000-12-31
CCYYZZDD 20081231 2008-01-31
CCYYMMZZ 20081231 2008-12-01
When data in Table 1 is retrieved from DB2 columns of these types, the effects of the same picture strings result in the field values in Table 2 being returned to your application program:
Table 2. Converting DB2 DATE columns back to VSAM format
Picture Source value Converted value
CCYY/MM/DD 2004-12-31 2004/12/31
CCYY:MM:DD 2004-12-31 2004:12:31
CCYYMM01 2004-12-31 20041201
CCZZMMDD 2000-12-31 20ZZ1231
CCYYZZDD 2004-01-31 2004ZZ31
CCYYMMZZ 2004-12-01 200412ZZ

CICS® VT always uses the same picture string for converting VSAM to DB2 and DB2 to VSAM. A simple FBE is required to enable different picture strings for VSAM to DB2 and DB2 to VSAM conversions.



Concept topic


Last updated: November 9, 2012 20:43:54