Operating System - OpenVMS
1753851 Members
7425 Online
108807 Solutions
New Discussion юеВ

Re: String too long for writing into file

 
RockRock
Occasional Advisor

String too long for writing into file

I would like to prepare a script for writing a string (longer than 256 characters) into a file.
However, the following error is prompted.
Script:
write d_file f$extract(0,256,content)
Error:
"command element is too long - shorten"

Then, I amend the script to use "write/symbol" instead. However, another error is prompted.

Error:
"%DCL-W-PARMDEL, invalid parameter delimiter - check use of special characters
\(0\"


Please help. Thanks.
10 REPLIES 10
Hein van den Heuvel
Honored Contributor

Re: String too long for writing into file



How about:

$ line = f$extract(0,256,content)
$ write/symb d_file line


Enjoy,
Hein.
Jan van den Ende
Honored Contributor

Re: String too long for writing into file

Hein gave the answer.

Why?

Because WRITE/SYMBOL does exactly that:
it writes a symbol.

.. and you asked it to write the outcome of a lexical function.

BTW: VMS version _IS_ of interest here: since some UPDATE (don't remember which) for V7.3-2 the default tokenlength handled, as well as the length handled by /SYMBOL, have been increased 8-fold (thanks again, Guy Peleg!)

hth

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
RockRock
Occasional Advisor

Re: String too long for writing into file

Thank you for your reply. Another error is prompted.

Script:
$ open/read/error=FILE_ERR s_file 'source_file
$ open/read/write/share/error=FILE_ERR d_file 'destn_file
$ !
$ READ_LOOP:
$ read/end_of_file=EOF/error=FILE_ERR s_file content
$ line = f$extract(0,256,content)
$ write/symbol d_file line
...
$ close d_file
$ close s_file
...


Error:
%RMS-F-NEF, not positioned to EOF on $PUT (sequential organization only)

Please help. Thanks.
Jan van den Ende
Honored Contributor

Re: String too long for writing into file

RockRock,

what _IS_ the "organisation" of the 'destn_file'?
Looks like you are trying to insert a record into an existing indexed file without positioning it first.
... But I am probably already assuming to much now.
Please post the output of
DIR/FULL 'destn_file'
(rename the output to .TXT, and attach it, if it has to come out formatted for human reading).

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
RockRock
Occasional Advisor

Re: String too long for writing into file

Thanks. I have amended the open section.
However, concatenation can't be used.


Script:
$ open/read/error=FILE_ERR s_file 'source_file
$ open/write/error=FILE_ERR d_file 'destn_file
$ !
$ read/end_of_file=EOF/error=FILE_ERR s_file content
$ i_content = f$extract(0,535,content)
$ b_content = f$extract(541,98,content)
$ f_content = i_content+"01DEC06"+b_content
$ write/symbol d_file f_content



Error:
%DCL-W-NOCCAT, parameter concatenation not allowed - check use of plus (+)
\F_CONTENT+\


Please help. Thanks.
John Abbott_2
Esteemed Contributor

Re: String too long for writing into file

Lots of choices here... how's about

.
.
$ f_content = f$extract(0,535,content)+"01DEC06"+f$extract(541,98,content)
$ write/symbol d_file f_content
.
.

J.
Don't do what Donny Dont does
RockRock
Occasional Advisor

Re: String too long for writing into file

It works. Thank you very much.
Jan van den Ende
Honored Contributor

Re: String too long for writing into file

RockRock,

for the "Forums way to express thanks" please read
http://forums1.itrc.hp.com/service/forums/helptips.do?#33

Proost.

Have one on me.

jpe

Don't rust yours pelled jacker to fine doll missed aches.
RockRock
Occasional Advisor

Re: String too long for writing into file

The answer has solved my problem completely! Now I'm a happy camper!