Using Data Window Services (DWS)

Data Window Services (DWS) is part of the CSL (Callable Services Library). DWS gives your C or C++ program the ability to manipulate data objects (temporary data objects known as TEMPSPACE, and VSAM linear data sets).

Notes:
  1. XPLINK is not supported with DWS.
  2. AMODE 64 applications are not supported with DWS.

To use DWS functions with C code, you do not have to specify a linkage pragma or add any specialized code. Code the DWS function call directly inside your z/OS® XL C program just as you would a call to a C or C++ library function and then link-edit the DWS module containing the function you want (such as CSRIDAC, CSRVIEW, CSRSCOT, CSRSAVE or CSRREFR) with your C or C++ program.

To use DWS functions with C++ code, you must specify C linkage for any DWS function that you use. For example, if you wished to use CSRIDAC, you would use a code fragment as shown in Figure 1.

Figure 1. Example using DWS and C++
/* this example shows how DWS may be used with C++ */
#include <stdlib.h>

extern "C" {
  void csridac( char*, char*, char*, char*, char*,
                char*, long int*, char*, long int*,
                long int*, long int*);
}

int main(void)
{
  /* Set up the parameters that will be used by CSRIDAC.  */

  char op_type[6]      = "BEGIN";
  char object_type[10]  = "TEMPSPACE";
  char object_name[45] = "DWS.FILE ";
  char scroll_area[4] = "YES";
  char object_state[4] = "NEW";
  char access_mode[7]  = "UPDATE";
  long int object_size = 8;
  char object_id[9];
  long int high_offset, return_code, reason_code;

  /* Access a DWS TEMPSPACE data object.                  */

  csridac(op_type, object_type, object_name, scroll_area, object_state,
          access_mode,OBJECT_size,object_id,&high_offset,
          &return_code,&reason_code);

/* INSERT ADDITIONAL CODE HERE */
}

At link-edit time, you should link-edit the DWS module containing the function you want, just as you would for a C program.

In DWS, the data types of the parameters are specified differently from z/OS XL C/C++ data types. When invoking DWS functions from your C or C++ program, you must specify: For more information on DWS, see z/OS MVS Programming: Callable Services for High-Level Languages.

As another example, Figure 2 is an excerpt from a C program (CCNGDW1) that shows parameter declarations for the DWS CSRIDAC function and the function call.

Figure 2. z/OS XL C/C++ Using Data Window Services
/* this example shows how DWS may be used with C */

int main(void)
{
  /* Set up the parameters that will be used by CSRIDAC.  */

  char op_type[5]      = "BEGIN";
  char object_type[9]  = "TEMPSPACE";
  char object_name[45] = "DWS.FILE ";
  char scroll_area[3]  = "YES";
  char object_state[3] = "NEW";
  char access_mode[6]  = "UPDATE";
  long int object_size = 8;
  char object_id[8];
  long int high_offset, return_code, reason_code;

  /* Access a DWS TEMPSPACE data object.                  */

  csridac(op_type, object_type, object_name, scroll_area, object_state,
          access_mode,OBJECT_size,OBJECT_id,&high_offset,
          &return_code,&reason_code);
/* INSERT ADDITIONAL CODE HERE */

  return 0;
}