Define Aggregate

Purpose

An aggregate operation that defines (creates) a VSAM linear data set, which can then be formatted as a zFS aggregate.

Format

syscall_parmlist
   opcode                  int            139       AGOP_DEFINE_PARMDATA
   parms[0]                int            Offset to AGGR_DEFINE
   parms[1]                int            Size of Buffer
   parms[2]                int            Offset to Buffer
   parms[3]                int            Offset to system name (optional)
   parms[4]                int            0
   parms[5]                int            0
   parms[6]                int            0
AGGR_DEFINE
   eye                     char[4]        "AGDF"
   len                     short          sizeof(AGGR_DEFINE)
   ver                     char           1
   aggrName                char[45]       Name of aggregate dataset to create
   dataClass               char[9]        Name of a data class
   managementClass         char[9]        Name of a management class
   storageClass            char[9]        Name of a storage class
   model                   char[45]       Name of a model
   modelCatalog            char[45]       Name of a model catalog
   catalog                 char[45]       Name of a catalog
   volumes[59]             char[7]        Null terminated list of VOLSERs
   reservedChars1          char           Reserved
   numVolumes              int            Number of volumes to use
   spaceUnit               int            Units space is allocated in
   spacePrimary            unsigned int   Primary allocation
   spaceSecondary          unsigned int   Secondary allocation
   reservedIntsl           int[32]        Reserved space for future use
systemname                 char[9]        System name where DEFINE should run

Return_value    0 if request is successful, -1 if it is not successful

Return_code
  EINTR         ZFS is shutting down
  EINVAL        Invalid parameters
  EMVSERR       Internal error using an osi service
  ENOENT        Aggregate is not attached
  EPERM         Permission denied to perform request
Reason_code
  0xEFnnxxxx    See z/OS Distributed File Service Messages and Codes

Usage notes

  • Reserved fields and undefined flags must be set to binary zeros.
  • Start of changeOutput buffer is space for IDCAMS to return error messages.End of change

Privilege required

The issuer must have sufficient authority to create the VSAM linear data set.

Related services

  • Format Aggregate

Restrictions

The VSAM linear data set to be defined cannot already exist.

Examples

Start of change
#pragma linkage(BPX1PCT, OS)
#pragma LANGLVL(EXTENDED)

extern void BPX1PCT(char *, int, int, char *, int *, int *, int *);

#include <stdio.h>

#define ZFSCALL_AGGR 0x40000005
#define AGOP_DEFINE_PARMDATA 139

typedef struct syscall_parmlist_t {
    int          opcode;        /* Operation code to perform */
    int          parms[7];      /* Specific to type of operation, */
                                /* provides access to the parms */
                                /* parms[4]-parms[6] are currently unused*/
} syscall_parmlist;

#define ZFS_MAX_AGGRNAME 44
#define ZFS_MAX_SMSID 8
#define ZFS_MAX_VOLID 6

typedef struct aggr_define_t {
    char         eye[4];                /* Eye catcher */
#define          ADEF_EYE "AGDF"
    short        len;                   /* Length of this structure */
    char         ver;                   /* Version */
#define          ADEF_VER_INITIAL 1     /* Initial version */
    char         aggrName[ZFS_MAX_AGGRNAME+1];
    char         dataClass[ZFS_MAX_SMSID+1];
    char         managementClass[ZFS_MAX_SMSID+1];
    char         storageClass[ZFS_MAX_SMSID+1];
    char         model[ZFS_MAX_AGGRNAME+1];
    char         modelCatalog[ZFS_MAX_AGGRNAME+1];
    char         catalog[ZFS_MAX_AGGRNAME+1];
    char         volumes[59][ZFS_MAX_VOLID+1];
    char         reservedChars1;
    int          numVolumes;
    int          spaceUnit;
#define          ZFS_SPACE_CYLS 1
#define          ZFS_SPACE_KILO 2
#define          ZFS_SPACE_MEGA 3
#define          ZFS_SPACE_RECS 4
#define          ZFS_SPACE_TRKS 5
    unsigned int spacePrimary;
    unsigned int spaceSecondary;
    int          reservedInts1[32];
} AGGR_DEFINE;

struct parmstruct {
    syscall_parmlist myparms;
    AGGR_DEFINE      aggdef;
    char             Buffer[1024];
    char             systemname[9];
};

int main(int argc, char **argv) 
{
    int  bpxrv;
    int  bpxrc;
    int  bpxrs;
    char aggrname[45] = "PLEX.DCEIMGQX.LDS"; /* aggregate name to define */
    char dataclass[9]        = "";
    char managementclass[9]  = "";
    char storageclass[9]     = "";
    char model[45]           = "";
    char modelcatalog[45]    = "";
    char catalog[45]         = "";
    char volumes[7]          = "CFC000";

    struct parmstruct myparmstruct;
    AGGR_DEFINE       *agp            = &(myparmstruct.aggdef);
    char              *bufp           = &(myparmstruct.Buffer[0]);

    /* This next field should only be set if parms[3] is non-zero */
    /* strcpy(myparmstruct.systemname,"DCEIMGVN"); */ 
    /* set system to run define on */
    myparmstruct.myparms.opcode = AGOP_DEFINE_PARMDATA;
    myparmstruct.myparms.parms[0] = sizeof(syscall_parmlist);
    myparmstruct.myparms.parms[1] = sizeof(myparmstruct.Buffer);
    myparmstruct.myparms.parms[2] = myparmstruct.myparms.parms[0] + 
                                    sizeof(AGGR_DEFINE); /* offset to Buffer */
    myparmstruct.myparms.parms[3] = 0;

    /* Only specify a non-zero offset for the next field (parms[3]) if */
    /* you are running z/OS 1.7 and above, and */
    /* you want the define to run on a different system than this one */
    /* myparmstruct.myparms.parms[3] = */
    /* myparmstruct.myparms.parms[0] + sizeof(AGGR_DEFINE)+ */
    /* sizeof(myparmstruct.Buffer); */

    myparmstruct.myparms.parms[4] = 0;
    myparmstruct.myparms.parms[5] = 0;
    myparmstruct.myparms.parms[6] = 0;
    memset(agp, 0, sizeof(*agp));
    strcpy(agp->eye, ADEF_EYE);

    agp->ver = ADEF_VER_INITIAL;
    agp->len = sizeof(AGGR_DEFINE);

    memset(bufp, 0, sizeof(myparmstruct.Buffer));
    strcpy(agp->aggrName, aggrname);
    strcpy(agp->model, model); /* If included next 4 can be null */
    strcpy(agp->dataClass, dataclass);
    strcpy(agp->managementClass, managementclass);
    strcpy(agp->storageClass, storageclass);
    strcpy(agp->modelCatalog, modelcatalog);
    strcpy(agp->volumes[0], (char *)volumes);

    agp->numVolumes = 1;
    agp->spaceUnit = ZFS_SPACE_CYLS;
    agp->spacePrimary = 10;
    agp->spaceSecondary = 1;

    BPX1PCT("ZFS     ",
            ZFSCALL_AGGR,
            sizeof(myparmstruct),
            (char *)&myparmstruct,
            &bpxrv,
            &bpxrc,
            &bpxrs);

    if (bpxrv < 0) 
    {
        printf("define: Error defining LDS %s\n", aggrname);
        printf("define: BPXRV = %d BPXRC = %d BPXRS = %x\n", 
               bpxrv, bpxrc, bpxrs);
        printf("define: job output:\n\n%s\n", myparmstruct.Buffer);
        return bpxrc;
    } 
    else 
        printf("define: LDS %s defined successfully\n", aggrname);
    return 0;
}
End of change