- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Inserting a carriage return into file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 02:45 AM
тАО08-25-2005 02:45 AM
Inserting a carriage return into file
$edit/tpu/command=sys$login:gsr.tpu
I have been trying to modify this procedure to search for the new line MSH combination and replace it with a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 02:48 AM
тАО08-25-2005 02:48 AM
Re: Inserting a carriage return into file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 03:27 AM
тАО08-25-2005 03:27 AM
Re: Inserting a carriage return into file
welcome to VMS forum.
I'm not an TPU expert but if I remember you can:
- Edit file with TPU
- Enter in command mode with PF4
- User REPL
- Old string: you can type MSH
- New String: Press Ctrl + V for quote, press RETURN key and MSH again
This should work.
Antonio Vigliotti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 03:30 AM
тАО08-25-2005 03:30 AM
Re: Inserting a carriage return into file
in HELP QUOTE there is your answer:
o To insert a special character from within an EVE initialization file
(such as in batch editing), use the TPU command and the EVE$INSERT_TEXT
procedure. For example, the following command line inserts an escape
character:
TPU EVE$INSERT_TEXT (ASCII (27));
Antonio Vigliotti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 03:33 AM
тАО08-25-2005 03:33 AM
Re: Inserting a carriage return into file
Antonio is correct. However, be careful with the PF4. It can be the "DO" key depending on several factors, but it can also be the delete line key. You should be able to take Antonio's advice and apply it to your script file changing the ~ with MSH and the * with
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 03:43 AM
тАО08-25-2005 03:43 AM
Re: Inserting a carriage return into file
Tell me if I am correct. You have a file which in dump looks like this:
MSH
And you want to get each MSH in one record.
Maybe this command will help you (try it on a copy of the file!):
$ SET FILE filename /ATTR=(RFM:STMLF)
If this does not help, can you attach a dump and DIR/FULL of the file.
Bojan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 03:46 AM
тАО08-25-2005 03:46 AM
Re: Inserting a carriage return into file
Jim,
What do you mean with
At first I though it was a NULL byte, but looking at the file it appears to be a LINEFEED (%x0A) so perhaps 'New-Line'?
I downloaded your attachment to my PC,
Then FTP'ed in BINARY mode, and I see a relatively neat file with LF seperators.
Using SET FILE/ATTR=RFM=STMLF it turns into a more or less normal VMS file, but with each segment in an RMS record.
I can then readily make a single RMS record with all the segments using the following perl one-liner:
perl -e "while(<>){chop; if (/^MSH/ && $rec){print ""$rec\n"";$rec=""""}$rec.=$_} print ""$rec\n""" x.tmp > xx.tm
p
In a perl script that would be:
-----------------tmp.p---------------
while (<>) {
chop;
if (/^MSH/ && $rec) {
print "$rec\n";
$rec="";
}
$rec.=$_;
}
print "$rec\n"
-----------------------
perl tmp.p x.tmp > xx.tmp
Both produce 6 record files.
Each record starting with MSH and ending in (some multiple) CD3 segments.
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 04:00 AM
тАО08-25-2005 04:00 AM
Re: Inserting a carriage return into file
In answer to Bojan's question, you are nearly correct. I have a
MSH|
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 04:50 AM
тАО08-25-2005 04:50 AM
Re: Inserting a carriage return into file
my interface has no way to parse the inbound file into the individual records and the same terminator is used between all the segments with nothing as an end or record terminator.
<<
This looks like an EDI file, and it looks perfectly fine on the VMS side after telling RMS what it really is:
$SET FILE/ATTR=RFM=STMLF ! as Hein has said.
I'm surprised that an unchangeable "interface" would require
What is your interface? Normally, rather than try to change the file, it's better to make your code process the file.
Each "segment" is an RMS record. Each is prefixed with a segment identifier. A set of segments make a record set.
In this case, MSH is the beginning of each record set and encountering the next MSH segment identifier or the end-of-file should trigger your end-of-record-set routine. Then either loop back to process the MSH, or finish up the end-of-job.
Forget about the
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 08:26 AM
тАО08-25-2005 08:26 AM
Re: Inserting a carriage return into file
***Error symbol replaced by "-"*** when I run the script.
Bojan's idea would work if each segment was a record, but that is not the case. I am attaching the dir/full and dump of the testfile.
Hein's idea looks promising, but I don't know what to do with perl. I tried entering the one liner and the perl command wasn't recognised. Could you tell me how to use this on VMS?
Finally to Doug, this is HL7 (health level 7) and in our system a carriage return, line feed is used to seperate records in a batch file. I need to modify the file.
Thanks to all for the replies, I really appreciate the help. Please keep them coming.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 09:09 AM
тАО08-25-2005 09:09 AM
Re: Inserting a carriage return into file
Ok the file is an stream_lf file. You can concatenate the records using DCL:
$ open/write outf "
$ open/read inf "
$ rec=""
$l:
$ read inf inrec/end=end
$ if f$extract(0,3,inrec).eqs."MSH".and.rec.nes.""
$ then
$ write outf rec
$ rec = inrec
$ else
$ rec = rec + inrec
$ endif
$ goto l
$end:
$ write outf rec
$ close inf
$ close outf
if you need linefeeds between subrecords (MSI,DC3...) add this line at the begining:
$ lf[0,8]=10
and replace the line
$ rec = rec + inrec
to
$ rec = rec + lf + inrec
Now you have a file which has each record starting with MSH and the rest. If you need a stream file (records terminated with
$ create/fdl=sys$input
RECORD
FORMAT STREAM
$ open/append outf "
This will create a stream file and each record will be terminated with
Bojan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 09:59 AM
тАО08-25-2005 09:59 AM
Re: Inserting a carriage return into file
From what little bit I once knew about Cerner stuff, the records were logically defined by the segment prefixes. The lines (segments) could have whatever line terminators the OS used --
It looks like you did the $set file/attr, so did you test it the way it is? Did it fail?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 12:45 PM
тАО08-25-2005 12:45 PM
Re: Inserting a carriage return into file
$ set file/attr=rat=cr file
Still, that should make no difference for an application. Verify with $DUMP/RECOR[=count=10]
You could make it more of a VMS file using:
$CONV/FDL=NL: old new
That would make it variable length record form, but again it should not make much difference.
Along the same lines, if you just need CR-LF, but can leave the segments then:
$CONVERT/FDL=SYS$INPUT old new
RECORD; FORMAT STREAM
$
My perl scripts would glue the segments together, but does need perl installed.
Sounds like you do not have perl for now.
Bojan's DCL script does exactly the same as the perl script. It may need a WRITE/SYMBOL OUTF REC instead of plain write if the record gets too long.
Good luck,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 07:18 PM
тАО08-25-2005 07:18 PM
Re: Inserting a carriage return into file
as other Gurus posted, you can read this file without any modification.
If yes, you can simply see file with
$ TYPE
and see every segment in a line because LF (code hex 0A) is line delimiter.
In the same way, you can read file as Bojan suggested you.
So the real question is: what do you want to do with this file?
Antonio Vigliotti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-26-2005 10:56 AM
тАО08-26-2005 10:56 AM
Re: Inserting a carriage return into file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2005 02:33 AM
тАО08-28-2005 02:33 AM