File Conversion
When technology complements business   ASCII & EBCDIC - QSAM & VSAM
Copyright © 1987-2008  SimoTime Enterprises, LLC  All Rights Reserved http://www.simotime.com

 
Introduction Version 04.09.23
  JCL for the Mainframe
 
  JCL for Executing the Conversion Program
  JCL for Creating a QSAM File
  The COBOL Conversion Program
  The ASCII and EBCDIC Tables
  Additional Sample Programs in this Packet
  Summary
 
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Comments or Suggestions
  About SimoTime

Introduction
(Next) (Previous) (Table-of-Contents)

This is an example of how a COBOL program can read a sequential file with EBCDIC content that is downloaded from a mainframe in binary format using FTP (File Transfer Protocol). The example then describes how to translate the EBCDIC content to ASCII and write an ASCII file. At first glance the conversion between EBCDIC and ASCII appears to be a simple and practical task. Typically the EBCDIC files reside on a mainframe legacy system. These files may be very large and may have been updated over a period of many years. In addition to containing displayable EBCDIC characters the records may contain binary and packed decimal fields that cannot simply be converted using an EBCDIC/ASCII table. Signed numbers cannot be converted in the same manner as text data.

Also, some of the fields in a record may contains low-values (i.e. x'00') that are being handle as a space characters on the mainframe. The low-values remain low-values when converted to ASCII and when downloaded or ported to the PC these low-values may be treated as null characters and this presents a major problem if not addressed in the initial conversion process.

A general guideline to follow is, "The scope of effort for converting a mainframe legacy file from EBCDIC to ASCII is directly proportional to the size of the file, the age of the file and the number and type of numeric fields." Estimating the time for conversion between EBCDIC and ASCII can be done with a high degree of accuracy. Estimating the time for "scrubbing the data" may be a challenging task.

This example focuses on the conversion between EBCDIC and ASCII and does not address all the issues involved when converting files to be ported and/or accessed by ASCII-based systems. Additional information may be obtained by contacting the SimoTime help desk at helpdesk@simotime.com.

The COBOL source code was generated using SimoZAPS, a product of SimoTime Enterprises. The SimoZAPS utility program also has the capability of reading, writing or converting between other file formats. In the world of programming there are many ways to solve a problem. This program is provided as a COBOL example of one of the possible solutions to the problem of changing the contents and structure of data files.

Additional information for doing various file conversions may be found in the SYNERGIES - Gateways to Technology section. Take a look at the following for actual file conversion programming examples that may run on a mainframe running MVS (or OS/390) or a PC using Micro Focus Mainframe Express or Net Express.

JCL for the Mainframe
(Next) (Previous) (Table-of-Contents)

This suite of sample programs provides two JCL members. The first member (CBLE2AJ1.JCL) contains the necessary DD statements and will execute the sample conversion program (CBLE2AC1.CBL). The second JCL member is an example of how to create a QSAM file (QSAM080E) that may be used as the EBCDIC input file (SYSUT1). The following will describe each of the JCL members.

JCL for Executing the Conversion Program
(Next) (Previous) (Table-of-Contents)

This JCL member (CBLE2AJ1.JCL) will read an EBCDIC file, do the data translation from EBCDIC to ASCII and create a new sequential file. The DD statements will probably need to be modified to run on different mainframes. This JCL member will run on the mainframe or the PC with Micro Focus Mainframe Express (refer to http://www.microfocus.com ).

The following is the JCL member for executing the sample conversion program.

//CBLE2AJ1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2003 All Rights Reserved             *
//*                                                                   *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Read QSAM 80-byte EBCDIC and write QSAM 80-byte ASCII.
//* Author - SimoTime Enterprises
//* Date   - January 24, 1996
//*
//* The job will read an 80-byte file (QSAM080E) in EBCDIC format and
//* create an 80-byte file (QSAM080A) in ASCII format. This is an
//* 80/80 repro with conversion from EBCDIC to ASCII.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//*                     ************
//*                     * CBLE2AJ1 *
//*                     ********jcl*
//*                          *
//*                          *
//*    ************     ************     ************
//*    *  SYSUT1  *-----* CBLE2AC1 *-----*  SYSUT2  *
//*    ************     ************     ************
//*                          *
//*                          *
//*                     ************
//*                     *   EOJ    *
//*                     ************
//*
//* *******************************************************************
//EXECC2A1 EXEC PGM=CBLE2AC1
//STEPLIB  DD  DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//SYSUT1   DD  DSN=SIMOTIME.DATA.QSAM080E,DISP=SHR
//SYSUT2   DD  DSN=SIMOTIME.DATA.QSAM080A,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//

JCL for Creating a QSAM File
(Next) (Previous) (Table-of-Contents)

This JCL member (CBLE2AJ2.JCL) is provided to create an EBCDIC file that may be used as input when attempting to execute the conversion program. The DD statements will probably need to be modified to run on different mainframes. This JCL member will run on the mainframe or the PC with Micro Focus Mainframe Express (refer to http://www.microfocus.com ).

The following is the JCL member for creating a QSAM file.

//CBLE2AJ2 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2003 All Rights Reserved             *
//*                                                                   *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Create a Sequential Data Set on disk using IEBGENER.
//* Author - SimoTime Enterprises
//* Date   - January 24, 1996
//*
//* The first job step (DELTQSAM) will delete any previously created
//* file. The second job step (CRTQNAME) will create a new file.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//* *******************************************************************
//* Step   1   Delete any previously created file...
//*
//QSAMDELT EXEC PGM=IEFBR14
//QSAM080E DD  DSN=SIMOTIME.DATA.QSAM080E,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step   2   Create and populate a new QSAM file...
//*
//QCRT080E EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8
//SYSUT1   DD  *
000100 Anderson            Adrian    111 Peachtree Plaza      Atlanta         GA
000200 Brown               Billie    222 Baker BoulevarD      Baltimore       MD
000300 Carson              Cameron   333 CrenshaW Blvd.       Cupertino       CA
000400 Davidson            Dion      444 Main Street          Wilmington      DE
000500 Everest             Evan      555 5TH Avenue           New york        NY
000600 Franklin            Francis   666 66TH Avenue          Bedrock         NY
000700 Garfunkel           Gwen      777 77TH Street          New york        NY
000800 Harrison            Hilary    888 88TH Street          Pocatello       ID
000900 Isley               Isabel    999 99TH Avenue          Indianapolis    IN
001000 Johnson             Jamie     1010 Paradise Drive      Larkspur        CA
001100 Kemper              Kelly     1111 Oak Circle          Kansas City     KS
001200 Lemond              Lesley    1212 Lockwood Road       Mohave Desert   AZ
001300 Mitchell            Marlow    1313 Miller Creek Road   Anywhere        TX
001400 Newman              Noel      1414 Park Avenue         Santa Monica    CA
001500 Osborn              Owen      1515 Center Stage        Rolling Rock    PA
001600 Powell              Pierce    1616 Central Avenue      Ventura         CA
001700 Quigley             Quincy    1717 Farm Hill Road      Oshkosh         WI
001800 Ripley              Ray       1818 Alien Lane          Wayout          KS
001900 Smith               Sammy     1919 Carnoustie Drive    Novato          CA
002000 Tucker              Taylor    2020 Sanger Lane         St. Paul        MN
002100 Underwood           Ulysses   2121 Wall Street         New York        NY
002200 Victoria            Vaughn    2222 Vine Street         Hollywood       CA
002300 Wilson              Wiley     2323 Main Street         Boston          MA
002400 Xray                Xavier    2424 24TH Street         Nashville       TN
002500 Young               Yanni     2525 Yonge Street        Toronto         ON
002600 Zenith              Zebulon   2626 26TH Street         Dallas          TX
123456 Doe                 John      123 Main Street          Anywhere        OR
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.QSAM080E,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//

The COBOL Conversion Program
(Next) (Previous) (Table-of-Contents)

This program (CBLE2AC1.CBL) will read a sequential (QSAM) EBCDIC file and write a sequential (QSAM) ASCII file. This program was compiled on the PC using Mainframe Express . The organization of the output file (SYSUT2) could be changed from SEQUENTIAL to LINE SEQUENTIAL (the Micro Focus terminology for ASCII Text files) to create an ASCII/Text file. With this change the program will not execute on the mainframe but could be used with Net Express. For more information about Mainframe Express and Net Express refer to http://www.microfocus.com .

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CBLE2AC1.
       AUTHOR.        SIMOTIME ENTERPRISES.
      *****************************************************************
      *           This program was generated by SimoZAPS              *
      *             A product of SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  Function Name   Organization Rec-Format R-Len K-Len K-Pos    *
      *  INPUT    SYSUT1 SEQUENTIAL   FIXED      00080                *
      *  OUTPUT   SYSUT2 SEQUENTIAL   FIXED      00080                *
      *                                                               *
      *            Translation Mode is EBCDIC to ASCII                *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT SYSUT1-FILE  ASSIGN to       SYSUT1
                  ORGANIZATION is SEQUENTIAL
                  ACCESS MODE  is SEQUENTIAL
                  FILE STATUS  is SYSUT1-STATUS.
           SELECT SYSUT2-FILE  ASSIGN to       SYSUT2
                  ORGANIZATION is SEQUENTIAL
                  ACCESS MODE  is SEQUENTIAL
                  FILE STATUS  is SYSUT2-STATUS.
      *
      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       FD  SYSUT1-FILE
           BLOCK CONTAINS 00800 CHARACTERS
           DATA RECORD    is SYSUT1-RECORD
           .
       01  SYSUT1-RECORD.
           05  SYSUT1-DATA-01  pic X(00080).
      *
       FD  SYSUT2-FILE
           BLOCK CONTAINS 00800 CHARACTERS
           DATA RECORD    is SYSUT2-RECORD
           .
       01  SYSUT2-RECORD.
           05  SYSUT2-DATA-01  pic X(00080).
      *
      *****************************************************************
      * This program was created using the SYSMASK1.TXT file as input.*
      * The SYSMASK1 provides for the sequential reading of the input *
      * file (SYSUT1) and the sequential writing of the output file   *
      * (SYSUT2). If the output file (SYSUT2) is indexed then the     *
      * input file (SYSUT1) must be in sequence by the field that     *
      * will be used to provide the key for the output file (SYSUT2). *
      * If the key field is not in sequence then refer to SYSMASK2    *
      * to provide for a random add or update of the indexed file.    *
      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* CBLE2AC1 '.
           05  T2 pic X(34) value 'Data File Content Modification    '.
           05  T3 pic X(10) value ' v2.0.00  '.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CBLE2AC1 '.
           05  C2 pic X(20) value 'Copyright 1987-2003 '.
           05  C3 pic X(28) value '  SimoTime Enterprises, LLC '.
           05  C4 pic X(20) value ' All Rights Reserved'.
      *
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* CBLE2AC1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.
      *
       01  SYSUT1-STATUS.
           05  SYSUT1-STATUS-L     pic X.
           05  SYSUT1-STATUS-R     pic X.
       01  SYSUT1-EOF              pic X       value 'N'.
       01  SYSUT1-OPEN-FLAG        pic X       value 'C'.
      *
       01  SYSUT2-STATUS.
           05  SYSUT2-STATUS-L     pic X.
           05  SYSUT2-STATUS-R     pic X.
       01  SYSUT2-EOF              pic X       value 'N'.
       01  SYSUT2-OPEN-FLAG        pic X       value 'C'.
      *
       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  TWO-BYTES.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.
       01  TWO-BYTES-BINARY        redefines TWO-BYTES pic 9(4) comp.
      *
       01  APPL-RESULT             pic S9(9)   comp.
           88  APPL-AOK            value 0.
           88  APPL-EOF            value 16.
      *
       01  X1                      pic 9(5)     value 0.
       01  X2                      pic 9(5)     value 0.
       01  X3                      pic 9(5)     value 0.
      *
       01  B1                      pic 9(5)     value 0.
       01  REGISTER-1              pic 9(5)     value 128.
       01  BIT-OFF                 pic X        value '0'.
       01  BIT-ON                  pic X        value '1'.
       01  BTS-PASS-BITS           pic X        value LOW-VALUE.
       01  BTS-PASS-BYTES          pic X(8)     value '00000000'.
       01  EIGHT-BYTES             pic X(8)     value '00000000'.
       01  EBCDIC-BIT-MASK         pic X(8)     value '11110000'.
       01  EBCDIC-SPACE            pic X        value X'40'.
       01  EBCDIC-ZERO             pic X        value X'F0'.
       01  ASCII-BIT-MASK          pic X(8)     value '00110000'.
       01  ASCII-SPACE             pic X        value X'20'.
       01  ASCII-ZERO              pic X        value X'30'.
      *
       01  SYSUT1-TOTAL.
           05  filler      pic X(21)   value 'SYSUT1 line count is '.
           05  SYSUT1-LOC  pic 9(7)    value 0.
       01  SYSUT2-TOTAL.
           05  filler      pic X(21)   value 'SYSUT2 line count is '.
           05  SYSUT2-LOC  pic 9(7)    value 0.
      *
      *****************************************************************
      * The following copy file contains the translation tables for   *
      * the ASCII and EBCDIC conversion. Sections of the tables may   *
      * also be used for case conversion.                             *
      *****************************************************************
       COPY ASCEBCB1.
      *
      *****************************************************************
       PROCEDURE DIVISION.
           perform Z-POST-COPYRIGHT
           perform SYSUT1-OPEN
           perform SYSUT2-OPEN
      *
           perform until SYSUT1-STATUS not = '00'
               perform SYSUT1-READ
               if  SYSUT1-STATUS = '00'
                   add 1 to SYSUT1-LOC
                   perform BUILD-OUTPUT-RECORD
                   perform SYSUT2-WRITE
                   if  SYSUT2-STATUS = '00'
                       add 1 to SYSUT2-LOC
                   end-if
               end-if
           end-perform
      *
           move SYSUT1-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-CONSOLE-MESSAGE
           move SYSUT2-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-CONSOLE-MESSAGE
      *
           if  APPL-EOF
               move 'is Complete...' to MESSAGE-TEXT
           else
               move 'is ABENDING...' to MESSAGE-TEXT
           end-if
           perform Z-DISPLAY-CONSOLE-MESSAGE
      *
           perform SYSUT2-CLOSE
           perform SYSUT1-CLOSE
           GOBACK.
      *
      *****************************************************************
      * The following routines are in alphabetical sequence..         *
      *****************************************************************
      *
      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *>   TransMODE is E2A...
      *>   TransINIT process...
           move all X'20' to SYSUT2-RECORD
      *>   TransLATE...
           move SYSUT1-RECORD(00001:00080) to SYSUT2-RECORD(00001:00080)
           inspect SYSUT2-RECORD(00001:00080)
               converting EBCDIC-INFO to ASCII-INFO
           exit.
      *
      *****************************************************************
      * I/O ROUTINES FOR SYSUT1...                                    *
      *****************************************************************
       SYSUT1-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close SYSUT1-FILE
           if  SYSUT1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT1-Failure-CLOSE...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SYSUT1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SYSUT1-READ.
           read SYSUT1-FILE
           if  SYSUT1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  SYSUT1-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if
           if  APPL-AOK
               CONTINUE
           else
               if  APPL-EOF
                   move 'Y' to SYSUT1-EOF
               else
                   move 'SYSUT1-Failure-GET...' to MESSAGE-TEXT
                   perform Z-DISPLAY-CONSOLE-MESSAGE
                   move SYSUT1-STATUS to IO-STATUS
                   perform Z-DISPLAY-IO-STATUS
                   perform Z-ABEND-PROGRAM
               end-if
           end-if
           exit.
      *---------------------------------------------------------------*
       SYSUT1-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open input SYSUT1-FILE
           if  SYSUT1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to SYSUT1-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT1-Failure-OPEN...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SYSUT1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *
      *****************************************************************
      * I/O ROUTINES FOR SYSUT2...                                    *
      *****************************************************************
       SYSUT2-WRITE.
           if  SYSUT2-OPEN-FLAG = 'C'
               perform SYSUT2-OPEN
           end-if
           write SYSUT2-RECORD
           if  SYSUT2-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  SYSUT2-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if.
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT2-Failure-WRITE...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SYSUT2-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SYSUT2-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open output SYSUT2-FILE
           if  SYSUT2-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to SYSUT2-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT2-Failure-OPEN...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SYSUT2-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SYSUT2-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close SYSUT2-FILE
           if  SYSUT2-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to SYSUT2-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT2-Failure-CLOSE...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SYSUT2-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *
      *****************************************************************
      * ABEND the program, post a message to the console and issue    *
      * a STOP RUN.                                                   *
      *****************************************************************
       Z-ABEND-PROGRAM.
           if  MESSAGE-TEXT not = SPACES
               perform Z-DISPLAY-CONSOLE-MESSAGE
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-CONSOLE-MESSAGE
           add 12 to ZERO giving RETURN-CODE
           STOP RUN
           exit.
      *
      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-CONSOLE-MESSAGE.
           if MESSAGE-TEXT-2 = SPACES
               display MESSAGE-BUFFER(1:79) upon console
           else
               display MESSAGE-BUFFER upon console
           end-if
           move all SPACES to MESSAGE-TEXT
           exit.
      *
      *****************************************************************
      * Display the file status bytes. This routine will display as   *
      * two digits if the full two byte file status is numeric. If    *
      * second byte is non-numeric then it will be treated as a       *
      * binary number.                                                *
      *****************************************************************
       Z-DISPLAY-IO-STATUS.
           if  IO-STATUS not NUMERIC
           or  IO-STAT1    = '9'
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               display '* CBLE2AC1 File-Status-' IO-STAT1 '/'
                       TWO-BYTES-BINARY upon console
           else
               display '* CBLE2AC1 File-Status-' IO-STATUS upon console
           end-if
           exit.
      *
      *****************************************************************
       Z-POST-COPYRIGHT.
           display SIM-TITLE     upon console
           display SIM-COPYRIGHT upon console
           exit.

      *****************************************************************
      *          This program was generated by SimoZAPS               *
      *             A product of SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

The ASCII and EBCDIC Tables
(Next) (Previous) (Table-of-Contents)

The following COBOL copy file (ASCEBCB1.CPY) contains the ASCII and EBCDIC tables. The tables may also be used to do case conversion.

      *****************************************************************
      *         Copyright (C) 1987-2003 SimoTime Enterprises          *
      *                     All Rights Reserved                       *
      *****************************************************************
      *
      *****************************************************************
      *              Provided by SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      * The following tables are used by the INSPECT statement to do  *
      * the conversion betweeen EBCDIC and ASCII.                     *
      *   inspect FIELD-NAME converting EBCDIC-INFO to ASCII-INFO     *
      *   inspect FIELD-NAME converting ASCII-INFO  to EBCDIC-INFO    *
      *                                                               *
      * The tables may also be used to convert between lower and      *
      * upper case.                                                   *
      *   inspect FIELD-NAME converting EBCDIC-LOWER to EBCDIC-UPPER  *
      *   inspect FIELD-NAME converting ASCII-LOWER  to ASCII-UPPER   *
      *****************************************************************
      *
      *>   ------------------------------------------------------------
      *>   **  The EBCDIC Table ...
      *>   **  01                             A B C D E F G H I
      *>   **  02                             J K L M N O P Q R
      *>   **  03                             S T U V W X Y Z
      *>   **  04                             a b c d e f g h i
      *>   **  05                             j k l m n o p q r
      *>   **  06                             s t u v w x y z
      *>   **  07                             0 1 2 3 4 5 6 7 8 9
      *>   **  08                         space . < ( + | & ! $ *
      *>   **  09                             ) ; - / , % _ > ? `
      *>   **  10  7D/7F Single/Double quote  : # @7D =7F [ ] { }
      *>   **  11                             \ ~ ^
       01  EBCDIC-DATA.
           05  EBCDIC-UPPER-CASE-DATA.
               10  filler  pic X(9)  value X'C1C2C3C4C5C6C7C8C9'.
               10  filler  pic X(9)  value X'D1D2D3D4D5D6D7D8D9'.
               10  filler  pic X(8)  value X'E2E3E4E5E6E7E8E9'.
           05  EBCDIC-UPPER          redefines EBCDIC-UPPER-CASE-DATA
                                     pic X(26).
           05  EBCDIC-LOWER-CASE-DATA.
               10  filler  pic X(9)  value X'818283848586878889'.
               10  filler  pic X(9)  value X'919293949596979899'.
               10  filler  pic X(8)  value X'A2A3A4A5A6A7A8A9'.
           05  EBCDIC-LOWER          redefines EBCDIC-LOWER-CASE-DATA
                                     pic X(26).
           05  EBCDIC-DIGITS.
               10  filler  pic X(10) value X'F0F1F2F3F4F5F6F7F8F9'.
           05  EBCDIC-SPECIAL.
               10  filler  pic X(10) value X'404B4C4D4E4F505A5B5C'.
               10  filler  pic X(10) value X'5D5E60616B6C6D6E6F79'.
               10  filler  pic X(10) value X'7A7B7C7D7E7FADBDC0D0'.
               10  filler  pic X(3)  value X'E0A1B0'.
       01  EBCDIC-INFO     redefines EBCDIC-DATA pic X(95).
       01  EBCDIC-TABLE    redefines EBCDIC-DATA.
           05  EBCDIC-BYTE pic X     occurs 95 times.
      *
      *>   ------------------------------------------------------------
      *>   **  The ASCII Table ...
      *>   **  01                             A B C D E F G H I
      *>   **  02                             J K L M N O P Q R
      *>   **  03                             S T U V W X Y Z
      *>   **  04                             a b c d e f g h i
      *>   **  05                             j k l m n o p q r
      *>   **  06                             s t u v w x y z
      *>   **  07                             0 1 2 3 4 5 6 7 8 9
      *>   **  08                         space . < ( + | & ! $ *
      *>   **  09                             ) ; - / , % _ > ? `
      *>   **  10  27/22 Single/Double quote  : # @27 =22 [ ] { }
      *>   **  11                             \ ~ ^
       01  ASCII-DATA.
           05  ASCII-UPPER-CASE-DATA.
               10  filler  pic X(9)  value X'414243444546474849'.
               10  filler  pic X(9)  value X'4A4B4C4D4E4F505152'.
               10  filler  pic X(8)  value X'535455565758595A'.
           05  ASCII-UPPER           redefines ASCII-UPPER-CASE-DATA
                                     pic X(26).
           05  ASCII-LOWER-CASE-DATA.
               10  filler  pic X(9)  value X'616263646566676869'.
               10  filler  pic X(9)  value X'6A6B6C6D6E6F707172'.
               10  filler  pic X(8)  value X'737475767778797A'.
           05  ASCII-LOWER           redefines ASCII-LOWER-CASE-DATA
                                     pic X(26).
           05  ASCII-DIGITS.
               10  filler  pic X(10) value X'30313233343536373839'.
           05  ASCII-SPECIAL.
               10  filler  pic X(10) value X'202E3C282B7C2621242A'.
               10  filler  pic X(10) value X'293B2D2F2C255F3E3F79'.
               10  filler  pic X(10) value X'3A2340273D225B5D7B7D'.
               10  filler  pic X(3)  value X'5C7E5E'.
       01  ASCII-INFO      redefines ASCII-DATA pic X(95).
       01  ASCII-TABLE     redefines ASCII-DATA.
           05  ASCII-BYTE  pic X     occurs 95 times.

Additional Sample Programs in this Packet
(Next) (Previous) (Table-of-Contents)

The following is a list of additional examples of COBOL programs that do data file conversion.

Program Description
zap00101 Convert from an EBCDIC-Sequential file to an ASCII-Text file.
zap00201 Convert from an EBCDIC-Sequential file to an ASCII-Indexed file (Sequential-Add).
zap00301 Convert from an EBCDIC-Sequential file to an ASCII-Sequential file.
zap00401 Convert from an ASCII-Text file to an EBCDIC-Indexed file (Sequential-Add).
zap00501 Convert from an ASCII-Text file to an EBCDIC-Indexed file (Random-Add).

Note: The preceding COBOL source code was generated using SimoZAPS, a product of SimoTime Enterprises.

Summary
(Next) (Previous) (Table-of-Contents)

The purpose of this document is to assist as a tutorial for new programmers or as a quick reference for experienced programmers. These sample programs are made available on an "as-is" basis and may be downloaded, copied and modified for specific situations as long as the copyright information is not removed or changed. As always, it is the programmer's responsibility to thoroughly test all programs.

Software Agreement and Disclaimer
(Next) (Previous) (Table-of-Contents)

Permission to use, copy, modify and distribute this software for any non-commercial purpose and without fee is hereby granted, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.

Permission to use, copy, modify and distribute this software for any commercial purpose requires a fee to be paid to SimoTime Enterprises. Once the fee is received by SimoTime the latest version of the software will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.

SimoTime Enterprises makes no warranty or representations about the suitability of the software for any purpose. It is provided "AS IS" without any express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software.

If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com

Downloads and Links to Similar Pages
(Next) (Previous) (Table-of-Contents)

You may download this example at http://www.simotime.com/sim4dzip.htm#COBOLFileConversionZip .

Please view the complete list of SimoTime Z-Pack Examples at http://www.simotime.com/sim4dzip.htm.

Note: You must be attached to the Internet to download a Z-Pack or view the list.

The File Conversion, Volume 2 suite of programs includes a number of examples for file conversions that are required when migrating data between the PC and an IBM mainframe. Simply click on the following items to download this suite of sample source code.

Take a look at the  Gateway to Technology for Micro Focus for additional discussion and examples for File conversions.

The SimoZAPS Utility Program runs on a Windows platform and has the capability of generating a COBOL program that will do the conversion of sequential and VSAM (KSDS) files between EBCDIC and ASCII. SimoZAPS can also read a sequential file in EBCDIC format and create an ASCII/CRLF file or VSAM Keyed Sequential Data Set in ASCII format. The conversion tables may be viewed or modified to meet unique requirements. The HexCess function of SimoZAPS provides the capability of viewing, finding or patching the contents of a file in hexadecimal.

Check out   The COBOL Connection in the SimoTime Library for more examples of mainframe COBOL techniques and sample code.

Check out   The VSAM-QSAM Connection in the SimoTime Library for more examples of mainframe COBOL techniques and sample code.

This document provides a quick summary of the   File Status Key  for VSAM data sets and QSAM files. The File Status Key is a two character data item. The first character of the status key is known as status key 1; the second character is known as status key 2.

Take a look at the  Table of ASCII, EBCDIC and Binary values.

To review all the information available on this site start at   The SimoTime Home Page.

Comments or Suggestions
(Next) (Previous) (Table-of-Contents)

If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com

About SimoTime Enterprises, LLC
(Next) (Previous) (Table-of-Contents)

Founded in 1987, SimoTime Enterprises is a privately owned, Limited Liability Corporation located in Novato, California. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com


Return-to-Top
Copyright © 1987-2008  SimoTime Enterprises, LLC  All Rights Reserved
When technology complements business
http://www.simotime.com