z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


C socket API: Reentrant modules

z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
SC27-3660-00

The following lines describe the additions that you must make to the compile step of your cataloged procedure to compile a reentrant module. Cataloged procedures are included in the IBM-supplied samples for your MVS™ system.
Note: Compile all C source code using the def(MVS) preprocessor symbol.
Be sure to use the RENT compiler option if your code is reentrant.
  • Add the following line as the first //SYSLIB DD statement:
    //SYSLIB DD  DSN=SEZACMAC,DISP=SHR
  • Add the following //USERLIB DD statement:
    //USERLIB DD  DSN=USER.MYPROG.H,DISP=SHR

The following lines describe the additions that you must make to the prelink-edit and link-edit steps of your cataloged procedure to create a reentrant module.

To prelink programs that use the C sockets library function, put the following statement first in the SYSLIB concatenation:
//SYSLIB DD DSN=SEZARNT1,DISP=SHR
Guideline: The system administrator should have followed the instructions for program reentrancy in the z/OS XL C/C++ Programming Guide topic that contains information related to restrictions for using MVS TCP/IP API with z/OS® UNIX.
To link-edit programs that have the C sockets library function, the following statement must be first in the SYSLIB concatenation:
//SYSLIB DD DSN=SEZACMTX,DISP=SHR
Notes:
  1. If Language Environment® libraries are concatenated ahead of SEZACMTX, socket errors can occur because the link-edit uses the Language Environment z/OS UNIX socket library, not the TCP/IP library.
  2. For more information about compiling and linking, see z/OS XL C/C++ Compiler and Runtime Migration Guide for the Application Programmer.

Figure 1 shows sample JCL to be used when compiling a test program with reentrancy. Modify the lines to conform to the naming conventions of your site:

Figure 1. Sample JCL for compiling reentrant modules
//********************************************************************
//*                                                                  *
//*  SAMPLE JCL THAT COMPILES A TEST PROGRAM, CTEST, AS 'RENT',      *
//*       USING THE C/C++ COMPILER C/MVS                             *
//*                                                                  *
//********************************************************************
//*
//CPPC PROC CREGSIZ='4M',
//   INFILE=CTEST,
//   CPARM1=RENT,
//   CPARM2='LIS,SO,EXP,OPT,DEF(MVS),SHOWINC',
//   DCB80='(RECFM=FB,LRECL=80,BLKSIZE=3200)',
//   DCB3200='(RECFM=FB,LRECL=3200,BLKSIZE=12800)',
//   LIBPRFX1='CEEL.OSV2R7',
//   LIBPRFX2='CEE.OSV2R7',
//   COMPRFX='CBC.OSV2R7'
//*
//*----------------------------------------------------
//*  COMPILE STEP:
//*----------------------------------------------------
//COMPILE EXEC PGM=CCNDRVR,PARM=(,
//   '&CPARM1','&CPARM2'),REGION=&CREGSIZ
//STEPLIB  DD  DSNAME=&LIBPRFX1..SCEERUN,DISP=SHR
//         DD  DSNAME=&COMPRFX..SCBCCMP,DISP=SHR
//SYSMSGS  DD  DUMMY,DSNAME=&COMPRFX..SCBC3MSG(EDCMSGE),DISP=SHR
//SYSIN    DD  DSNAME=USER71.TEST.SRC(&INFILE),DISP=SHR


//         DD DSN=&LIBPRFX2..SCEEH.H,DISP=SHR
//SYSLIN   DD  DSNAME=USER71.TEST.RENTDS,DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSCPRT  DD  SYSOUT=*
//SYSUT1   DD  UNIT=VIO,SPACE=(32000,(30,30)),DCB=&DCB80
//SYSUT5   DD  UNIT=VIO,SPACE=(32000,(30,30)),DCB=&DCB3200
//SYSUT6   DD  UNIT=VIO,SPACE=(32000,(30,30)),DCB=&DCB3200
//SYSUT7   DD  UNIT=VIO,SPACE=(32000,(30,30)),DCB=&DCB3200
//SYSUT8   DD  UNIT=VIO,SPACE=(32000,(30,30)),DCB=&DCB3200
//SYSUT9   DD  UNIT=VIO,SPACE=(32000,(30,30)),
//             DCB=(RECFM=VB,LRECL=137,BLKSIZE=882)
//SYSUT10  DD  SYSOUT=*
//*
//    PEND
//    EXEC PROC=CPPC

Figure 2 shows sample JCL to be used when prelinking and linking a reentrant program using the C socket library. Modify the lines to conform to the naming conventions of your site:

Figure 2. Sample JCL for prelinking and linking reentrant modules
//********************************************************************
//*
//*   PRE-LINK AND LINK FOR REENTRANCY WITH C/C++ COMPILER,
//*        z/OS RUNTIME LIBRARY.
//*   NOTES:
//*    - SPECIFY 'RENT' ON LINK STEP
//*    - RENTDS WAS PREVIOUSLY COMPILED WITH 'RENT'
//*    - THE MEMBER @@DC370$ CAN BE USED TO BRING IN ALL C SOCKET
//*      MEMBERS. THIS IS EASIER THAN SPECIFYING ALL THE INDIVIDUAL
//*      MEMBER INCLUDES.
//*    - TCP.SEZARNT1 IS THE REENTRANT C SOCKET LIBRARY.
//*      IT IS USED ON THE PRE-LINK STEP.
//*    - TCP.SEZACMTX IS THE GENERIC SOCKET LIBRARY.
//*      IT IS USED ON THE LINK STEP TO RESOLVE OTHER C SOCKET
//*      MODULES THAT DO NOT EXIST IN TCP.SEZARNT1.
//*    - THE PRE-LINK REQUIRES THE 'UPCASE' PARM SO THAT THE
//*      OTHER MODULES FROM SEZACMTX (WHICH ARE KNOWN BY
//*      THEIR UPPERCASE NAMES) CAN BE FOUND.
//********************************************************************
//*
//*---------------------------------------------------------
//*     MODIFY THE FOLLOWING LINES TO CONFORM TO THE
//*     NAMING CONVENTIONS AT YOUR SITE.
//*---------------------------------------------------------
//RENTTEST PROC MYHLQ='USER71.TEST',
//   LIBPRFX1='CEE',
//   LIBPRFX2='CEE'
//*-------------------------------------------------------------
//* PRE-LINKEDIT STEP:
//*-------------------------------------------------------------
//PLKED   EXEC PGM=EDCPRLK,
//    REGION=2048K,PARM='UPCASE'
//STEPLIB  DD  DSNAME=&LIBPRFX1..SCEERUN,DISP=SHR
//SYSMSGS  DD  DSNAME=&LIBPRFX2..SCEEMSGP(EDCPMSGE),DISP=SHR
//SYSLIB   DD  DSN=TCP.SEZARNT1,DISP=SHR
//SYSMOD   DD  DSNAME=&&PLKSET,UNIT=SYSDA,DISP=(MOD,PASS),
//             SPACE=(32000,(30,30)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
//OBJLIB   DD  DSN=&MYHLQ..OBJ,DISP=SHR
//MYRENT   DD  DSN=&MYHLQ..RENTDS,DISP=SHR
//SYSOUT   DD  SYSOUT=*
//SYSPRINT DD  SYSOUT=*
//*
//*-------------------------------------------------------------------
//* LINKEDIT STEP:
//*-------------------------------------------------------------------
//LKED   EXEC PGM=IEWL,COND=(4,LT,PLKED),
//    REGION=2048K,PARM='RENT,AMODE=31,MAP'
//SYSLIB   DD  DSN=TCP.SEZACMTX,DISP=SHR
//         DD  DSNAME=&LIBPRFX2..SCEELKED,DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSLIN   DD  DSNAME=*.PLKED.SYSMOD,DISP=(OLD,DELETE)
//SYSLMOD  DD  DSNAME=&MYHLQ..LMOD(CTESTRNT),DISP=SHR
//SYSUT1   DD  UNIT=SYSDA,SPACE=(32000,(30,30))
//   PEND
//S1  EXEC PROC=RENTTEST
//PLKED.SYSIN DD *
  INCLUDE MYRENT
  INCLUDE SYSLIB(@@DC370$)
/*

Figure 3 shows sample JCL to be used when running the reentrant program prelinked and linked in the previous JCL sample. Modify the lines to conform to the naming conventions of your site:

Figure 3. Sample JCL for running the reentrant program
//RUNTST  JOB ,RUN,MSGLEVEL=(1,1),CLASS=A,REGION=4096K
//********************************************************************
//*                                                                  *
//*  SAMPLE JCL THAT RUNS A TEST PROGRAM, CTESTRNT                   *
//*                                                                  *
//********************************************************************
//S1  EXEC PGM=CTESTRNT
//STEPLIB DD DSN=CEEL.OSV2R7.SCEERUN,DISP=SHR
//        DD DSN=USER71.TEST.LMOD,DISP=SHR
//SYSPRINT DD  SYSOUT=*

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014