Chapter Contents

Previous

Next
osddinfo

osddinfo



Use DDname to get Information about a Data Set

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
IMPLEMENTATION
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <os.h>

int osddinfo(char *ddnm, char dsnm[45], char member[9],
             char *recfmp, int *lreclp, int *blksizep);


DESCRIPTION

osddinfo obtains and returns information about the data set referenced by a particular DDname. The first argument, ddnm , is a null-terminated string, specifying the DDname of the data set. The DDname may be in uppercase or lowercase letters, and leading white space is not permitted.

The remaining arguments to osddinfo are pointers that address areas where the data set information is stored. Any of these pointers can be NULL , which causes the corresponding information not to be stored. Because osddinfo obtains only the requested information and some information is time consuming to obtain, you should always pass NULL to osddinfo for any information that you do not need.

The data set name is stored in a 45-character array that is addressed by the argument dsnm . Any trailing blanks are removed from the name. If the DDname is allocated to something other than a disk data set, a null (0-length) string is stored in dsnm .

A PDS member is stored in a 9-character array that is addressed by the argument member . If the DDname does not define a PDS member, a null string is stored.

A number of flags are stored in a single character that is addressed by the argument recfmp ; the flags describe the record format of the file. The symbolic values for these flags can be found in the header file <os.h> :
RECFM_F indicates fixed length records.
RECFM_V indicates variable length records.
RECFM_U indicates undefined length records.
RECFM_D indicates variable length ASCII records.
RECFM_T indicates track overflow.
RECFM_B indicates blocked records.
RECFM_S indicates spanned/standard records.
RECFM_A indicates ANSI defined control characters.
RECFM_M indicates machine control characters.

Note:    You should test for RECFM_U before testing for RECFM_F or RECFM_V because the definition of RECFM_U is  [cautionend]

RECFM_U = RECFM_F | RECFM_V

A 0 is stored in *recfmp if record format information is not available.

The data set's logical-record length is stored in an integer addressed by the argument lreclp . If the logical-record length is not defined or cannot be obtained, 0 is stored. If the data set is defined with LRECL=X , the special value LRECL_X is stored.

The data set's block size is stored in an integer addressed by the argument blksizep . If the block size is not defined or cannot be obtained, 0 is stored.

If a DD statement is defined as an HFS file, the information normally returned by osddinfo does not apply. If the DDname passed to osddinfo references an HFS file, no return information is stored; osddinfo returns the integer 1. You can call oeddinfo for the same DDname to extract information about the HFS file.


RETURN VALUE

osddinfo returns 0 if the DDname is defined, 1 if the DDname references an HFS file, or -1 if it is not defined.


IMPLEMENTATION

Information about the DDname is obtained by using the RDJFCB macro. If necessary, the OBTAIN macro is also used.


EXAMPLE

This example allocates a buffer for an input file. The buffer size should be the lrecl if the file is F or U format, or the lrecl-4 if the file is V format:

#include <os.h>
#include <stdlib.h>

char recfm;
int lrecl;
char *buffer;

   if (osddinfo("SYSIN", NULL, NULL, &  recfm, &  lrecl, NULL) == 0)
      if (lrecl != 0 &  &   lrecl != LRECL_X)
         buffer = malloc(recfm &   RECFM_F? lrecl: lrecl - 4);
.
.
.


RELATED FUNCTIONS

cmsstat , fattr , oeddinfo , osdsinfo , stat


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.