NetView for z/OS, Version 5.4
A pointer variable is a 4-byte pointer field containing an address. All HLL service routines require one pointer variable called Hlbptr. NetView® calculates the value of Hlbptr and passes it to the HLL command processor or installation exit. When Hlbptr is received as an initial parameter, do not assign a value to Hlbptr. This is the only parameter of this type that you do not have to assign.
If an HLL service routine is expecting an address in a pointer field, you are responsible for assigning a value to that pointer field before invoking the HLL service routine. For C, use the & (address) operator when passing pointer variables to HLL service routines rather than creating a separate pointer variable for this purpose. This ensures that the pointer variable is assigned a value before invoking the HLL service routine.
Figure 43 shows an example of using pointer variables in C. Some of the steps are explained in more detail following the figure.
1 #define VARTOVAR "VARTOVAR" /* VARTOVAR constant */ 2 Dsihlb *Hlbptr; /* HLB pointer MUST BE DEFINED */ 3 Dsivarch *srcptr; /* Pointer to source buffer */ Dsivarch *dstptr; /* Pointer to destination buffer */ int dstlen; /* Length of destination buffer */ Dsivarch srcbuf; /* Source buffer */ Dsivarch dstbuf; /* Destination buffer */ 4 srcptr = &srcbuf; /* Address of source buffer */ dstptr = &dstbuf; /* Address of destination buffer */ dstlen = 255; 5 Cnmcpys(srcptr,dstptr,dstlen,VARTOVAR); /* Copy buffer */
The descriptions for the steps shown in Figure 43 are:
Using the & (address) operator in C eliminates the need to define pointer variables. Note the use of a string constant instead of the VARTOVAR constant in this example:
Cnmcpys(&srcbuf,&dstbuf,dstlen,"VARTOVAR"); /* Copy buffer */
[ Top of Page | Previous Page | Next Page | Contents ]