1752583 Members
5003 Online
108788 Solutions
New Discussion юеВ

Changing file format!

 
SOLVED
Go to solution
The Brit
Honored Contributor

Changing file format!

If I have a sequential text file with attributes

File organization: Sequential
Shelved state: Online
Caching attribute: Writethrough
File attributes: Allocation: 73, Extend: 0, Global buffer count: 0, Version limit: 2, Contiguous best try
Record format: Stream, maximum 0 bytes, longest 0 bytes
Record attributes: Carriage return carriage control

and I want it convert it to

File organization: Sequential
Shelved state: Online
Caching attribute: Writethrough
File attributes: Allocation: 73, Extend: 0, Global buffer count: 0, Version limit: 2
Record format: Variable length, maximum 0 bytes, longest 259 bytes
Record attributes: Carriage return carriage control

i.e. from STREAM to VARIABLE,

What would be the appropriate DCL command??

thanks

Dave.
8 REPLIES 8
Jan van den Ende
Honored Contributor

Re: Changing file format!

Dave,

traditionally,
make an FDL specifying the desired attributes, and
$ convert infile outfile/fdl=fdlfile

Starting at some 7.3-2 patch you can specify the attributes directly on the commandline, but I do not know (and can not at the moment get) the exact incantation.
Probably Hein will jump in for that...

hth

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
The Brit
Honored Contributor

Re: Changing file format!

Hi Jan,
Yes, I also believe there is a magic incantation which will do this. I think is is something like

$ Set file /attrib=RFM:VAR

unfortunately when I tried this (on a copy) it made some strange change. i.e. when I "typed" the file, it displayed nothing, although the file-size said it was not zero-length, and the EDT editor was able to load the file into its buffer, but with record length errors.

I too wait for Hein.

(probably having a late breakfast)

thanks

Dave.
Jim_McKinney
Honored Contributor
Solution

Re: Changing file format!

$ convert/fdl=sys$input infile outfile
record
carriage_control carriage_return
format variable
^Z
Hein van den Heuvel
Honored Contributor

Re: Changing file format!


$Convert/FDL=NL: anything variable-length-record-file.dat

Hein
Jim_McKinney
Honored Contributor

Re: Changing file format!

> $Convert/FDL=NL: anything variable-length-record-file.dat


Slick!
Jan van den Ende
Honored Contributor

Re: Changing file format!

Aaaaai

Dave,

>>>
$Convert/FDL=NL: anything variable-length-record-file.dat
<<<

Please, reopen, and give Hein 10 points!

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
John Gillings
Honored Contributor

Re: Changing file format!

Dave,

>$ Set file /attrib=RFM:VAR

This hacks the RMS attributes switching RFM from STM to VAR. However, it does NOT change the metadata in the file. So the 2 byte record length fields at the beginning of each record, required by VAR format are not present, and the trailing CR-LF record delimiters of STM format are still present. The resulting file is unlikely to make much sense.

The requested change requires a CONVERT which will change each record to the correct format.

Hein's /FDL=NL: relies on the RMS default being VAR. A very neat trick for this specific question, but not for the general case of CONVERTing between formats.

"you can specify the attributes directly on
the commandline"

The /FDL qualifier now accepts either a file specification, or an FDL control string in double quotes. So, anything you did as /FDL=SYS$INPUT can now be in the command line. Just add a semicolon to the end of each line in your input stream and quote the whole string. Thus:

$ CONVERT/FDL="record;carriage_control carriage_return;format variable" infile outfile

RMS engineering accepted this change because it allowed CONVERT to be used in an inline PIPE sequence.

A crucible of informative mistakes
The Brit
Honored Contributor

Re: Changing file format!

As suggested, Hein deserved points for his solution. I also gave 10 to John for the additial explanation.

thanks guys

Dave.