OpenExtensions for z/VM "Q"s and "A"s
Question: Can I use a ddname for an HFS file in an application?
Answer: Instead of using data set names or pathnames in an application, you can use a ddname; then with a FILEDEF command you associate a specific file with that ddname.
You have a choice of two methods for accessing data sets and files in an application:
- The OPEN macro
- The fopen() function
The OPEN Macro
The OPEN macro can open a BFS file pointed to by a PATHDEF statement.
The fopen() Function
The fopen() function recognizes and handles the difference between a ddname associated with a record file or a byte file. For example:
fopen("dd:FRED", "r+")takes the ddname FRED, determines if FRED refers to a ddname for a CMS record file, a FILEDEF, or a byte file, and opens it. Once a file is opened, fread() and fwrite() can access the data.
For more questions and answers, go to our archive of questions and answers.