- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- 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
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
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.