Home » Infrastructure » Other Operating Systems » VMS Replace Command
VMS Replace Command [message #72631] Fri, 08 August 2003 11:14
Michael
Messages: 61
Registered: October 1999
Member
I'm trying to create a DCL command which will parse out a file, by replacing the ~'s in the file with a combination of a carriage return/line feed.

Currently, my file is on one line and is thousands of characters long.

so, imagine:
test~32House~young~three~ .......and so on

so the file would look like:
test
32House
young
three

I need to separate thousands of these segments and it is all being passed on one line.

Here is what I tried:

$open/read ifile p1
$open/write ofile 'f$parse(p1,,,"NAME")'.dat
$loop:
$read/end=end ifile rec
$ A = REC
$ cnt = 1
$subloop:
$ B = f$locate("~",A)
$ write sys$output b
$ a'cnt' = f$element(0,"~",a)
$ A = f$extract(b+1,f$length(A)-B,A)
$ WRITE OFILE a'cnt'
$ if b .eqs. f$length(A) then goto more
$ cnt = cnt+1
$goto subloop
$ more:
$ write ofile A
$ goto loop
$END:
$close ifile
$close ofile

This seems to work, but throughout the file, I get blank lines and sometimes the file breaks at the wrong spot and not at the ~

Any ideas on what I'm doing wrong, or how I can write a replace command in DCL to do this?

I need to be able to do this in an automated fashion, and not manually.

Thanks!
Previous Topic: Converting data from a Long Raw column in table to a Bfile
Next Topic: Connection from OS/390 Oracle server to Unix server for Replication
Goto Forum:
  


Current Time: Mon Sep 22 13:51:42 CDT 2014

Total time taken to generate the page: 0.26138 seconds