Does isCOBOL support EBCDIC? How?


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



Article ID: 127
Created: May 5, 2010
Last Updated: May 5, 2010
Author: Support KB Author

Online URL: https://support.veryant.com/phpkb/article.php?id=127