JCL - Get count of non space chars in a given area (mainframe)

橙三吉。 提交于 2019-11-28 01:44:37

You will need a program.

I see a fair number of mainframe questions on Stack Overflow asking if something is possible with "JCL only." Keep in mind that JCL is mostly a means of executing programs, and actually does very little other than that. For instance, when you say

I can use sort to position the fields properly and get the UID and text fields

sort is a program. It happens to be a program found on most systems (though there are different vendors' implementations, IBM has one, SyncSort has one, CA has one, etc.) There are plenty of other programs commonly found on mainframe systems.

And just to be pedantic, JCL doesn't actually do anything, JES does the work as it interprets JCL.

For your particular situation you could create a SORT exit, or process your data in Rexx, or you could use some of the Unix System Services commands and execute those via BPXBATCH or COZBATCH.

I've done ad-hoc conversions like this using a REXX program. The program is pretty straight-forward:

  • allocate the input and output files
  • open both files begin loop:
  • read the input
  • extract the text field and strip trailing spaces
  • get length of trimmed text field and format as 5-digit numeric
  • overlay number back into record in the Len field positions
  • write out updated record repeat loop until end of file
  • close both files
  • free allocated files

Let me know if you need some actual code. I've found that REXX is superior than COBOL when it comes to string functions and manipulations. I've even created and called REXX routines from COBOL to accomplish just that.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!