Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Converting a l-o-n-g record file

SOLVED
Go to solution
Jim Geier_1
Regular Advisor

Converting a l-o-n-g record file

We are receiving EDI "X12" files from other systems, and when the files get to our OpenVMS system, they look like one long record. I tried to edit one of the files, and TPU said "291286 byte record too large for user's buffer". Directory/Full reports that the file is:
Record format: Stream_LF, maximum 0 bytes, longest 0 bytes
Record attributes: Carriage return carriage control
When I try to use CONVERT to change the attributes of the file, Convert also complains with "CONVERT-I-RTL, record longer than maximum length", and creates an empty file.
DUMP can read the file, but the output from DUMP will be pretty hard to manage. Is it possible to use Convert or a combination of Convert and Set File/Attributes (or something else) to get the files into a format I can read and parse with DCL?
5 REPLIES
RBrown_1
Trusted Contributor
Solution

Re: Converting a l-o-n-g record file

Try SET FILE /ATTRIBUTES=(RFM=FIX, LRL=512), or maybe SET FILE /ATTRIBUTES=(RFM=UNDF, LRL=512).

Unless you know something more about whatever an EDI "X 12" file is, and how it is really organized.
Jon Pinkley
Honored Contributor

Re: Converting a l-o-n-g record file

Jim,

I see RBrown has already suggested something similar.

Nothing you do can make current versions of VMS deal with RMS records > 32767 - fudge (Hein will know the exact limit).

How did the file get created on the VMS system? I would have expected you to have problems there. Was it a binary ftp?

Either you need to forced the file to appear to have shorter records, or open the file without RMS, i.e. map the file to a section of memory.

If you are planning to parse X12 in DCL, you are using the wrong tool for the job.

If you still want to use DCL, here is something to try.

Set the file type to fixed 512 byte records (or some other power of 2 like 128) snd then process it in parts. You will then be responsible to mend the stuff that spanned records.

Make a copy of the file, then change the file attributes on the copy.

$ backup ORIG.X12 COPY.X12
$ set file/attr=(RFM:FIX,LRL:512,MRS:512) COPY.X12

Now COPY.X12 will be split into 512 byte records. I am not sure what will happen to the last record, in other words what will be the last record if the file size is not a multiple of 512 bytes in length.

The other option is to write a program to map the file to private section, and then just treat it as a steam of bytes. But you won't be able to use DCL to do that.

Jon
it depends
Jim Geier_1
Regular Advisor

Re: Converting a l-o-n-g record file

The SET FILE/ATTR=(RFM:FIX,LRL:512) works just fine. I am a little impressed at how simple it was, but I was focusing on Convert. Thanks very much!

We only need to use DCL to read a part of the file to get the trading partner name, which is embedded near the beginning of the file. We need the trading partner to process the file properly. The program doing the actual reading, parsing, and processing of the file is in Cache' (Mumps).
Jim Geier_1
Regular Advisor

Re: Converting a l-o-n-g record file

The SET FILE/ATTR=(RFM:FIX,LRL:512) works fine. Very impressed at how simple this was.
Steven Schweda
Honored Contributor

Re: Converting a l-o-n-g record file

> We are receiving EDI "X12" files from other
> systems, [...]

_How_ are you receiving these files?