1824993 Members
2179 Online
109678 Solutions
New Discussion юеВ

Re: Edit/TPU question

 
SOLVED
Go to solution
Ian Derringer
Regular Advisor

Edit/TPU question

I'm trying to edit a flat file, which I brought down from the Wintel environment. And I am trying to add a CR at the beginning of the line and for all of the lines. Would any know on how to do this within edit/tpu on the VMS environment??

Thanks,
Ian
31 REPLIES 31
Uwe Zessin
Honored Contributor

Re: Edit/TPU question

I am a bit rusty on TPU programming, so I would use a learn sequence. Trying without a keypad, but cursor keys (else, use the 'move down' command):
$ edit/tpu file
learn


what

this tells the number of lines as I have forgotten them since when I invoked the editor ;-)

repeat #-1


-1, because the first line was changed by the LEARN sequence. Well that should do it.
.
Dale A. Marcy
Trusted Contributor
Solution

Re: Edit/TPU question

Uwe's method will work well, but if you know where your DO key is, you can replace the with just pressing the DO key ( if you are using the EDT emulation). The recalls the last entered command and the deletes everything from the cursor (which is at the end of the line) to the beginning of the line.
Jan van den Ende
Honored Contributor

Re: Edit/TPU question

Ian,
as so often, what problem are you trying to solve?

Are you getting all your text without linebreaks and want to carrect that?
- how did you transfer the file from the Wintel box?
if FTP, try transfer with TYPE ASCI, and you are home.

If something else, please supply more info.

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Dale A. Marcy
Trusted Contributor

Re: Edit/TPU question

If you are trying to make the file readable on VMS (i.e., turn it into a standard text file), then I would try the following:

$ analyze/rms/fdl/output=c.fdl login.com
$ convert/fdl=c.fdl flat.file readable.file

I selected login.com because it should be just a standard ascii text file and the above does assume that you are in your default login directory and the file you are converting is in your default login directory. flat.file should be replaced with your filename and readable.file should be replaced with the resulting filename you desire.
Jan van den Ende
Honored Contributor

Re: Edit/TPU question

Ian,


From your Forum Profile:


I have assigned points to 36 of 117 responses to my questions.


Maybe you can find some time to do some assigning?

Mind, I do NOT say you necessarily need to give lots of points. It is fully up to _YOU_ to decide how many. If you consider an answer is not deserving any points, you can also assign 0 ( = zero ) points, and then that answer will no longer be counted as unassigned.
Consider, that every poster took at least the trouble of posting for you!

To easily find your streams with unassigned points, click your own name somewhere.
This will bring up your profile.
Near the bottom of that page, under the caption ├в My Question(s)├в you will find ├в questions or topics with unassigned points ├в Clicking that will give all, and only, your questions that still have unassigned postings.

Thanks on behalf of your Forum colleagues.

PS. ├в nothing personal in this. I try to post it to everyone with this kind of assignment ratio in this forum. If you have received a posting like this before ├в please do not take offence ├в none is intended!

Proost.

Have one on me.

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Ian Derringer
Regular Advisor

Re: Edit/TPU question

Guys,
Thanks for bringing to my attention on the points. I have always submit my points. However, I am not sure why I'm showing as ungrateful for not assigning points. Okay, I've just assigned those points. And no, I am not offended.

Regards,
Ian
Hein van den Heuvel
Honored Contributor

Re: Edit/TPU question


Dale wrote: "$ analyze/rms/fdl/output=c.fdl login.com
$ convert/fdl=c.fdl flat.file readable.file"

Just fwiw... even simpler:

CONV/FDL=NL: bad good :-)

This works because the FDL defaults have all the right stuff, so no actual fdl need to be provided, but the converts needs to be done.

Hein.
Ian Derringer
Regular Advisor

Re: Edit/TPU question

Hein - I don't understand the command you've posted "CONV/FDL=NL: bad good" - Do I just do CONV/FDL=NL: bad_file good_file???

As you can see, I am a newbie to the OpenVMS world.

Thanks for your time.

Ian
John Gillings
Honored Contributor

Re: Edit/TPU question

Ian,

TPU has a wildcard support which can be asked to find the beginning of a line. You could add a CR at the beginning of each line like this (comments after "!"):

$ EDIT/TPU yourfile
SET WILD VMS !could be "VMS" or "UNIX"
WILD FIND \< !match beginning of line
TOP ! back to start of file
LEARN ! initiate learn sequence
<^V><^R> ! program to key F14
REPEAT 200 ! replace 200 by required count


See SHOW WILD to see what wildcards are supported. The "UNIX" set are a bit like regular expressions.

Unfortunately there is no WILD REPLACE command. That would make this exercise much simpler.

A crucible of informative mistakes
Uwe Zessin
Honored Contributor

Re: Edit/TPU question

If the file is a simple one and in case you need to do this more often than once - attached is a small, simple minded DCL procedure (name it CR.COM):

$ @CR inputfile outputfile
.
Hein van den Heuvel
Honored Contributor

Re: Edit/TPU question

>> Hein - I don't understand the command you've posted
>> Do I just do CONV/FDL=NL: bad_file good_file???

Yes. The NL: is the device (+ missing file) where you tell teh system to look for the fdl file. It is the NULL device (like /dev/null in unix) and just returns nothing (it returns End Of File to e precise). The result is that the FDL code uses 'nothing' plus its build in defaults which are probably all you needed.

I suspect, but can not be entirely sure given the problem description, that the data in the file is just fine, but the attributes were wrong. Thus, you may also have been able to 'add a CR' by a command like:
SET FILE/ATTR=(RFM=STM,RAT=CR) bad_file
To understand that, check:
DIR/FULL (or ANAL/RMS) bad_file;
DIR/FULL goof_file
HELP SET FILE /ATTR

Also, how did the fle get there? Maybe all you needed was to transfer in FTP ASCI mode like Jan suggested.

Finally I doubt you really wanted to 'add a CR'. The CR character (ASCII(13)) is rarely used as a stand-alone character. I have only seen it used decades ago in the era of dot-matrix printers and those loud 'chain saw' line printers to achieve overprint and bold print.
What you probably meant was to add a new line break, or change to attribute to print a carriage return after each record seperator break.

If it is still a problem then you can help us help you with a reply attaching a text file with the output from the mentioned DIR/FULL and also a DUMP/BLOCK=COUNT=1 bad_file.

Welcome to VMS and RMS
Hein.
Ian Derringer
Regular Advisor

Re: Edit/TPU question

"What you probably meant was to add a new line break, or change to attribute to print a carriage return after each record seperator break."
Hein - You're correct on the statement. I need to add an Attribute "Carriage return Carriage control" to a RMS file. I did tried the online help but got lost in translation. How do I set the file attribute with a carriage return and carriage control?

Thanks for all your help!!

Ian
Ian Derringer
Regular Advisor

Re: Edit/TPU question

Uwe Zessin - The CR.com procedure works wonder for what I am trying to use. However, I have a file with a length of 210 characters long and I want to put a CR right after the end of the line. How do I modify your CR.COM procedure to do just that??

Thanks so much for your help on this.

Ian
Antoniov.
Honored Contributor

Re: Edit/TPU question

Ian,
change in Uwe's procedure write statement as follow:
$LOOP:
$ read /end_of_file=DONE FI LINE
$ write FO LINE+CR
$ goto LOOP

Antonio Vigliotti

Antonio Maria Vigliotti
Ian Derringer
Regular Advisor

Re: Edit/TPU question

Antonio Vigliotti,
Still not doing what I wanted to do. I think the position is off some how. Would you know what's $ CR[0,8]=13 in Uwe's com procedure? I think I need to modify that (??).

Thanks for your help.

Ian
Dale A. Marcy
Trusted Contributor

Re: Edit/TPU question

"Still not doing what I wanted to do. I think the position is off some how. Would you know what's $ CR[0,8]=13 in Uwe's com procedure? I think I need to modify that (??)."

That line is define the variable CR as ASCII 13 the value for a carriage return.
Uwe Zessin
Honored Contributor

Re: Edit/TPU question

Hello Ian,

$ CR[0,8]=13

"13" is the decimal value of the carriage return control character

"CR" is the name of the symbol, could have been "XYZ" or "ABC" as well.

"[0,8]" makes an assignment to bits 0..8.
The online help says:
>> symbol-name[bit-position,size] =[=] replacement-expression

This line just creates a symbol named "CR", length=1, containing the carriage return control character.

$ CR[0,8]=13
$ show symbol CH
CR = "."
$ write sys$output f$length(CR)
1
$

-----

Following your request, I would have changed the procedure the same way like Antonio.

For better debugging your problem I'd like to repeat Hein's request:
""If it is still a problem then you can help us help you with a reply attaching a text file with the output from the mentioned DIR/FULL and also a DUMP/BLOCK=COUNT=1 bad_file.""
.
Ian Derringer
Regular Advisor

Re: Edit/TPU question

I see. How do I put a Carriage return at the end of my line. As I've indicated ealier, the line is 210 chars long. Any ideas?

Please help!

Thanks so much!!

Ian
Dale A. Marcy
Trusted Contributor

Re: Edit/TPU question

I believe what you want to do is change the line:

$ write FO CR+LINE

to

$ write FO LINE+CR

This changes from adding the carriage return at the beginning of the line to adding it to the end of the line.
Uwe Zessin
Honored Contributor

Re: Edit/TPU question

Ian,
have you been able to test Antonio's modification with a different test file?

You should also be able to do with via TPU:
I can't test it right now, but before you enter , insert a
.
Hein van den Heuvel
Honored Contributor

Re: Edit/TPU question

You say the line is 210 characters long.
Is that something you know through application knowledge, or does VMS also know that. A good tool to find out would be DUMP/RECORD=COUNT=5 bad_file (the 5 is just a nice easy low number. Pick 3 or pick 99 if you like :-).

An other way to find out what VMS thinks about the file is to add a line with:
$WRITE SYS$OUTPUT F$LEN(LINE)
into that DCL procedure loop.

You are (understandibly) not (yet :-) speaking our secret language. By showing us some actual data through $DIRECTORY or $DUMP output we may be able to bridge the gap.

If the solution is in records re-blocking space, then be sure to also check out:
$HELP EXCHANGE /NET

Good luck,
Hein.


Antoniov.
Honored Contributor

Re: Edit/TPU question

Ian,
I'm not sure to get your real intention.
I guess you need to make some conversion so only for talking ...
CR and LF are usually to delimite text line.
Unix use only LF (called new line)
Msdos, Windows and VMS (uppercase are non random ;-O) use CR + LF.
If you want to add CR before LF you have some trouble:
1.You have some difficult to read righ line
2.You you can read line you have to remove LF than add CR + LF
Some tip:
a) you can also define LF variable
$ LF[0,8]=10
b) you can remove any character from string
$ MYLINE = MYLINE - LF

I'm trying to randomly get your intention.

Cheers.
Antonio Vigliotti
Antonio Maria Vigliotti
Ian Derringer
Regular Advisor

Re: Edit/TPU question

Attached, is an brief sample of the file I've been trying to convert.

Thanks,
Ian
Doug Phillips
Trusted Contributor

Re: Edit/TPU question

The attached file is an RTF file created by Mstfedit. I doubt that that is the file you're trying to convert.

Please move over to VMS, go back and read Hein's posts and provide a DUMP and DIR/FULL listing. Also, provide the output file from the following command:

ANA/RMS/FDL/OUT=filename.FDL filename.ext

and I'll bet someone will provide an updated FDL that you can use to convert the file, or a set/file command you can use.

Until we know what the file really looks like in VMS, noone can help you.