About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
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.