Dear Sir,
we've a procedure tha uses 127 programs written in COBOL that run on HOST
and we are using the same sources on PC-Windows2000 with some little modifies.
We have a problem when the data is passed from PIC X -> System.String and
from System.String -> PIC X. We can't change PIC X to PIC N(ational) that
manages Unicode. The modify
To simulate this problem we have made this little sample.
The test program use a pure ascii file (not unicode) in input called
CIRILIN.txt and write in output the data that it reads.
Follow the source:
IDENTIFICATION DIVISION.
PROGRAM-ID. Program1 AS "CirilConsole.Program1".
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
DECIMAL-POINT IS COMMA.
REPOSITORY.
CLASS SYS-STRING AS "System.String".
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT CIRILIN ASSIGN TO 'c:\CirilConsole\CIRILIN.txt'.
SELECT CIRILOUT ASSIGN TO 'c:\CirilConsole\CIRILOUT.txt'.
DATA DIVISION.
FILE SECTION.
FD CIRILIN LABEL RECORD IS STANDARD
BLOCK CONTAINS 1 RECORDS
DATA RECORD IS REC-CIRILIN.
01 REC-CIRILIN PIC X(80).
FD CIRILOUT LABEL RECORD IS STANDARD
BLOCK CONTAINS 1 RECORDS
DATA RECORD IS REC-CIRILOUT.
01 REC-CIRILOUT PIC X(80).
WORKING-STORAGE SECTION.
01 AREA-STRING OBJECT REFERENCE SYS-STRING.
01 WRK-FINE-PGM PIC X.
PROCEDURE DIVISION.
OPEN INPUT CIRILIN.
OPEN OUTPUT CIRILOUT.
READ CIRILIN.
DISPLAY 'READ CIRILLICO ' REC-CIRILIN.
-----------------> begin HERE IT WRONGS <---------------------------
SET AREA-STRING TO REC-CIRILIN.
-----------------> end HERE WRONGS <---------------------------
SET REC-CIRILOUT TO AREA-STRING.
WRITE REC-CIRILOUT.
DISPLAY 'WRITE CIRILLICO ' REC-CIRILOUT.
CLOSE CIRILIN
CIRILOUT.
DISPLAY 'CLOSE > '.
ACCEPT WRK-FINE-PGM.
STOP RUN.
Here, the program saves data in a file in a wrong way.
Follow CIRILIN.txt, Input file:
[îààÿîþþúþéýéúéýó3îîæîæ5467îýÿüàÿüúàÀóÿÜß122344ßÎÆÆÎÀÃÆ]
Follow CIRILOUT.txt, Output file:
[35467122344 ]
How can convert System.String to PIC X in the right way ?
Should I pass through binary data ?
Is there a solution ?
Thanks in advance.
we've a procedure tha uses 127 programs written in COBOL that run on HOST
and we are using the same sources on PC-Windows2000 with some little modifies.
We have a problem when the data is passed from PIC X -> System.String and
from System.String -> PIC X. We can't change PIC X to PIC N(ational) that
manages Unicode. The modify
To simulate this problem we have made this little sample.
The test program use a pure ascii file (not unicode) in input called
CIRILIN.txt and write in output the data that it reads.
Follow the source:
IDENTIFICATION DIVISION.
PROGRAM-ID. Program1 AS "CirilConsole.Program1".
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
DECIMAL-POINT IS COMMA.
REPOSITORY.
CLASS SYS-STRING AS "System.String".
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT CIRILIN ASSIGN TO 'c:\CirilConsole\CIRILIN.txt'.
SELECT CIRILOUT ASSIGN TO 'c:\CirilConsole\CIRILOUT.txt'.
DATA DIVISION.
FILE SECTION.
FD CIRILIN LABEL RECORD IS STANDARD
BLOCK CONTAINS 1 RECORDS
DATA RECORD IS REC-CIRILIN.
01 REC-CIRILIN PIC X(80).
FD CIRILOUT LABEL RECORD IS STANDARD
BLOCK CONTAINS 1 RECORDS
DATA RECORD IS REC-CIRILOUT.
01 REC-CIRILOUT PIC X(80).
WORKING-STORAGE SECTION.
01 AREA-STRING OBJECT REFERENCE SYS-STRING.
01 WRK-FINE-PGM PIC X.
PROCEDURE DIVISION.
OPEN INPUT CIRILIN.
OPEN OUTPUT CIRILOUT.
READ CIRILIN.
DISPLAY 'READ CIRILLICO ' REC-CIRILIN.
-----------------> begin HERE IT WRONGS <---------------------------
SET AREA-STRING TO REC-CIRILIN.
-----------------> end HERE WRONGS <---------------------------
SET REC-CIRILOUT TO AREA-STRING.
WRITE REC-CIRILOUT.
DISPLAY 'WRITE CIRILLICO ' REC-CIRILOUT.
CLOSE CIRILIN
CIRILOUT.
DISPLAY 'CLOSE > '.
ACCEPT WRK-FINE-PGM.
STOP RUN.
Here, the program saves data in a file in a wrong way.
Follow CIRILIN.txt, Input file:
[îààÿîþþúþéýéúéýó3îîæîæ5467îýÿüàÿüúàÀóÿÜß122344ßÎÆÆÎÀÃÆ]
Follow CIRILOUT.txt, Output file:
[35467122344 ]
How can convert System.String to PIC X in the right way ?
Should I pass through binary data ?
Is there a solution ?
Thanks in advance.