使用JCL格式化捕获的SPUFI结果
如何将输入文件格式化为预期输出文件?
输入文件:
浏览 - userId.result
列001 072命令输入===> 滚动===> PAGE
--------+---------+---------+---------+---------+ ---------+-----------+-----------+选择LastName,Firstnme,Phoneno 00010000 来自DSN8C10.EMP 00020000 work -dept ='d11'00030000 订购姓氏; 00040000
---------+---------+---------+---------+---------+ ---------+---------------+----------------+
Lastname Firstnme Phoneno
Adamson Bruce 4510
Brown David 4501
John Reba
0672 Jones William 0942
Lutz Jennifer 0672
Pianka Elizabeth 3782
Scoutten Marilyn 1682
---------+---------+---------+---------+---------+ ----------+----------------------------------------------------------+
phoneno stern
irving 6423
沃克詹姆斯2986
yamamoto kiyoshi 2890
yoshimura masatoshi 2890
dsne610i dsne610i列出的行数是11 dsne616i语句执行成功,sqlcode是100
---------+---------+---------+---------+---------+ ----------+---------------+----------------+--------------------------------------------------------------------- ---+-----------+------------+-----
DSNE617i执行的提交,SQLCODE为0 DSNE616I语句执行成功,SQLCODE为0
---------+---------+---------+---------+---------+ ----------+----
DSNE601I SQL语句假定在第1列和72列DSNE620I之间处理的SQL语句的数量为1 DSNE621I输入记录的数量读取的读数为4 dsne622i 4 dsne622i输出记录编写的输出记录数为30
预期的输出:
Adamson Bruce 4510
Brown 4510 Brown 4510 Brown 4510 Brown David 4501
John Reba 0672
Jones William 0942
Lutz
Jennifer 0672 Pianka Elizabeth 3782
Scoutten Marilyn 1682
Stern Irving 6423
Walker James 2986
Yamamoto Kiyoshi Kiyoshi 2890
Yishimimura Masatoshi 2890090
How to format the input file as expected output file?
Input file :
BROWSE-- userid.RESULT
COLUMNS 001 072 COMMAND INPUT ===>
SCROLL ===> PAGE
--------+---------+---------+---------+---------+---------+---------+---------+ SELECT LASTNAME, FIRSTNME, PHONENO 00010000
FROM DSN8C10.EMP 00020000
WHERE WORKDEPT = 'D11' 00030000
ORDER BY LASTNAME; 00040000
---------+---------+---------+---------+---------+---------+---------+---------+
LASTNAME FIRSTNME PHONENO
ADAMSON BRUCE 4510
BROWN DAVID 4501
JOHN REBA 0672
JONES WILLIAM 0942
LUTZ JENNIFER 0672
PIANKA ELIZABETH 3782
SCOUTTEN MARILYN 1682
---------+---------+---------+---------+---------+---------+---------+---------+
LASTNAME FIRSTNME PHONENO
STERN IRVING 6423
WALKER JAMES 2986
YAMAMOTO KIYOSHI 2890
YOSHIMURA MASATOSHI 2890
DSNE610I NUMBER OF ROWS DISPLAYED IS 11 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100
---------+---------+---------+---------+---------+---------+---- ---------+---------+---------+---------+---------+---------+----
DSNE617I COMMIT PERFORMED, SQLCODE IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0
---------+---------+---------+---------+---------+---------+----
DSNE601I SQL STATEMENTS ASSUMED TO BE BETWEEN COLUMNS 1 AND 72 DSNE620I NUMBER OF SQL STATEMENTS PROCESSED IS 1 DSNE621I NUMBER OF INPUT RECORDS READ IS 4 DSNE622I NUMBER OF OUTPUT RECORDS WRITTEN IS 30
Expected Output file :
ADAMSON BRUCE 4510
BROWN DAVID 4501
JOHN REBA 0672
JONES WILLIAM 0942
LUTZ JENNIFER 0672
PIANKA ELIZABETH 3782
SCOUTTEN MARILYN 1682
STERN IRVING 6423
WALKER JAMES 2986
YAMAMOTO KIYOSHI 2890
YOSHIMURA MASATOSHI 2890
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有许多问题。您似乎在交互方式运行SPUFI,必须将其更改为批处理执行,否则您将每次使用SPUFI出于不同的目的使用SPUFI时覆盖您的用户IDERID.RESULTS数据集。 IBM DB2文档中记录了DSNTEP2和DSNTEP4,建议其输出限制为宽度133个字节。这看起来对您的情况有效,但不一定在一般情况下。
这样做之后,您有许多的选项用于重新格式化结果,商店的排序实用程序,尴尬,sed,自定义代码,您在rexx,java,pl/i,pl/i,cobol,cbol,c,c,c,c,c,python,python ,等等。选择其中之一取决于许多因素,包括当前在商店中安装了哪些产品和语言,您自己的技能,从DB2返回的结果集的大小,目前正在从您的产品和/或语言中逐步逐步逐步淘汰。购物,等等。
如果要使用自定义代码路由,则可能需要用该语言(如果受支持)对您的选择语句进行编码,并在一个程序中进行数据检索并重新格式化。
如果您的商店拥有该产品,则可以更好地解决问题的方法是使用Syncsort。 Syncsort有能力针对DB2执行选择语句,然后处理结果,并根据需要进行重新格式化。请记住,尽管有能力,但您的商店可能选择不使用它。
通常,通过询问同龄人和支持员工通常如何在您的商店中应对这种类型的挑战,您会得到很好的服务。商店标准存在许多原因,遵循它们符合您的最大利益。
There are a number of issues here. You appear to be running SPUFI interactively, you'd have to change that to a batch execution otherwise you'll be overwriting your userid.RESULTS dataset every time you use SPUFI for a different purpose. DSNTEP2 and DSNTEP4 are documented in the IBM DB2 documentation, be advised their output is limited to 133 bytes in width. This looks like it will work for your situation, but not necessarily in the general case.
After doing that, you have many options for reformatting your results, your shop's SORT utility, awk, sed, custom code you write yourself in Rexx, Java, PL/I, COBOL, C, C++, Python, and so forth. Choosing one of these is dependent on a number of factors including what products and languages are currently installed in your shop, your own skill set, size of the result set returned from DB2, which products and/or languages are currently being phased out of your shop, and so forth.
If you're going to go the custom code route, you might want to code your SELECT statement in that language (if it's supported) and do your data retrieval and reformatting all in one program.
Perhaps a better solution to your problem is to use Syncsort, if your shop has that product. Syncsort has the ability to execute a SELECT statement against DB2 and then process the result, reformatting as necessary. Bear in mind that while the ability is there, your shop may have elected not to use it.
As is often the case, you are well served by asking your peers and support staff how this type of challenge is normally met in your shop. Shop standards exist for many reasons, following them is in your best interest.