Operating System - OpenVMS
1752587 Members
3712 Online
108788 Solutions
New Discussion юеВ

RMS-F-RAT, invalid record attributes

 
Hemani
New Member

RMS-F-RAT, invalid record attributes

Is there any default for record format attribute for text stream files. I am facing the below error in my DCL script.
This is the output after set verify:

$ set noon
$ mode = "append"
$ ftosrch = F$SEARCH("dummy")
$ if (f$search("showbacklog.log") .eqs. "") then mode = "write"
$ open/append fh showbacklog.log
$ define /nolog sys$output fh
├ЬL-E-OPENOUT, error opening FH:.; as output
-RMS-F-RAT, invalid record attributes

A dir/full for showbacklog.log shows:
Created: 23-SEP-2008 06:57:53.13
Revised: 23-SEP-2008 07:29:37.20 (6)
Expires:
Backup:
Effective:
Recording:
File organization: Sequential
Shelved state: Online
Caching attribute: Writethrough
File attributes: Allocation: 35, Extend: 0, Global buffer count: 0, No version limit
Record format: Variable length, maximum 0 bytes, longest 104 bytes
Record attributes: Carriage return carriage control
RMS attributes: None
Journaling enabled: None
File protection: System:RWED, Owner:RWED, Group:RWED, World:RE
Access Cntrl List: None
Client attributes: None

Why is define failing in the above script with a RAT error? Please note that the open command does not specify any attributes.

Thanks
6 REPLIES 6
Willem Grooters
Honored Contributor

Re: RMS-F-RAT, invalid record attributes

fh is already opened, has the give attributes, but SYS$OUTPUT is different.

What are you trying to do?
It looks to me that some next commadn will write to SYS$OUTPUT and you want to add this output to SHOWBACKLOG.LOG.

You'd better do this:

$ DEFINE SYS$OUTPUT
Do whatever writes to SYS$OUTPUT
$ APPEND SHOWBACKLOG.LOG

this however, may cause attribute conflicts, that could cause problems elsewhere. In stead:

$ OPEN/READ IN
$ OPEN/'mode' FH showbacklog.log
$Loop:
$ READ/END=LoopEnd IN line
$ WRITE FH Line
$ GOTO Loop
$LoopEnd:
$ CLOSE FH
$ CLOSE IN

If you intend to use SEARCH a particular sttring in files, use the /OUTPUT quailfier and question $STATUS after search (and use additional qualifiers to control what's presented).
If you intend to scan a directory for files, it's feasable to scan the directory using F$SEARCH, process the filename and write it directly to your logfile. Processing DIR output is far more troublesome :)

BTW:

$ IF F$SEARCH("showbacklog.log") .EQS. "" THEN CREATE showbacklog.log
$

would eliminate the differrence in open mode. APPEND would do in all cases ;)
Willem Grooters
OpenVMS Developer & System Manager
Hemani
New Member

Re: RMS-F-RAT, invalid record attributes

Thanks for your response. How is sys$output different?

Yes the next commands will directed their output to sys$output, which I want to be logged in the file. And this script will be called again and again and hence I opted for an append there.

I am trying to use f$search to check if the file exists. If not the script shoudl create it.

BTW:

$ IF F$SEARCH("showbacklog.log") .EQS. "" THEN CREATE showbacklog.log
$

would eliminate the differrence in open mode. APPEND would do in all cases ;)

Please explain the above statement. Please note that the append in the open command above is due to set verify being on.

Please find attached the test script. Teh first part works fine, and the second part gives error

Willem Grooters
Honored Contributor

Re: RMS-F-RAT, invalid record attributes

Sys$output, as well as SYS$INPUT, SYS$COMMAND and SYS$ERROR are logicals that cabn refer to a file or a device. This concept is basic stuff - I suggest you read the VMS user guide and DCL manuals (available online).

About your script: Why write to SYS$OUTPUT where you can do that directly to the file? Open the file in this created script, and write to it:

$ if f$search("") .eqs. "" then create
$ open/append FH
$....
$ write FH
$ close FH

No need to refedine SYS$OUTPUT.

On my suggestion:

F$SEARCH will return an empty string if the given file does not exist. In that case, CREATE will do what it says it does: It creates a file. The next line starts with "$" and that actually is "exit" for the Create command. This way, and empty file is created. Now all you need to do is to open/append - and that will succeed because the files exists (the only requirement....)
Willem Grooters
OpenVMS Developer & System Manager
Willem Grooters
Honored Contributor

Re: RMS-F-RAT, invalid record attributes

The second may fail if the outputfile alraedy exists with attributes incompatible for logging.
But as stated in the previous entry, you don't need to redefine at all.
Willem Grooters
OpenVMS Developer & System Manager
Hemani
New Member

Re: RMS-F-RAT, invalid record attributes

Thank you for your response and time. I need to redefine sys$output as there is another command(proprietary software) , which I did not mention in the script. This command will write the output to sys$output.
Hoff
Honored Contributor

Re: RMS-F-RAT, invalid record attributes

Redefining SYS$OUTPUT is mildly hairy stuff; it doesn't work (as you've discovered) how you want. If you're used to Unix and how well Unix does pipes and such, it'll be frustrating on OpenVMS -- at best.

Please post up details on what you haven't told us yet around this mysterious secret proprietary image, and particularly around how you have redirected the I/O. It might be as simple as swapping the DEFINE for a a DEFINE /USER, but that really depends on what's (actually) going on here with this DCL; that remains to be seen.

(I can think of one product that does this sort of thing, and it's a disaster because of it. Best to get this done right.)