z/OS Distributed File Service zFS Administration
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


List Systems

z/OS Distributed File Service zFS Administration
SC23-6887-00

Purpose

This subcommand call is used to retrieve the system names that are part of the zFS XCF group.

Format

syscall_parmlist
   opcode                  174     CFGOP_LSSYS
   parms[0]                size of buffer
   parms[1]                offset to buffer
   parms[2]                offset to size
   parms[3]                0
   parms[4]                0
   parms[5]                0
   parms[6]                0
buffer                     char[ ]
size                       int

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

Return_code
  E2BIG         Data to return is too large for buffer supplied
  EINTR         ZFS is shutting down
  EMVSERR       Internal error
  ERANGE        No systems to return

Reason_code
  0xEFnnxxx     See z/OS Distributed File Service Messages and Codes

Usage notes

  • Reserved fields and undefined flags must be set to binary zeros.

Privilege required

None.

Related services

  • Query sysplex_state

Restrictions

None.

Examples

#pragma linkage(BPX1PCT, OS)
extern void BPX1PCT(char *, int, int, char *, int *, int *, int *);

#include <stdio.h>

#define ZFSCALL_CONFIG  0x40000006
#define CFGOP_LSSYS                      174    /* List names of systems in the sysplex */

#define E2BIG     145                  /* data to return is too big for buffer */
#define ERANGE      2                  /* there were no systems to return      */

typedef struct system_name_t {
                   char  sys_name[9];  /* 8 byte name, null terminated       */
                } SYSTEM_NAME;

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;

struct parmstruct
{
    syscall_parmlist myparms;
 /*   SYSTEM_NAME  buffer[32];    */          /* output buffer for sysnames */
    int              size;
} myparmstruct;

int main(int argc, char **argv)
{
    int bpxrv;
    int bpxrc;
    int bpxrs;
    int i;

    struct parmstruct *myp = &myparmstruct;
    int mypsize, buflen;

    myparmstruct.myparms.opcode = CFGOP_LSSYS;
    myparmstruct.myparms.parms[0] = 0;                         /* size of buffer   */
    myparmstruct.myparms.parms[1] = 0;                         /* offset to buffer */
    myparmstruct.myparms.parms[2] = sizeof(syscall_parmlist);  /* offset to size (required size) */
    myparmstruct.myparms.parms[3] = 0;
    myparmstruct.myparms.parms[4] = 0;
    myparmstruct.myparms.parms[5] = 0;
    myparmstruct.myparms.parms[6] = 0;

    BPX1PCT("ZFS     ",
            ZFSCALL_CONFIG,           /* Config query operation  */
            sizeof(myparmstruct),     /* Length of Argument      */
            (char *) &myparmstruct,   /* Pointer to Argument     */
            &bpxrv,                   /* Pointer to Return_value */
            &bpxrc,                   /* Pointer to Return_code  */
            &bpxrs);                  /* Pointer to Reason_code  */

    if( bpxrv < 0 )
    {
        if( bpxrc == E2BIG )
        {
            buflen = myparmstruct.size;          /* Get buffer size needed  */
            mypsize = sizeof(syscall_parmlist) + buflen + sizeof(myparmstruct.size);
            myp = (struct parmstruct *) malloc ((long) mypsize);
            memset(myp, 0, mypsize);

            myp->myparms.opcode = CFGOP_LSSYS;
            myp->myparms.parms[0] = buflen;                    /* size of buffer   */
            myp->myparms.parms[1] = sizeof(syscall_parmlist);  /* offset to buffer */
            myp->myparms.parms[2] = sizeof(syscall_parmlist) + buflen;  /* offset to size */
            myp->myparms.parms[3] = 0;
            myp->myparms.parms[4] = 0;
            myp->myparms.parms[5] = 0;
            myp->myparms.parms[6] = 0;

            BPX1PCT("ZFS     ",
                    ZFSCALL_CONFIG,           /* Config query operation  */
                    mypsize,                  /* Length of Argument      */
                    (char *) myp,             /* Pointer to Argument     */
                    &bpxrv,                   /* Pointer to Return_value */
                    &bpxrc,                   /* Pointer to Return_code  */
                    &bpxrs);                  /* Pointer to Reason_code  */
            if( bpxrv == 0 )
            {

                int   j,syscount;
                SYSTEM_NAME *syslist;
                int *sizep;

                sizep=(int *)((int)myp + sizeof(syscall_parmlist) + buflen);

                syslist=(SYSTEM_NAME *)((int)myp + sizeof(syscall_parmlist));
                syscount=(*sizep)/sizeof(SYSTEM_NAME);
                for (j=1; j <= syscount; j++)
                {
                    printf("%-8.8s\n", syslist->sys_name);
                    syslist++;
                }

                free(myp);
            }
            else  /* lssys failed with large enough buffer */
            {
                if( bpxrc == ERANGE )
                {
                    printf("No systems to display\n");
                }
                else
                {
                    printf("Error on lssys with large enough buffer\n");
                    printf("BPXRV = %d BPXRC = %d BPXRS = %x\n",bpxrv,bpxrc,bpxrs);
                }
                free(myp);
                return bpxrc;
            }
        }
        else  /* error was not E2BIG on the original BPX1PCT */
        {
            if( bpxrc == ERANGE )
            {
                printf("No systems to display from original BPX1PCT\n");
            }
            else
            {
                printf("Error on lssys trying to get required size\n");
                printf("BPXRV = %d BPXRC = %d BPXRS = %x\n",bpxrv,bpxrc,bpxrs);
            }
            return bpxrc;
        }
    }
    else /* asking for buffer size gave rv = 0; maybe there is no data */
    {
        if( myparmstruct.size == 0 )
        {
            printf("No data\n");
            printf("BPXRV = %d BPXRC = %d BPXRS = %x\n",bpxrv,bpxrc,bpxrs);
        }
        else   /* No, there was some other problem with getting the size needed */
        {
            printf("Error getting size required\n");
            printf("BPXRV = %d BPXRC = %d BPXRS = %x\n",bpxrv,bpxrc,bpxrs);
        }
    }
    return 0;
}

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014