转换打包 COBOL
我正在尝试通过 C# 应用程序中的 SQL 查询更新 COBOL 打包字段。目前,COBOL 打包字段存储在 MS SQL 数据库的字符列 (char(50)) 中。
COBOL 数据类型 = 4 字节二进制数(“PIC S9(9) COMP”):
我可以使用以下语句来提取数据。我不确定如何逆转此数据更新过程。
CAST(CAST(SUBSTRING({列名},{开始},4) AS VARBINARY(4)) AS BIGINT) AS {Alias_Name}
有什么建议吗?
谢谢,
布伦南·曼
I am trying to update a COBOL packed field via a SQL query in a C# application. Currently, the COBOL packed field is being stored in a character column (char(50)) in a MS SQL database.
COBOL Data Type = 4 Byte binary number (“PIC S9(9) COMP”):
I can use the following statement to extract the data. I am not sure on how to reverse this processes for data updates.
CAST(CAST(SUBSTRING({Column Name},{Start},4) AS VARBINARY(4)) AS BIGINT) AS {Alias_Name}
Any suggestions?
Thanks,
Brennan Mann
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
回答来晚了。但无论如何......这里是:
如果它确实是 PIC S9(9) COMP 而不是 COMP-3,那么它不是一个“险恶”的 COBOL 打包字段,而是一个简单的 4 字节整数!
Answer coming late. But anyway ... here goes:
If it's indeed PIC S9(9) COMP and not COMP-3 then it's not a 'sinister' COBOL packed field but a simple 4 byte integer!
如果有人需要这个...这是 C# 的解决方案
In case anyone needs this... This was the solution with C#