DSNTEJ6R

This JCL prepares and executes DSN8ED8, a sample caller of DSNUTILU, the Db2 Utilities UNICODE parser stored procedure.

//*
//*    DB2 Sample Application
//*    Phase 6
//*    Sample Caller of Stored Procedure - DSNUTILU
//*    C language
//*
//*
//*    Licensed Materials - Property of IBM
//*    5650-DB2
//*    (C) COPYRIGHT 1982, 2016 IBM Corp.  All Rights Reserved.
//*
//*    STATUS = Version 12
//*
//*  Function =
//*    This JCL prepares and executes DSN8ED8, a sample caller of
//*    DSNUTILU, the DB2 Utilities UNICODE parser stored procedure.
//*
//*  Pseudocode =
//*    PH06RS00 Step     Copy reformatted CUNHC macro
//*    PH06RS01 Step     Prepare DSN8ED8
//*    PH06RS02 Step     Bind the plan and package for DSN8ED8
//*    PH06RS03 Step     Invoke DSN8ED8
//*
//*  Dependencies =
//*   - This job requires the DB2-provided JCL procedure DSNHC
//*   - This job requires z/OS UNICODE Services
//*
//*  Notes =
//*
//*  Change Activity =
//*    10/16/2013 Don't use prelinker by default         PI13612 DM1812
//*    08/18/2014 Single-phase migration            s21938_inst1 s21938
//*    07/26/2014 Add UTILFILE DD for passing the   s20128_inst1 s20128
//*               name of a data set having the
//*               utility control statement.
//*    06/22/2015 Remove UTILFILE DD                s25173_inst1 s25173
//*
//*********************************************************************
//*
//JOBLIB   DD  DISP=SHR,DSN=DSN!!0.SDSNEXIT
//         DD  DISP=SHR,DSN=DSN!!0.SDSNLOAD
//         DD  DISP=SHR,DSN=CEE.V!R!M!.SCEERUN
//*
//*   Step  0: Copy reformatted CUNHC macro
//*
//PH06RS00 EXEC PGM=IEBGENER,COND=(4,LT)
//SYSIN    DD  *
 GENERATE  MAXFLDS=2,MAXLITS=8
   RECORD  FIELD=(72,1,,1),
           FIELD=(8,'        ',,73)
//SYSPRINT DD  SYSOUT=*
//SYSUT2   DD  DSN=&&DSNWDID(CUNHC),
//             DISP=(,PASS),
//             UNIT=SYSDA,SPACE=(TRK,(1,0,1),RLSE),
//             DCB=(RECFM=FB,LRECL=80)
//SYSUT1   DD  DATA,DLM='AA'
??=if defined(__COMPILER_VER__)
??=pragma filetag("IBM-1047")
??=endif
#pragma nomargins nosequence
#if !defined(UNC_INCLUDED)            /* File not yet included?      */
#define UNC_INCLUDED   42             /* Show file now included      */
/*********************************************************************/
/*                                                                   */
/* OS/390 V2 R8/R9/R10 services for Unicode (tm)                     */
/*                                                                   */
/*  HEADER NAME:    CUNHC                                            */
/*                                                                   */
/*  DESCRIPTION:    Declarations for Unicode Services                */
/*                  -codepage conversion                             */
/*                  -case conversion                                 */
/*********************************************************************/
/* @START_COPYRIGHT@                                                 */
/* Statement:     Licensed Materials - Property of IBM               */
/*                HUNI2A0                                            */
/*                                                                   */
/*                (C) Copyright IBM Corporation. 2000                */
/*                Status=5647-A01                                    */
/*                                                                   */
/* @END_COPYRIGHT@                                                   */
/*********************************************************************/
/*                                                                   */
/*  FUNCTION:       This file declares the functions, structures,    */
/*                  and named constants for the Unicode Services     */
/*                                                                   */
/*  PROCESSOR:      C                                                */
/*                                                                   */
/*  HISTORY CHANGES                                                  */
/* $A1=MG00078 HUN7705 010509 JME: RC MISSING IN CUNHC          @A1A */
/*********************************************************************/

#if defined(__cplusplus)
extern "C" {
#endif

/*********************************************************************/
/*  Values Related to all Parameter Areas                            */
/*********************************************************************/



/*********************************************************************/
/*  Returncode and Reasoncodes                                       */
/*********************************************************************/
#define CUN_RC_OK  0
#define CUN_RS_OK  0

/*----------------------------------------------------------------*/
#define CUN_RC_WARN 4

#define CUN_RS_TRG_EXH               1 /* Target buffer exhausted */
#define CUN_RS_INV_HANDLE_NOSET      2 /* Environment was changed */
                                       /* since last call         */
#define CUN_RS_INV_HANDLE_SET        3 /* SET command is currently*/
                                       /* running                 */
#define CUN_RS_NO_HANDLE             4 /* SET command is currently*/
                                       /* running                 */

#define CUN_RS_SUB_ACT_TERM          6 /* Invalid character in    */
                                       /* source buffer -> STOP   */
#define CUN_RS_MBC_INCOMPLETE        7 /* incomplete character in */
                                       /* source buffer (MBCS)    */
#define CUN_RS_STAGE2_FAIL           9 /* An indirect char    @A1A*/
                                       /* conversion fails    @A1A*/
/*----------------------------------------------------------------*/
#define CUN_RC_USER_ERR              8

#define CUN_RS_PARM_VER              1 /* wrong version of        */
                                       /* parameter structure     */
#define CUN_RS_WRK_BUF_SMALL         2 /* workbuffer too small    */
#define CUN_RS_CCSID_NOT_SUPP        3 /* CCSID not supported     */
#define CUN_RS_CASE_NOT_SUPP         4 /* case conversion type    */
                                       /* not supported           */

#define CUN_RS_TRG_BUF_SMALL         6 /* target buffer too small */

#define CUN_RS_DDA_BUF_SMALL         7 /* DDA    buffer too small */
#define CUN_RS_DDA_MIN_SMALL         8 /*DDA buffer min small @A1A*/

/*----------------------------------------------------------------*/
#define CUN_RC_ENV_ERR              12

#define CUN_RS_NO_UNI_ENV            1 /* Unicode environment is  */
                                       /* not set up              */
#define CUN_RS_NO_CONVERSION         2 /* conversion service not  */
                                       /* available               */

/*----------------------------------------------------------------*/
#define CUN_RC_SYS_ERR              16

#define CUN_RS_INCONSISTENT_UCCB     1
#define CUN_RS_INCONSISTENT_UCCE     2
#define CUN_RS_INV_CONVERSION        3
#define CUN_RS_INCONSISTENT_UCAE     4
#define CUN_RS_INCONSISTENT_TABLES   5
#define CUN_RS_WA_NOT_ALIGNED       28
#define CUN_RS_TABLE_NOT_ALIGNED    32






/*********************************************************************/
/*  Values Related to CUNBCPRM Stucture (codepage conversion)        */
/*********************************************************************/

#define CUNBCPRM_DDA_BUF_MIN                 800L              /*@A1A*/
#define CUNBCPRM_DDA_REQ                    4096L
/* Structure Version Number */
#define CUNBCPRM_VERSION                    1

/* Structure Length */
#define CUNBCPRM_LEN                        164L
#define CUNBCPRM_CURRENT_LEN                164L

/* ALET  */
#define CUNBCPRM_ALET                       0L

/* Default Handle */
#define CUNBCPRM_EMPTY_CONVHDL \
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0'

/* Flag1 values */
#define CUNBCPRM_FLAG1_DEFAULT                  0
#define CUNBCPRM_SUB_ACTION_TERMINATE           0
#define CUNBCPRM_SUB_ACTION_SUBSTITUTE          0x80

#define CUNBCPRM_TERMINATE_AT_INV_HANDLE_START  0
#define CUNBCPRM_REFRESH_AT_INV_HANDLE_START    0x40

#define CUNBCPRM_OPT_SPACE                                      0
#define CUNBCPRM_OPT_SPEED                                      0x20

/* Flag2 values */
#define CUNBCPRM_FLAG2_DEFAULT                  0
#define CUNBCPRM_NO_SUBSTITUTION                0
#define CUNBCPRM_SUBSTITUTION                   0x80

/* Subcodepage values */

#define CUNBCPRM_SHIFT_DEFAULT                  0

#define CUNBCPRM_DESIGNATOR_DEFAULT             0


/*********************************************************************/
/*  CUNBCPRM Structure -- Conversion Service Parameter Structure     */
/*********************************************************************/

typedef struct tagCUNBCPRM {
long           Version;              /* Structure version number    */
long           Length;               /* Length of  structure        */
long           Res1;                 /* Reserved                    */
void   *       Src_Buf_Ptr;          /* Pointer to Source           */
unsigned long  Src_Buf_ALET;         /* ALET of source buffer       */
unsigned long  Src_Buf_Len;          /* Length of source data       */
long           Res2;                 /* Reserved                    */
void   *       Targ_Buf_Ptr;         /* Pointer to Target           */
unsigned long  Targ_Buf_ALET;        /* ALET of target buffer       */
unsigned long  Targ_Buf_Len;         /* Length of target buffer     */
char           Conv_Handle[64];      /* conversion handle           */
unsigned long  Src_CCSID;            /* CCSID of source data        */
unsigned long  Targ_CCSID;           /* CCSID of taget data         */
char           Technique[8];         /*                             */
long           Res4;                 /* Reserved                    */
void   *       Wrk_Buf_Ptr;          /* Pointer to work buffer      */
unsigned long  Wrk_Buf_ALET;         /* ALET of work buffer         */
unsigned long  Wrk_Buf_Len;          /* Length of work buffer       */
long           Res5;                 /* Reserved                    */
void   *       DDA_Buf_Ptr;          /* Pointer to dynamic data area*/
unsigned long  DDA_Buf_ALET;         /* ALET of DDA                 */
unsigned long  DDA_Buf_Len;          /* Length of DDA               */
unsigned char  Flag1;
unsigned char  Subcodepage;          /* subcodepage to begin with   */
unsigned char  Flag2;                /*                             */
unsigned char  Designator;           /* reserved for ISO 2022       */
long           Return_Code;
long           Reason_Code;
} CUNBCPRM;


#define CUNBCPRM_DEFAULT \
CUNBCPRM_VERSION,\
CUNBCPRM_LEN,\
0L,\
NULL,\
CUNBCPRM_ALET,\
0L,\
0L,\
NULL,\
CUNBCPRM_ALET,\
0L,\
{CUNBCPRM_EMPTY_CONVHDL},\
0L,\
0L     ,\
{' ',' ',' ',' ',' ',' ',' ',' '},\
0L,\
NULL,\
CUNBCPRM_ALET,\
0L,\
0L,\
NULL,\
CUNBCPRM_ALET,\
CUNBCPRM_DDA_REQ,\
CUNBCPRM_FLAG1_DEFAULT,\
CUNBCPRM_SHIFT_DEFAULT,\
CUNBCPRM_FLAG2_DEFAULT, \
CUNBCPRM_DESIGNATOR_DEFAULT, \
CUN_RC_OK,\
CUN_RS_OK


/**********************************************************************/
/*                         UCCE handle                                */
/**********************************************************************/
typedef struct uccehdl{
long UCCE_TIME;              /* Modification time stamp of UCCB   @A1A*/
long Res1;                   /* Reserved for 64 bit               @A1A*/
void * UCCE_UCCB_PTR;        /* Address of UCCB                   @A1A*/
long Res2;                   /* Reserved for 64 bit               @A1A*/
void * UCCE_UCCE_PTR;        /* Address of UCCE                   @A1A*/
long UCCE_UCCE_ALET;         /* ALET of UCCE                      @A1A*/
long UCCE_CONVERSION;        /* Conversion information            @A1A*/
                             /* (for constants see CUNPIDFC)      @A1A*/
long UCCE_TAB_FIXED;         /* 0=table is pageable               @A1A*/
                             /* 1=table is fixed                  @A1A*/
long UCCE_HW_PRESENT;        /* 0=Unicode hardware not present    @A1A*/
                             /* 1=Unicode hardware present        @A1A*/
long UCCE_SUB_HANDLE;        /* 0=handle created via CUNPIHDL     @A1A*/
                             /* 1=handle created by the service   @A1A*/
long UCCE_SRC_CCSID;         /* Source CCSID                      @A1A*/
long UCCE_TGT_CCSID;         /* Target CCSID                      @A1A*/
char UCCE_TECHNIQUE;         /* Technique search order            @A1A*/
long UCCE_SRC_WIDTH_MIN;     /* Minimum source character width    @A1A*/
long UCCE_SRC_WIDTH_MAX;     /* Maximum source character width    @A1A*/
long UCCE_TGT_WIDTH_MIN;     /* Minimum target character width    @A1A*/
long UCCE_TGT_WIDTH_MAX;     /* Maximum target character width    @A1A*/
long UCCE_DDA_BUF_LEN;       /* Required DDA buffer length        @A1A*/
long Res3;                   /* Reserved                          @A1A*/
};

/*********************************************************************/
/*  Values Related to CUNBAPRM Stucture (case conversion)            */
/*********************************************************************/

#define CUNBAPRM_DDA_REQ                    1024L
/* Structure Version Number */
#define CUNBAPRM_VERSION                    1

/* Structure Length */
#define CUNBAPRM_LEN                        168L
#define CUNBAPRM_CURRENT_LEN                168L

/* ALET  */
#define CUNBAPRM_ALET                       0L

/* CUNBAPRM_Conv_Type Constants                                     */
#define CUNBAPRM_TO_UPPER   1 /* upper case         */
#define CUNBAPRM_TO_LOWER   2 /* lower case         */


/* Default Handle */
#define CUNBAPRM_EMPTY_CONVHDL \
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0',\
      '\0','\0','\0','\0','\0','\0','\0','\0'


#define CUNBAPRM_EMPTY_LOCALE ' ',' ',' ',' ',' ',' ',' ',' ',\
      ' ',' ',' ',' ',' ',' ',' ',' ',\
      ' ',' ',' ',' ',' ',' ',' ',' ',\
      ' ',' ',' ',' ',' ',' ',' ',' '

/* flag1 values */
#define CUNBAPRM_FLAG1_DEFAULT                  0
#define CUNBAPRM_TERMINATE_AT_INV_HANDLE_START  0
#define CUNBAPRM_REFRESH_AT_INV_HANDLE_START    0x80
/* flag2 values */
#define CUNBAPRM_FLAG2_DEFAULT                  0


/*********************************************************************/
/*  Returncode and Reasoncodes                                       */
/*********************************************************************/


/*********************************************************************/
/*  CUNBAPRM Structure -- Conversion Service Parameter Structure     */
/*********************************************************************/

typedef struct tagCUNBAPRM {
long           Version;              /* Structure version number    */
long           Length;               /* Length of  structure        */
long           Res1;                 /* Reserved                    */
void   *       Src_Buf_Ptr;          /* Pointer to Source           */
unsigned long  Src_Buf_ALET;         /* ALET of source buffer       */
unsigned long  Src_Buf_Len;          /* Length of source data       */
long           Res2;                 /* Reserved                    */
void   *       Targ_Buf_Ptr;         /* Pointer to Target           */
unsigned long  Targ_Buf_ALET;        /* ALET of target buffer       */
unsigned long  Targ_Buf_Len;         /* Length of target buffer     */
char           Conv_Handle[64];      /* conversion handle           */
unsigned char  Conv_Type;            /* conversion type             */
char           Res3[3];
char           Locale[32];           /* LOCALE                      */
long           Res4;                 /* Reserved                    */
void   *       DDA_Buf_Ptr;          /* Pointer to dynamic data area*/
unsigned long  DDA_Buf_ALET;         /* ALET of DDA                 */
unsigned long  DDA_Buf_Len;          /* Length of DDA               */
unsigned char  Flag1;
unsigned char  Flag2;                /*                             */
unsigned char  Res5[2];              /* Reserved                    */
long           Return_Code;
long           Reason_Code;
} CUNBAPRM;


#define CUNBAPRM_DEFAULT \
CUNBAPRM_VERSION,\
CUNBAPRM_LEN,\
0L,\
NULL,\
CUNBAPRM_ALET,\
0L,\
0L,\
NULL,\
CUNBAPRM_ALET,\
0L,\
{CUNBAPRM_EMPTY_CONVHDL},\
'\0',\
{' ',' ',' '},\
{CUNBAPRM_EMPTY_LOCALE},\
0L,\
NULL,\
CUNBAPRM_ALET,\
CUNBAPRM_DDA_REQ,\
CUNBAPRM_FLAG1_DEFAULT,\
CUNBAPRM_FLAG2_DEFAULT,\
{' ',' '},\
CUN_RC_OK,\
CUN_RS_OK


/*********************************************************************/
/*  Functions                                                        */
/*********************************************************************/

#if defined(__cplusplus)
extern "OS"
#else
#pragma linkage(CUNLCNV,OS)
#endif

/*** Codepage Conversion ****/
long  CUNLCNV ( CUNBCPRM    *   cparm );

/*** Case Conversion ****/
long  CUNLASE ( CUNBAPRM    *   cparm );


#if defined(__cplusplus)
}
#endif

/*********************************************************************/
/*  End of CUNHC                                                     */
/*********************************************************************/
#endif  /* End of header file */
AA
//*
//*
//*   Step  1: Prepare DSN8ED8, sample caller of DSNUTILU
//*
//PH06RS01 EXEC DSNHC,MEM=DSN8ED8,COND=(4,LT),
//         PARM.PC=('HOST(C),CCSID(1047),MARGINS(1,72),STDSQL(NO)',
//             SOURCE,XREF),
//         PARM.C='SOURCE LIST MAR(1,72) LO RENT OPTFILE(DD:CCOPTS)',
//         PARM.LKED='AMODE=31,RMODE=ANY,MAP,RENT,REUS,UPCASE'
//PC.DBRMLIB   DD DSN=DSN!!0.DBRMLIB.DATA(DSN8ED8),
//             DISP=SHR
//PC.SYSLIB    DD DSN=DSN!!0.SRCLIB.DATA,
//             DISP=SHR
//PC.SYSIN     DD DSN=DSN!!0.SDSNSAMP(DSN8ED8),
//             DISP=SHR
//C.SYSLIB DD  DSN=CEE.V!R!M!.SCEEH.H,
//             DISP=SHR
//         DD  DSN=&&DSNWDID,
//             DISP=(OLD,PASS)
//LKED.SYSLIB DD DSN=CEE.V!R!M!.SCEELKED,
//             DISP=SHR
//         DD  DSN=DSN!!0.SDSNLOAD,
//             DISP=SHR
//         DD  DSN=SYS1.LINKLIB,
//             DISP=SHR
//         DD  DSN=SYS1.CSSLIB,
//             DISP=SHR
//LKED.SYSLMOD DD DSN=DSN!!0.RUNLIB.LOAD(DSN8ED8),
//             DISP=SHR
//LKED.SYSIN   DD *
 INCLUDE SYSLIB(DSNELI)
 INCLUDE SYSLIB(DSNTIAR)
//*
//*   Step  2: Bind the package and plan for DSN8ED8
//*
//PH06RS02 EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT)
//DBRMLIB  DD  DISP=SHR,DSN=DSN!!0.DBRMLIB.DATA
//SYSTSPRT DD  SYSOUT=*
//SYSPRINT DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*
//SYSTSIN  DD  *
  DSN SYSTEM(DSN)
    BIND PACKAGE(DSN8ED!!) MEMBER(DSN8ED8) APPLCOMPAT(V!!R1) +
         ACT(REP) ISO(CS) CURRENTDATA(YES) ENCODING(UNICODE)
    BIND PLAN(DSN8ED8) -
         PKLIST(DSN8ED!!.DSN8ED8 -
                DSNUTILU.*) -
         ACTION(REPLACE) RETAIN +
         ISO(CS) CURRENTDATA(YES) ENCODING(UNICODE)
    RUN PROGRAM(DSNTIAD) PLAN(DSNTIA!!) -
        LIB('DSN!!0.RUNLIB.LOAD')
  END
//SYSIN    DD  *
  SET CURRENT SQLID = 'SYSADM';
  GRANT BIND, EXECUTE ON PLAN DSN8ED8
    TO PUBLIC;
//*
//*   Step  3: Invoke DSN8ED8
//*
//PH06RS03 EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT)
//SYSTSPRT DD  SYSOUT=*
//SYSPRINT DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*
//SYSTSIN  DD  *
  DSN SYSTEM(DSN)
    RUN PROGRAM(DSN8ED8) PLAN(DSN8ED8) -
        LIB('DSN!!0.RUNLIB.LOAD')
  END
//UTILID   DD  *
DIAGNOSEDISPMEPL
//RESTART  DD  *
NO
//UTILSTMT DD  *
DIAGNOSE DISPLAY MEPL
//REPORT   DD  SYSOUT=*
/*