简体   繁体   English

使用IBM iSeries Client Access从AS400 db文件创建.CSV文件时,我可以挤出前导空白吗?

[英]When using IBM iSeries Client Access to create a .CSV file from an AS400 db file, can I squeeze out leading blanks?

I have a very simple iseries AS400 DDS file defined in this way 我有一个非常简单的iseries AS400 DDS文件以这种方式定义

A    R U110055R                  TEXT('POSITIVE PAY') 
A            ACCT55   9A 
A            SERL55        10A 
A            ISSD55        10A 
A            AMT55         13A 
A            NAME55        50A

I am using Data Transfer from System i (IBM I Access for Windows V6R1) to output a csv to the desktop. 我正在使用System i的数据传输(IBM I Access for Windows V6R1)将csv输出到桌面。 It will then be used by our banking PC software. 然后它将被我们的银行PC软件使用。 I cannot find a setting or a file type that will yield the data without leading blanks. 我找不到会产生数据而没有前导空格的设置或文件类型。 It consistently holds the file sizes of the Database file (without trailing blanks). 它始终保持数据库文件的文件大小(没有尾随空白)。

I need: 我需要:

  "192345678","311","07/22/2016","417700","ALICE BROWN CO."
  "192345678","2887","07/22/2016","4124781","BARBIE LLC."
  "192345678","2888","07/22/2016","4766","ROBERT BLUE, INC."
  "192345678","2889","07/22/2016","71521","NANCYS COOKIES, INC"
  "192345678","312","07/22/2016","67041","FRANKS MARKET"

But I get: 但我得到:

 "192345678","       311","07/22/2016","     11417700","ALICE BROWN CO."
 "192345678","       887","07/22/2016","      4124781","BARBIE LLC." 
 "192345678","       888","07/22/2016","      3204766","ROBERT BLUE, INC." 
 "192345678","       301","07/22/2016","      2971521","NANCY, INC" 
 "192345678","       890","07/22/2016","       967041","FRANKS MARKET"

The Data Options button of the Data Transfer from IBM i application brings up a window where you can explicitly specify the SQL statement used to extract data. 来自IBM i应用程序的数据传输的“ 数据选项”按钮将打开一个窗口,您可以在其中显式指定用于提取数据的SQL语句。

You can use the SQL TRIM() function there... 你可以在那里使用SQL TRIM()函数...... 在此输入图像描述

Limitation of DDS: DDS的限制:

Use of TRIM in DDS 在DDS中使用TRIM

The answer seems to be "You can't." 答案似乎是“你做不到”。 If I were doing this, I'd probably create a SQL VIEW with a DDL statement rather than try to get it done with DDS. 如果我这样做,我可能会创建一个带有DDL语句的SQL VIEW ,而不是尝试使用DDS完成它。

Solution: ( W3School ) or ( IBM Knowledge Center ) 解决方案:W3School )或( IBM知识中心

CREATE VIEW U110055V1 as
    SELECT  TRIM(ACCT55),
            TRIM(SERL55),
            TRIM(ISSD55),
            TRIM(AMT55),
            TRIM(NAME55)
    FROM U110055
    RCDFMT U110055V1R;

Suggestion: 建议:

  • Export the newly created View to a .CSV file ( refer here or here ) 将新创建的视图导出为.CSV文件( 请参阅此处此处
  • Share the IFS file on the network for easy consistent automated access, (No manual export with i Access required). 在网络上共享IFS文件,以便轻松实现一致的自动访问(无需手动导出,需要i Access)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM