Previous Topic Next topic Print topic


Converting Segments from EBCDIC to ANSI

Mainframe Subsystem Support includes a segment exit routine called IMSDBUEA that you can use to convert segments from EBCDIC to ANSI. You can use it in three ways:

  • when unloading, causing the output to be written in ANSI.
  • when loading, causing the file to be converted before it is loaded.
  • when adding segments, causing the segments to be converted before they are added.

IMSDBUEA uses a segment layout (.slf) file to determine which fields of each segment need to be converted, so you must create an .slf file using the IMS database editor before you can use IMSDBUEA. The .slf file must be in the directory specified by the ES_IMSDAT environment variable, or if the ES_IMSDAT environment variable is not set the .slf file must be in the current directory.

How you use IMSDBUEA depends on whether you are using the database management utility or the command line:

  • If you are using the database management utility specify IMSDBUEA in the SEGEXIT field when adding segments or loading or unloading a database.
  • If you are using the command line, add the following parameter:segexit=imsdbuea
It is not possible for IMSDBUEA to call one of your segment exit routines. However, if you need to perform some additional processing before converting from EBCDIC to ANSI you can write your own segment exit routine that performs the required processing, and then calls IMSDBUEA. To call this exit, which is actually an entry point, directly from your program, load its parent program, MFIMSDBU, first and use DBUPARMS.CPY. For example:
       PROCEDURE DIVISION.                                              
      *=========================================================*       

***** Load the MFIMSDBU module first.

     set ws-ptr to entry "MFIMSDBU"
     if ws-ptr = null
         display "Cannot Load MFIMSDBU DLL"
         display "Need to Die gracefully."
         stop run
      end-if


           MOVE 02                     TO SEGEXIT-VERSION       
           MOVE 00                     TO SEGEXIT-FUNC       
           MOVE 'P155'                 TO SEGEXIT-DBD       
           MOVE 'P155SEG'              TO SEGEXIT-SEGM       
           MOVE 10                     TO SEGEXIT-SEGM-LTH       
           MOVE 10                     TO SEGEXIT-SEGM-MAX-LTH       
           MOVE P155SEG                TO SEGEXIT-DATA       
           
           CALL 'IMSDBUEA' USING SEGEXIT-PARMS
                                 SEGEXIT-DATA.      
           
mftech     MOVE 02                     TO SEGEXIT-VERSION
mftech     MOVE 01                     TO SEGEXIT-FUNC
mftech     MOVE 'P155'                 TO SEGEXIT-DBD
mftech     MOVE 'P155SEG'              TO SEGEXIT-SEGM
mftech     MOVE 10                     TO SEGEXIT-SEGM-LTH
mftech     MOVE 10                     TO SEGEXIT-SEGM-MAX-LTH
mftech     MOVE P155SEG                TO SEGEXIT-DATA
mftech
mftech     CALL 'IMSDBUEA' USING SEGEXIT-PARMS
mftech                           SEGEXIT-DATA.
Note:
  • You cannot create another segment exit called IMSDBUEA.
  • IMSDBUEA performs the conversion using the COBOL program _CODESET. By default, _CODESET uses the EBCDIC and ANSI codepages in use on your PC. If you need to convert using different codepages you must use the codecomp utility to create customized mapping tables. For more information see The Codecomp Utility and the section Converting between EBCDIC and ASCII in the File Handling topic Converting Data Files.
Previous Topic Next topic Print topic