COBOL 数据缓冲,无需逐个字符移动
我正在读取一个可变长度输入文件,并想要创建一个不会逐个字符移动的输出缓冲区(索引表)。
例如:我的第一个输入记录是 79 个字符,然后我可以将其移动到表的组级别。我的第二个输入记录是 101 个字符 - 我如何获取这 101 个字符并将它们放入我的表中,从位置 80 开始,长度为 101 ?下一个输入记录从位置 180 开始......等等。我们目前执行的是 1 乘 1 变化,但与块移动到起始地址相比,这是令人难以置信的 CPU 密集型。
我们每天都会这样做数百万次,找到一个解决方案将非常有用。
I am reading a variable length input file and wanting to create an output buffer (indexed table) that will not utilize a character by character move.
For example: my first input record is 79 characters, I can then move this to my group level of the table. My second input record is 101 characters -- how can I take these 101 characters and place them in my table beginning at position 80 for a length of 101 ? And the next input record beginning at position 180.....etc. We currently Perform Varying 1 by 1 but this is incredibly CPU intensive compared to a block move to a beginning address.
We do this millions of times a day and a solution would be quite useful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用记录中长度的参考修改。考虑一下:
一旦您阅读了记录,您就可以根据长度移动,如下所示:
Use reference modification with the length from your record. Consider:
Once you read your record, you can move based on the length like so:
或者老式的(我们在这里谈论 COBOL 所以老式 = 侏罗纪)方式:-
或者如果记录确实在 1 到 101 字节之间变化:
Or the old fashioned ( we are talking COBOL here so old fashioned = Jurassic) way:-
Or if records really vary between 1 and 101 bytes:
看一下 STRING INTO 动词,特别是 WITH POINTER 子句。像这样将事情串在一起时,不要忘记 ON OVERFLOW 命令。
有关详细信息,请获取 Gary Cutler 的 OpenCOBOL 程序员指南的副本。
http://opencobol.add1tocobol.com/OpenCOBOL%20Programmers%20Guide.pdf
这是一本世界级的 COBOL 手册,并且是一个开放且免费的文档 (GNU FDL)。
Take a look at the STRING INTO verb, in particular the WITH POINTER clause. Don't forget the ON OVERFLOW imperative when stringing things together like this.
For details, grab a copy of Gary Cutler's OpenCOBOL Programmer's Guide.
http://opencobol.add1tocobol.com/OpenCOBOL%20Programmers%20Guide.pdf
This is a world class COBOL manual, and it's an open and free document (GNU FDL).