oeddinfo -- Use DDname to get Information about an HFS File

SYNOPSIS

 #include <os.h>

 int oeddinfo(const char *ddnm, char path[256], unsigned *opts,
              unsigned *mode, unsigned short *disp);
 

DESCRIPTION

Under OpenEdition, oeddinfo returns information about a DD statement that has been allocated to an HFS file. ddnm is a null-terminated string that specifies the DDname. The DDname may be in either uppercase or lowercase letters. Leading white space is not permitted.

The remaining arguments are pointers that address areas in which information about the allocation is stored. Any of these pointers can be NULL, in which case the corresponding information is not stored.

path is an area in which oeddinfo stores the HFS pathname referenced by the DD statement. Names referenced by a DD statement have a limit of 256 characters.

opts is a pointer to an area where the information specified by PATHOPTS in the DD statement is stored. If you did not specify PATHOPTS, a value of 0 is stored. Each PATHOPTS keyword corresponds to an open option defined in <fcntl.h>. For example, the PATHOPTS keyword OAPPEND corresponds to the O_APPEND open option in <fcntl.h>. The PATHOPTS value stored by oeddinfo is the sum of the corresponding open flags. The following code tests to see if the PATHOPTS keyword OAPPEND was specified:

 (pathopts & O_APPEND) == O_APPEND
 
Here, &pathopts was passed as the third argument to oeddinfo. To test for ORDONLY, OWRONLY or ORDWR, use the mask value O_ACCMODE. The following code tests for ORDONLY:
 (pathopts & O_ACCMODE) == O_RDONLY
 

mode is a pointer to an unsigned int where information about the PATHMODE specification on the DD statement is stored. If you did not specify PATHMODE, 0 is stored. Each PATHMODE keyword corresponds to an access mode defined in <sys/stat.h>. For example, the PATHMODE keyword SIXOTH corresponds to the S_IXOTH access mode. The PATHMODE value stored by oeddinfo is the inclusive or of the corresponding access mode bits. The following code determines if the PATHMODE keyword SIXOTH was specified:

 (pathmode & S_IXOTH) == S_IXOTH
 
Here, &pathmode was passed as the fourth argument to oeddinfo. Some access modes, such as S_IRWXO, are combinations of other modes; code tests for these modes carefully.

disp is a pointer addressing an unsigned short where information about the PATHDISP specification on the DD statement is stored. If you did not specify PATHDISP, 0 is stored. The following flags are defined in <os.h> for use in testing the value stored:

NDISP_KEEP
keeps the HFS file after normal termination.
NDISP_DELETE
deletes the HFS file after normal termination.
ADISP_KEEP
keeps the HFS file after ABEND.
ADISP_DELETE
deletes the HFS file after ABEND.

RETURN VALUE

oeddinfo returns 0 if the DDname is defined and references an HFS file. It returns 1 if the DDname is defined but does not reference an HFS file, in which case no information is stored in any of the arguments. oeddinfo returns - 1 if the DDname is not defined, or if an error occurs accessing the DD statement.

PORTABILITY

oeddinfo is implemented only under OpenEdition.

IMPLEMENTATION

Information about the DDname is obtained by using the information retrieval function of SVC 99.

RELATED FUNCTIONS

osddinfo, stat

SEE ALSO

File Management Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.