You need to have the record employee
defined before you can do record_info
on it. In the shell use can use rr(FileName).
command which will find all the record definitions in the file and remember them. In a module you would either define the record directly in the module or include a file which contains the record definition.
The reason for having to do this special handling in the shell is that records are purely a compile-time feature so a record definition doesn't really "exist" anywhere.
EDIT:
If you want to define the record directly in shell then you can't use the standard -record(...).
syntax. That is only valid in modules. The shell sees that as a call to the record/2
function. You need to use the rd
shell command. It your case it would become:
3> rd(employee, {emp_no, name, salary, sex, phone, room_no}).
employee
4> record_info(fields, employee).
[emp_no,name,salary,sex,phone,romm_no]
5>
Then record_info
works. If you already have the record definitions in a file then use the shell rr(File).
command instead as it is easier. I think.