This is a discussion on Re: COBOL: text split routine, anyone? - Hewlett Packard ; ----- Original Message ---- of Eben Yong I have a custom COBOL routine that takes an incoming 2100-byte text string, and splits it out into 72-byte chunks, [...the reason...] each 2100 byte text string is uploaded into an IMAGE data ...
----- Original Message ---- of Eben Yong
I have a custom COBOL routine that takes an incoming 2100-byte text string,
and splits it out into 72-byte chunks,
each 2100 byte text string is uploaded into an IMAGE data set in
separate data records which are limited to 72-byte text strings.
[...] It works fairly well, but there have been a few
unexpected text parsing errors that have recently required my attention
[...] I was wondering if any COBOL hands
out there have ever tackled such a problem and if so would you be able/willing
to share the source code?
In a past life, I did something similar [which means little or no access to whatever I wrote back then, other than cerebral recall...]
One interesting aspect of COBOL and IMAGE is that your cobol definition of the dataset layout doesn't have to "strictly match" that of the set itself. For instance, we had a similar situation in which there were six 50-character "fields" defined in a dataset for comments. The cobol structure for this defined those six contiguous fields as a single 300-character field. This was populated via a VB program accessing the database through ODBC, but when it came time to print the order, the "comment" field needed to be parsed into printable lines. Eventually, 300 characters became too limiting, but rather than resize the set, it turns out we had a couple of bytes available to store a "sequence" value, so we could then store multiple 300-character "blocks" of comments.
STRING, UNSTRING, and INSPECT are your friends
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *