第一次尝试将 IBM i CPYSPLF 转换为 *TOSTMF?

trying the IBM i CPYSPLF to *TOSTMF for the first time?

我第一次尝试将 CPYSPLF 转换为 *TOSTMF。

我看起来很有前途,除了当我使用 iSeries 导航器编辑器在 IFS 上查看文件时,它看起来像 EPSIDIC 垃圾。虽然使用 wrklnk 看起来不错。我在哪里可以转换为 ASCII 或有用的 CCSID?

> QSYS/CPYSPLF FILE(QPJOBLOG) TOFILE(*TOSTMF) 
> JOB(123980/USER99/USER99_1) SPLNBR(*LAST)     
> TOSTMF('/tmp/USER99.txt') STMFOPT(*REPLACE)

废话:

@õ÷÷ðââñ@å÷ÙòÔð@ñôðôñø@@@@@@@@@
@@@@@@@@@@@@@@@@@@Ñ–‚@Ó–‡@@@@@
@@@@@@@@@@@@@@@@@@@@@@@×Ö
âÄÅå@@@@ðóañôañø@@ñõzðøzó÷@ÃÄã@@

IFS 文件信息:

Owner  . . . . . . . . . . . . . . . . :   HAPPYUSER     
System object is on  . . . . . . . . . :   Local        
Auxiliary storage pool . . . . . . . . :   1            
  Object overflowed  . . . . . . . . . :   No           

Coded character set ID . . . . . . . . :   37      <<<     
Hidden file  . . . . . . . . . . . . . :   No           
PC system file . . . . . . . . . . . . :   No           
Read only  . . . . . . . . . . . . . . :   No           

Need to archive (PC) . . . . . . . . . :   Yes          
Need to archive (System) . . . . . . . :   Yes          

谢谢!

您的流文件是 EBCDIC,我没有看到使用 CPYSPLF 调整 CCSID 的方法。但是您可以将 CPYSPLF 用于物理文件成员,然后使用 CPYTOSTMF 将数据复制到 IFS 并转换为有用的 ASCII CCSID。

可以想象,IBM 最终会升级 CPYSPLF 命令以允许指定目标 CCSID,但在那之前,最直接的做法是事后转换流文件。

我发现最简单的方法是 CPY 命令:

CPY &STMF TOOBJ(&STMF) TOCCSID(&CCSID) DTAFMT(*TEXT) REPLACE(*YES)

请注意,您可以将同一个流文件指定为源文件和目标文件,以使用转换后的数据覆盖原始文件。

您可以将 iNav 配置为自动转换具有给定扩展名的文件...

来自帮助...

Set up file text conversion
To set file text conversion, follow these steps:

  1. In the System i Navigator window, expand the system you want to use.
  2. Expand File Systems.
  3. Right-click Integrated File System and select Properties.
  4. Enter the file extension that you want to convert automatically in the File extensions for automatic text file conversion text box and click Add.
  5. Repeat step 4 for all file extensions that you want to convert automatically.
  6. Click OK.

有趣的是,iNav 替代品 Access Client Solutions (ACS) 中的 IFS 工具似乎没有相同的选项..

cpysplf 到正确格式的文件。

pseudo code
delete user99.txt
copy knowngood.txt   user99.txt
cpysplf /user99.txt