Transferring data via TCPIP between the mainframe using ADS and other platforms that support UNICODE and ASCII may require the ability to convert between these character sets and EBCDIC. This documents addresses ADS, for Cobol refer to TEC522052.

Document ID : KB000053322
Last Modified Date : 14/02/2018
Show Technical Document Details

Description

This knowledge document explains how to create and use an ADSO built-in function to convert between EBCDIC and ASCII and EBCDIC and UNICODE.

Solution

Syntax:

MOVE CSET-CONVERSION( input-field, - ETOU - , size ) TO output-field.
                                   + UTOE +
                                   + ETOA +
                                   + ATOE +

Input-field : A PIC X(n) field containing data in EBCDIC, ASCII or UNICODE character set.

Conversion-type : Keywords to indicate from what and to what character set the conversion should be performed.

                ETOU - From EBCDIC to UNICODE.
                UTOE - From UNICODE to EBCDIC.
                ETOA - From EBCDIC to ASCII.
                ATOE - From ASCII to EBCDIC.

Size : This can be a PIC 9(4) field containing the number of bytes to be converted, it could also be a numeric constant.

This value should not exceed the lengths of the INPUT-FIELD and OUTPUT-FIELD.

Output-field : A PIC X(n) field to received the data converted to the requested character set.

Define the built-in function to ADS:

Download the USERBIF1.BIN attachment. Upload this file to the mainframe in binary format with RECFM=FB, LRECL=80 and BLKSIZE=8000. This file should be defined as physical sequential. Assign this file to the DISTLOAD DD in the JCL and link it as USERBIF1.

//LINKBIF  EXEC  PGM=IEWL,                                         
//   PARM='LET,MAP,LIST,NCAL,SIZE=(524288,65536),RENT,REUS,REFR'   
//SYSLMOD   DD DSN=IDMS.LOADLIB,DISP=SHR         
//DISTLOAD  DD DSN=USERBIF1.BIN,DISP=SHR                  
//SYSPRINT  DD SYSOUT=*                                            
//SYSLIN      DD   *                                                 
 INCLUDE DISTLOAD                                                  
 ENTRY   BIF1EP1                                                   
 NAME    USERBIF1(R)                                               
/*    

Define USERBIF1 to the SYSGEN:

ADD PROGRAM USERBIF1                       
     CONCURRENT                             
     NODYNAMIC                              
     DUMP THRESHOLD IS 0                    
     ENABLED                                
     ERROR THRESHOLD IS 5                   
     ISA SIZE IS 0                          
     LANGUAGE IS ASSEMBLER                  
     MPMODE IS SYSTEM                       
     NOMAINLINE                             
     MULTIPLE ENCLAVE IS ON                 
     NEW COPY IS ENABLED                    
     OVERLAYABLE                            
     PROGRAM                                
     NOPROTECT                              
     REENTRANT                              
     NONRESIDENT                            
     REUSABLE                               
     NOSAVEAREA                             
     .

Define RHDCCSET to the SYSGEN:

ADD PROGRAM RHDCCSET                    
     CONCURRENT                          
     NODYNAMIC                           
     DUMP THRESHOLD IS 0                 
     ENABLED                             
     ERROR THRESHOLD IS 5                
     ISA SIZE IS 0                       
     LANGUAGE IS ASSEMBLER               
     MPMODE IS SYSTEM                    
     NOMAINLINE                          
     MULTIPLE ENCLAVE IS ON              
     NEW COPY IS ENABLED                 
     OVERLAYABLE                         
     PROGRAM                             
     NOPROTECT                           
     REENTRANT                           
     NONRESIDENT                         
     REUSABLE                            
     NOSAVEAREA                          
         .        

Assemble and link model XDE module RHDCCSET with this JCL:

//ASMSTEP EXEC PGM=ASMA90,REGION=0M                               
//SYSLIB    DD DSN=IDMS.DISTMAC,DISP=SHR             
//          DD DSN=SYS1.MACLIB,DISP=SHR                           
//SYSUT1    DD DSN=&&SYSUT1,UNIT=SYSDA,SPACE=(CYL,(15,10))        
//SYSUT2    DD DSN=&&SYSUT2,UNIT=SYSDA,SPACE=(CYL,(15,10))        
//SYSUT3    DD DSN=&&SYSUT3,UNIT=SYSDA,SPACE=(CYL,(15,10))        
//SYSPRINT  DD SYSOUT=*                                           
//SYSLIN    DD DSN=&&OBJECT(RHDCCSET),DISP=(NEW,PASS),UNIT=SYSDA, 
//             SPACE=(CYL,(15,10,4))                              
//SYSIN     DD  * 
RHDCCSET TITLE 'EVAL - BUILT-IN DATE FUNCTIONS - MODEL XDE TBL'         
* RHDCCSET EP=RHDCCSET XA RENT                                11/08/91  
         SPACE 3                                                        
         #EFUNMOD TYPE=INITIAL,NAME=RHDCCSET                            
         EJECT                                                          
**********************************************************************  
         SPACE 3                                                        
         #EFUNMOD TYPE=HDR,                                            X
               FUNCNAM=CSETCONV,                                       X
               PROGRAM=USERBIF1,                                       X
               FUNCNBR=0,                                              X
               WORKLNG=1200,                                           X
               FIXOPND=3,                                              X
               RESLNG=OPND,                                            X
               RESDATP=EBD,                                            X
               RESDEC=0                                                 
         SPACE 1                                                        
         #EFUNMOD TYPE=XDE,DECS=0,OPT=NO,RESDEFL=YES                    
         SPACE 1                                                        
         #EFUNMOD TYPE=DATA,CONV=(EBD,SOURCE,SOURCE)                    
         SPACE 1                                                        
         #EFUNMOD TYPE=XDE,DECS=0,OPT=NO                                
         SPACE 1                                                        
         #EFUNMOD TYPE=DATA,CONV=(EBD,SOURCE,4)                         
         EJECT                                                          
         #EFUNMOD TYPE=XDE,DECS=SOURCE,OPT=NO                           
         SPACE 1                                                        
         #EFUNMOD TYPE=DATA,CONV=(UPK,FWB,SOURCE)                       
         EJECT                                                          
         #EFUNMOD TYPE=HDR,                                            X
               FUNCNAM=ETOU,                                           X
               FUNCNBR=1,                                              X
               PROGRAM=USERBIF1,                                       X
               WORKLNG=1200,                                           X
               FIXOPND=0,                                              X
               RESLNG=4,                                               X
               RESDATP=EBD,                                            X
               RESDEC=0                                                 
         SPACE 1                                                        
         EJECT                                                          
**********************************************************************  
         #EFUNMOD TYPE=HDR,                                            X
               FUNCNAM=UTOE,                                           X
               FUNCNBR=2,                                              X
               PROGRAM=USERBIF1,                                       X
               WORKLNG=1200,                                           X
               FIXOPND=0,                                              X
               RESLNG=4,                                               X
               RESDATP=EBD,                                            X
               RESDEC=0                                                 
         SPACE 1                                                        
         EJECT                                                          
**********************************************************************  
         #EFUNMOD TYPE=HDR,                                            X
               FUNCNAM=ETOA,                                           X
               FUNCNBR=3,                                              X
               PROGRAM=USERBIF1,                                       X
               WORKLNG=1200,                                           X
               FIXOPND=0,                                              X
               RESLNG=4,                                               X
               RESDATP=EBD,                                            X
               RESDEC=0                                                 
         SPACE 1                                                        
         EJECT                                                          
**********************************************************************  
         #EFUNMOD TYPE=HDR,                                            X
               FUNCNAM=ATOE,                                           X
               FUNCNBR=4,                                              X
               PROGRAM=USERBIF1,                                       X
               WORKLNG=1200,                                           X
               FIXOPND=0,                                              X
               RESLNG=4,                                               X
               RESDATP=EBD,                                            X
               RESDEC=0                                                 
         SPACE 1                                                        
         EJECT                                                          
         #EFUNMOD TYPE=FINAL                                            
         SPACE                                                          
         END   RHDCCSET                               
/*                                               
//STEP003  EXEC  PGM=IEWL,                                         
//   PARM='LET,MAP,LIST,NCAL,SIZE=(524288,65536),RENT,REUS,REFR'   
//SYSLMOD   DD DSN=IDMS.LOADLIB,DISP=SHR         
//DISTLOAD  DD DSN=&&OBJECT,DISP=SHR                               
//SYSPRINT  DD SYSOUT=*                                            
//SYSLIN    DD   *                                                 
  INCLUDE DISTLOAD(RHDCCSET)                                       
  ENTRY   RHDCCSET                                                 
  NAME    RHDCCSET(R)                                              
/*
 

Include built-in functions in RHDCEVBF with this JCL:

//ASMSTEP EXEC PGM=ASMA90,REGION=0M //SYSLIB DD DSN=IDMS.DISTMAC,DISP=SHR // DD DSN=SYS1.MACLIB,DISP=SHR //SYSUT1 DD DSN=&&SYSUT1,UNIT=SYSDA,SPACE=(CYL,(15,10)) //SYSUT2 DD DSN=&&SYSUT2,UNIT=SYSDA,SPACE=(CYL,(15,10)) //SYSUT3 DD DSN=&&SYSUT3,UNIT=SYSDA,SPACE=(CYL,(15,10)) //SYSPRINT DD SYSOUT=* //SYSLIN DD DSN=&&OBJECT(RHDCEVBF),DISP=(NEW,PASS),UNIT=SYSDA, // SPACE=(CYL,(15,10,4)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=8880) //SYSIN DD * RHDCEVBF TITLE 'EVAL - BUILT-IN FUNCTIONS - MASTER TABLE' * RHDCEVBF EP=RHDCEVBF 06/25/90 14:52:50 02/24/92 #EFUNMST TYPE=INITIAL 12/08/88 15:52:14 EJECT #EFUNMST TYPE=ENTRY, X INVOKE=CSET-CONVERSION, X FUNCT=CSETCONV, X PROGRAM=RHDCCSET #EFUNMST TYPE=ENTRY, X INVOKE=ETOU, X FUNCT=ETOU, X PROGRAM=RHDCCSET #EFUNMST TYPE=ENTRY, X INVOKE=UTOE, X FUNCT=UTOE, X PROGRAM=RHDCCSET #EFUNMST TYPE=ENTRY, X INVOKE=ETOA, X FUNCT=ETOA, X PROGRAM=RHDCCSET #EFUNMST TYPE=ENTRY, X INVOKE=ATOE, X FUNCT=ATOE, X PROGRAM=RHDCCSET #EFUNMST TYPE=FINAL END /* //STEP003 EXEC PGM=IEWL, // PARM='LET,MAP,LIST,NCAL,SIZE=(524288,65536),RENT,REUS,REFR' //SYSLMOD DD DSN=IDMS.LOADLIB,DISP=SHR //DISTLOAD DD DSN=&&OBJECT,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSLIN DD * INCLUDE DISTLOAD(RHDCEVBF) ENTRY RHDCEVBF NAME RHDCEVBF(R) /* //PUNCHIT EXEC PGM=IDMSDDDL,REGION=1000K //STEPLIB DD DSN=IDMS.LOADLIB,DISP=SHR //CDMSLIB DD DSN=IDMS.LOADLIB,DISP=SHR //SYSCTL DD DSN=IDMS.SYSCTL,DISP=SHR //SYSLST DD SYSOUT=* //SYSJRNL DD DUMMY //SYSJRNL1 DD DUMMY //SYSJRNL2 DD DUMMY //SYSPCH DD DUMMY //SYSIDMS DD * DMCL=YOURDMCL DICTNAME=SYSTEM,LOCAL=OFF /* //SYSIPT DD * IDMSDDDL SOURCE FOLLOWS THIS STATEMENT SET OPTIONS DEFAULT IS ON. ADD LOAD MODULE NAME IS RHDCEVBF VERSION IS 1 MODULE TYPE IS TABLE AMODE IS ANY RMODE IS ANY OBJECT DECK FOLLOWS // DD DSN=&&OBJECT(RHDCEVBF),DISP=OLD OSEND. /*
File Attachments:
TEC495321.zip