如果DB2表中的表列是INTEGER格式,如何获得Packed Decimal格式的卸载结果?

发布于 2024-12-10 11:53:20 字数 889 浏览 1 评论 0原文

我有一个查询解释如下......,

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吝吻 2024-12-17 11:53:20

相信这些替代方法,可以工作...

  • 不要以十六进制类型获取日期,而是将其卸载为 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 on JULIAN scalar function
    would do...

    Refer this DB2 Scalar Functions

  • If you couldnt unload the table in the way described above, another
    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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文