Operating System - OpenVMS
1827895 Members
1658 Online
109969 Solutions
New Discussion

how can i read a sequential rms file and write it to a sequential variable lenght rms file

 
SOLVED
Go to solution
Wim Van den Wyngaert
Honored Contributor

Re: how can i read a sequential rms file and write it to a sequential variable lenght rms file

Yes Hein, it's wrong. f$loc starts from 0 not 1 (not my kind of stuff, I lived in cobol).

But removing the 999 easy solution :
$ set ver
$@wim.lis !execution now starts
$rec="abcqwdefg"
$cr="1"
$lf="2"
$
$loop:
$ pos=f$loc("qw",rec)
$ len=f$len(rec)
$ if pos .lt. len
$ then
$ rec=f$extr(0,pos,rec)+ cr + lf + f$extr(pos+2,len-pos,rec)
$ goto loop
$loop:
$ pos=f$loc("qw",rec)
$ len=f$len(rec)
$ if pos .lt. len
$ endif
$ sh symb rec
REC = "abc12defg"

fwiw

Wim (will write 1 page with "I will not post untested code")
Wim
Ataikili
Frequent Advisor

Re: how can i read a sequential rms file and write it to a sequential variable lenght rms file

I fixed it.
Can't solve with only FTP but
FTP+TELNET(running a dcl scrit)

These are my champions,
Hein van den Heuvel(VMS)
Michael Phelp(Swimming)
Usain Bolt(Athletics)

Thanks Hein a lot,
and sure Wim, Schweda and others

Best Regards To ALL From ISTANBUL
Jon Pinkley
Honored Contributor

Re: how can i read a sequential rms file and write it to a sequential variable lenght rms file

Hein,

I liked your tpu procedure approach, so I copied it and tried it with the following input file:

QWqwQwqW

Record number 1 (00000001), 8 (0008) bytes, RFA(0001,0000,0000)

0A0D0A0D 0A0D0A0D ................ 000000

So, it appears that the tpu search builtin is case insensitive. So it wouldn't be appropriate if "QW", "Qw" or "qW" should not be translated to crlf. A somewhat cursory look at the tpu documentation didn't reveal how to make the search be an exact match. I tried specifying an /init file with "SET FIND CASE EXACT" in it, but that didn't change the behavior of the search.

Jon
it depends
Jon Pinkley
Honored Contributor

Re: how can i read a sequential rms file and write it to a sequential variable lenght rms file

The dump output above was from the output file.

The input file had the four case variations of QW, and all were converted to crlf, not just the all lowercase version.
it depends
Doug Phillips
Trusted Contributor

Re: how can i read a sequential rms file and write it to a sequential variable lenght rms file

Jon,

Add EXACT to the search command:

string_range := search('qw',forward,EXACT);
Jon Pinkley
Honored Contributor

Re: how can i read a sequential rms file and write it to a sequential variable lenght rms file

Doug,

Thanks for the info.

I was looking in "Guide to the DEC Text Processing Utility" instead of "DEC Text Processing Utility Reference Manual" which is where I should have been looking.

If anyone is interested in more general purpose TPU based global search and replace routines, Joseph Huber has a collection I found with Google:

http://wwwvms.mpp.mpg.de/~huber/util/TPU/

Jon
it depends