Focal Point
FILEDEF

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6311077331

January 30, 2004, 03:58 PM
RB
FILEDEF
Can any one explain me clearly the function of FILEDEF and DYNAMALLOC commands?
January 30, 2004, 08:58 PM
susannah
FILEDEF mastername DISK completepathdata
FILEDEF MYFILE DISK D:\IBI\APPS\MYDATA.FTM
In this case, MYFILE is the name of the master file description, which must be somewhere in the EDAPATH.
MYDATA is a file that is NOT a focus file, in this case, the .FTM extension indicates that it is a foctemp file. It could be .TXT, .csv etc.
This FILEDEF statement allows you to read the
file called MYDATA, wherever it is, using the master file description MYFILE.
Most commonly, the data file and the master file have the same name, especially when you're using focus to create them....
So, to write out a file, that is not focus file
you'll need to do 1 more thing, that is tell focus not only where the data file is to go, but also where you want the master file to go.
so you add
FILEDEF HOLDMAST DIR completepath
FILEDEF HOLDMAST DIR D:\IBI\APPS
will put a master of the same name as the file you create into the D:\ibi\apps directory.
For focus files, you don't use FILEDEF, you use USE statments to read them, but you also can use FILEDEF HOLDMAST when writing focus files to tell focus where to put the master.
USE
d:\ibi\apps\mydata.foc
END
will let you read the focus file (assuming the master is on the edapath)
USE
D:\ibi\apps\mydata.foc new
END
will let you write the focus file, and
FILEDEF HOLDMAST DISK D:\IBI\APPS
will allow the master MYDATA.MAS to be put into the same directory.
I'll let someone else come along and do DYNAM for you.
February 01, 2004, 05:20 PM
GCohen
All of the metadata files, like Master files,
and Access files, and Focexecs, are in special
directory names that are the same on all machines.
This is the APP directory under the root where you located WebFocus. BUT, data may exist anywhere, and the FILEDEF command (general files), and DYNAM, command (MVS), and USE command (Focus files) just tell WebFocus where the data is.
Of course, if the data is in a RDBMS, then its location is already stored in the ACCESS file and you should not have to do anything.
February 02, 2004, 01:55 PM
RB
Hello Susannah and Gerald,

Thank you for explaining me the function of FILEDEF command. I kind of understood what it does. I have a procedure that has FILEDEF command, I am not able to figure how it is working.
For example my code is like this:

FILEDEF PIM DISK /home/mp6312/pim.fex
TABLE FIEL xxx
....

....
ON TABLE HOLD AS HOLD5
end

DEFINE FILE HOLD5
TYPE/A1=DECODE TQDS_CODE(PIM ELSE '$');
END

From my understanding of FILEDEF command PIM is the procedure name and it is stored in a home directory of someone(I know that mp6312 is account for some person).
Then we are using that procedure in DECODE command.
I thought DECODE command should have this format:
DECODE FILE HOLD5
TYPE/A1 = DECODE FIELDNAME(CODE RESULT1 ESLE RESULT2);

I did not understand why they have used IOC here.
How can we know what is stored in IOC?

Any suggestions?
February 02, 2004, 05:57 PM
susannah
your file PIM in this case appears not to be operating as a procedure, but rather as a flat file whose extension happens to be .fex.
the content of the file is most likely two columns of data, looking just like a long DECODE statement. The first column is the entry value corresponding to the values of TQDS_CODE and then there is probably a blank space and then the value that you want to place into the field you call TYPE. This method of using a FILE for your decodes is a cool way of not having to type in all the decode values. See if you can take a look at the PIM file itself, then it will be clear.
September 13, 2006, 09:22 AM
gregson06
I'm still having issues with this topic since I'm trying to create a report that will create one .ftm file or .dat file then in the same program, run another report and append to the previous file.

I am just wondering if there needs to be some sort of rights given since I keep getting a "error opening file" after I've declared my FILEDEF's and ran the program. Again, I'm on Webfocus 5.3.

Thanks!

This message has been edited. Last edited by: gregson06,
September 13, 2006, 10:37 AM
susannah
for appending one flat to another, use
FILEDEF PIM DISK ..whereever it is
TABLE FILE CAR
PRINT *
ON TABLE HOLD AS PIM
END
FILEDEF PIM DISK ...whereever it is (APPEND
TABLE FILE CAR
PRINT *
ON TABLE HOLD AS PIM
END
..and you'll see that the APPEND command , issued after the output file was first populated will just attach the new records to the bottom of the existing record set.
Look up APPEND or FILEDEF APPEND and see what you come up with.

if you're creating your file from scratch( as i seem to think you're saying), then make sure you have write permission to the destination where you're parking this file.
to just park the file inside the agent you're working it,
FILEDEF PIM DISK PIM.TXT
write someting to it.
FILEDEF PIM DISK PIM.TXT (APPEND
write something more to it
now read it
TABLE FILE PIM PRINT *
END
and you'll prove to yourself that you can do it.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID