如果DB2表中的表列是INTEGER格式,如何获得Packed Decimal格式的卸载结果?
我有一个查询解释如下......,
1.My DB2 table column is in INTEGER format (it has the date value in Julian date format - YYYYDDD)
2. After unload this date into a flat file, the result is in hexa decimal format.(4 bytes occupaid)
3. I have a requirement to compare this date with (Current Julian date+7days) and write the corresponding recods into a File.
4. So, when I am comparing the Hexa decimal Input date with Current Julian date+7days (DATE3P+7), I am getting MAxcc=0 but I am not getting required output.
5. What I identified the problem is that the input date should also be in packed decimal format.
任何人都可以让我知道如何在卸载时将表值转换为压缩十进制,或者请建议替代方法来获取它。
例如:- 1. 卸载儒略日期 (YYYYDDD) [卸载后将采用十六进制格式]。 2. 与当前儒略日期+7 天进行比较。 排序字段=复制 输出文件=1, 包括=(1,4,PD,LT,DATE3P+7) OUTFIL FILES=2,保存
提前致谢,Rajasekhar Jannu。
I have a one query explaind below....,
1.My DB2 table column is in INTEGER format (it has the date value in Julian date format - YYYYDDD)
2. After unload this date into a flat file, the result is in hexa decimal format.(4 bytes occupaid)
3. I have a requirement to compare this date with (Current Julian date+7days) and write the corresponding recods into a File.
4. So, when I am comparing the Hexa decimal Input date with Current Julian date+7days (DATE3P+7), I am getting MAxcc=0 but I am not getting required output.
5. What I identified the problem is that the input date should also be in packed decimal format.
Can anybody please let me know how to convert the table value in Packed decimal while unloading or please suggest alternate way to get it.
Ex:- 1. Unload Julian date (YYYYDDD) [After unload this will be in hexa decimal format].
2. compare with Current Julian date +7 days.
SORT FIELDS=COPY
OUTFIL FILES=1,
INCLUDE=(1,4,PD,LT,DATE3P+7)
OUTFIL FILES=2,SAVE
Thanks in Advance, Rajasekhar Jannu.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
相信这些替代方法,可以工作...
不要以十六进制类型获取日期,而是将其卸载为 YYYYDDD 中的日期
格式,DATE3 将为您提供 YYYYDDD 格式的儒略日期。现在
它们都采用兼容的格式进行比较和条件。
DB2 有许多标量函数来提供 Julian 日期和 as
很好地用数字表示日期。我相信
JULIAN
标量函数上的DIGITS
会做...
请参阅此 DB2 标量函数
方式是操纵卸载文件,以便十六进制日期
格式需要转换为 YYYYDDD 数字格式使用
DF排序。然后 DATE3 将帮助您获取一周前的数据。 DF排序
参考资料已经分享了。
Believe these alternate ways, work...
Instead of getting the date in hex type, unload it as date in YYYYDDD
format and the DATE3 will give you the julian date in YYYYDDD. Now
these both are in compatible format to compare and condition.
There are many scalar functions of DB2 to provide Julian date and as
well date in numbers. I believe
DIGITS
onJULIAN
scalar functionwould do...
Refer this DB2 Scalar Functions
way would be manipulating the unload file, so that date from hex
format needs to be converted into YYYYDDD numeric format using
DFSORT. Then DATE3 will help u to get one week old data. DFSORT
reference has been already shared.