Does isCOBOL support EBCDIC? How?

Question ID : 127
Created on 2010-05-05 at 1:15 PM
Author : Veryant Support [support@veryant.com]

Online URL : http://support.veryant.com/support/phpkb/question.php?ID=127



isCOBOL supports EBCDIC in data files, working-storage, and linkage parameters.

To configure isCOBOL to treat all data as EBCDIC set the iscobol.encoding property. For example,

iscobol.encoding=Cp037

iscobol.encoding can be set to any of the Java Canonical Names for java.io and java.lang API. You can find these listed in the Java SE Documentation Supported Encodings.

isCOBOL also provides a library routine C$CODESET that can be used to convert from one encoding to another. See the isCOBOL Documentation : Appendices : Library Routines.

For example, the following code converts "test string" from ASCII to EBCDIC:

working-storage section.                                         

01  TRANS-FLAG PIC 9(2) COMP-X.
01  TRANS-LENGTH PIC 9(9) COMP-X. 
01  TRANS-STRING PIC X(80).
01  ENCODING PIC X(6)  value "Cp037".
01  RETURN-VALUE  PIC 9(04)  VALUE 0.

procedure division.                                             
                                                                 
main-logic. 
    move  1            to TRANS-FLAG.
    move 80            to TRANS-LENGTH.
    move "test string" to TRANS-STRING.
    
    CALL "C$CODESET" 
       USING TRANS-FLAG, TRANS-LENGTH,
       TRANS-STRING , ENCODING
               GIVING RETURN-VALUE



Back to Original Question