converting a 4-byte PD value to a DB2 time format



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

converting a 4-byte PD value to a DB2 time format

Postby ricklennox » Thu Dec 16, 2010 6:47 am

Hi, I have an input record which contains a 4-byte PD date field (X'0yymmddC'), followed by a 4-byte PD time field (X'hhmmsssC'). I'm trying to convert both fields into their DB2 formatted counterparts using the BUILD command.

I'm able to convert the PD date value to the desired DB2 date format (CCYY-MM-DD) using the following :
OUTFIL BUILD=(1:1,4,Y2V,TOGREG=Y4T(-)) ..
but I've been searching for a method of converting the PD time value to the DB2 time format (HH.MM.SS).

Part of the problem here is that the time value recorded in the PD field includes the tenths of a second. My attempts at converting it using :
OUTFILE BUILD=(1:1,4,Y2V,TOGREG=Y4T(-),11:5,4,PD,EDIT=(TT.TT.TT)) isn't working. The additional tenth of a second forces the edit to truncate the high-order HH value.. Ex. X'1234567C' becomes '23.45.67'.

I'd like to avoid reformatting the input via an INREC, if possible, but any suggestions would be greatly appreciated.
Thanks,
Rick.
ricklennox
 
Posts: 11
Joined: Thu Dec 16, 2010 5:59 am
Has thanked: 0 time
Been thanked: 0 time

Re: converting a 4-byte PD value to a DB2 time format

Postby Frank Yaeger » Thu Dec 16, 2010 7:14 am

Divide the PD time value by 10 before editing it.

11:5,4,PD,DIV,+10,EDIT=(TT.TT.TT)
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: converting a 4-byte PD value to a DB2 time format

Postby ricklennox » Thu Dec 16, 2010 8:26 am

simple, elegant, and effective... like the infamous 'black mini-dress'! :D
thank you very much, sir
ricklennox
 
Posts: 11
Joined: Thu Dec 16, 2010 5:59 am
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post