Appendix C. DCB Handling API

Table of Contents

C.1. Overview
C.2. Allocation Handle
C.2.1. tdcb_get_handle()
C.2.2. tdcb_discard_handle()
C.2.3. tdcb_print_info()
C.3. DCB Information
C.3.1. tdcb_get_type()
C.3.2. tdcb_maxlrecl()
C.3.3. tdcb_nvsm_info()
C.4. Get Attributes
C.4.1. tdcb_get_dsname()
C.4.2. tdcb_get_volser()
C.4.3. tdcb_get_flags()
C.4.4. tdcb_get_blksize()
C.4.5. tdcb_get_key_info()
C.4.6. tdcb_get_vsamtype()
C.5. Set Attributes
C.5.1. tdcb_set_lrecl()
C.5.2. tdcb_set_recfm()
C.5.3. tdcb_set_blksize()
C.5.4. tdcb_set_keylen()
C.6. Dynamic Allocation
C.6.1. tdcb_allocate()
C.6.2. tdcb_concatenate()
C.6.3. tdcb_unallocate()

This appendix describes the DCB Handling API methods used to output or modify attributes of DDs allocated in JCL.

You can use the DCB Handling API provided with OpenFrame to search for or modify attribute information about allocated DDs in JCL and execute dynamic allocation in applications.

To write a program using the DCB Handling API, you must include the tdch.h header file, which is distributed with the OpenFrame binary, in the user program, and link the libtdcb.so library during compilation.

The Tmax DCB Handling API can be classified as follows:

Retrieves the DSORG and RECFM attributes of the non-VSAM data set from the allocation information, which was returned by the tdcb_get_handle() API.

The DSORG attribute of non-VSAM data sets specifies the organization of the data set. Available values for DSORG are as follows:

DSORGDescription

PS(Physical Sequential)

SAM data set.

IS(Indexed Sequential)

ISAM data set.

PO(Partitioned)

PDS or PDSE.

DA(Direct)

DAM data set.

The RECFM attribute of non-VSAM data sets specifies the format or characteristic of the record. Available values for RECFM are as follows:

RECFMDescription

F

Fixed-length record

V

Variable-length record

L

Line sequential record

U

Undefined record

B

Block unit I/O

A

ANSI control character included

For example, if a data set supports fixed-length records and I/O in units of blocks, its RECFM attribute is specified as RECFM=FB. And if a data set is made of variable length records and includes ANSI control characters, its RECFM attribute is specified as RECFM=VA.

For sequentially concatenated non-VSAM data sets, the first data set's DSORG and RECFM attributes are returned. (In principle, mainframe does not allow sequential concatenation between non-VSAM data sets that have different basic attributes.)

For VSAM data sets, depending on the length type, DSORG=PS and RECFM=FB are returned for fixed length records and DSORG=PS and RECFM=VB for variable length records.

To retrieve the DSORG attribute from the allocation information, a string buffer pointer of 8 bytes or more in size must be specified as the 'dsorg' parameter. To retrieve the RECFM attribute, a string buffer pointer of eight bytes or more in size must be specified in the 'recfm' parameter. If a user string buffer is specified, the DSORG and RECFM attributes are copied to the user buffer with a NULL terminating character.

  • Prototype

    int tdcb_nvsm_info(int handle, char *dsorg, char *recfm);
  • Parameters

    ParameterDescription

    handle (IN)

    Allocation handle returned by the tdcb_get_handle() API.

    dsorg (OUT)

    Buffer to store the DSORG attribute of the given allocation information.

    recfm (OUT)

    Buffer to store the RECFM attribute of the given allocation information.

  • Return Value

    If successful, 0 is returned. If an error occurs, -1 is returned with an error message. An error code is displayed in the message as needed.

Retrieves various miscellaneous attributes or flags of a DCB component from the allocation information returned by the tdcb_get_handle() API. The DCB component represents a data set in the allocation information of sequentially concatenated non-VSAM data sets, or a base cluster or an alternate index in the VSAM allocation information.

The DCB component's various miscellaneous attributes represent the following macros defined in the tdcb.h header file:

#define TDCB_LRECL_NOT_SET              0x01
#define TDCB_RECFM_NOT_SET              0x04
#define TDCB_BLKSIZE_NOT_SET            0x08
#define TDCB_KEYLEN_NOT_SET             0x40
#define TDCB_IS_TAPE_DATASET            0x10
#define TDCB_IS_OPEN_INDICATOR          0x20

Descriptions for each macro are as follows:

MacroDescription

TDCB_LRECL_NOT_SET

Logical record length of a data set is not set in a catalog or JCL.

TDCB_RECFM_NOT_SET

RECFM attribute of a data set is not set in a catalog or JCL.

TDCB_BLKSIZE_NOT_SET

Block size of a data set is not set in a catalog or JCL.

TDCB_KEYLEN_NOT_SET

Key length of a data set is not set in a catalog or JCL.

TDCB_IS_TAPE_DATASET

A data set that is allocated to the tape volume device.

TDCB_IS_OPEN_INDICATOR

The OPEN API has not yet been called in an application program.

  • Prototype

    tdcb_get_flags(int handle, int index, int *flags);
  • Parameters

    ParameterDescription

    handle (IN)

    Allocation handle returned by the tdcb_get_handle() API.

    index (IN)

    Sequence number of a sequential concatenation or the specified number of a base cluster or alternate index.

    flags (OUT)

    Buffer to store the miscellaneous attributes of the DCB component.

  • Return Value

    If successful, 0 is returned. If an error occurs, -1 is returned with an error message. An error code is displayed in the message as needed.

Retrieves the VSAM data set type and AIX attribute of a VSAM DCB component from the allocation information returned by the tdcb_get_handle() API. The DCB component represents a data set in the allocation information of sequentially concatenated non-VSAM data sets, or a base cluster or an alternate index in the VSAM allocation information.

The following macros are defined for VSAM data set types in the tdcb.h header file:

#define TDCB_VSAM_TYPE_ESDS             0x01    /* ESDS */
#define TDCB_VSAM_TYPE_KSDS             0x02    /* KSDS */
#define TDCB_VSAM_TYPE_RRDS             0x04    /* RRDS */
#define TDCB_VSAM_TYPE_VRDS             0x05    /* VRDS */

The following macros are defined for the AIX attribute in the tdcb.h header file.

#define TDCB_RGATTR_EAIX                0x01
#define TDCB_RGATTR_KAIX                0x02
#define TDCB_RGATTR_UPGRADE             0x04

Descriptions for each macro are as follows:

MacroDescription

TDCB_RGATTR_EAIX

The VSAM DCB component is an alternate index of ESDS.

TDCB_RGATTR_KAIX

The VSAM DCB component is an alternate index of KSDS.

TDCB_RGATTR_UPGRADE

The alternate index component has the UPGRADE attribute.

  • Prototype

    int tdcb_get_vsamtype(int handle, int index, int *vsamtype, int *rgattr);
  • Parameters

    ParameterDescription

    handle (IN)

    Allocation handle returned by the tdcb_get_handle() API.

    index (IN)

    Sequence number of a sequential concatenation or the specified number of base cluster or alternate index.

    vsamtype (OUT)

    Buffer to store the VSAM data set type of the VSAM DCB component.

    rgattr (OUT)

    Buffer to store the AIX attribute of the VSAM DCB component.

  • Return Value

    If successful, 0 is returned. If an error occurs, -1 is returned with an error message. An error code is displayed in the message as needed.

Allows an application to execute dynamic allocation on a data set, which is not defined through JCL, to access the data set.

Once dynamic allocation is executed on a data set using tdcb_allocate(), OPEN and I/O can be performed on the data set.

  • Prototype

    int tdcb_allocate(char *ddname, char *ddparam, int flags);
  • Parameters

    ParameterDescription

    ddname (IN)

    DD name.

    ddparam (IN)

    DD attributes specified as a string.

    Each attribute is delimited by a comma (,).

    • DSNAME: data set name. (Example: DSNAME=ABC)

    • DISP: disposition status and DISP for normal and abnormal termination. (Example: DISP=(NEW,CATLG))

    • DATACLAS: data set DATACLAS. (Example: DATACLAS=ACLS)

    • MGMTCLAS: data set MGMTCLAS.

    • STORCLAS: data set STORCLAS.

    • VOL=SER: volume serial information. (Example: VOL=SER=DEFVOL)

    • SPACE: SPACE attribute. (Example: SPACE=(CYL,(1,1),RLSE))

    • DSORG: DSORG attribute. (Example: DSORG=PS)

    • RECFM: RECFM attribute.

    • BLKSIZE: BLKSIZE attribute. (Example: BLKSIZE=4096)

    • LRECL: LRECL attribute.

    • KEYLEN: KEYLEN attribute.

    • KEYOFF: KEYOFF attribute.

    • DCB: DCB attribute. (Example: DCB=(RECFM=FB,LRECL=80))

    flags (IN)

    Option for allocation.

    • TDCB_ALLOCATE_DEFAULT: default value.

    • TDCB_ALLOCATE_NOLOCK: does not use a lock.

    • TDCB_ALLOCATE_NOACHK: does not check permission.

    • TDCB_ALLOCATE_TEMPORARY: specifies a temporary data set.

    • TDCB_ALLOCATE_DISPACHK: checks permission for disposition before allocation.

    • TDCB_ALLOCATE_UNNAMED_TAPE: specifies a tape data set without a name.

  • Return Value

    If allocation is successful, the allocation handle is returned. If an error occurs, the function that caused the error is output as a message, and a negative OpenFrame error code is returned. To check the error code, use the oferror command.