Unable to Convert from Mainframe Binary to ASCII Type

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
shamshad
Premium Member
Premium Member
Posts: 147
Joined: Wed Aug 25, 2004 1:39 pm
Location: Detroit,MI

Unable to Convert from Mainframe Binary to ASCII Type

Post by shamshad »

I am connecting to a mainframe file using a ftp stage and reading the
source file as "binary" as below settings

Data Representation Type : Binary
Check data against Metadata : Yes
Line Termination : No

Then I am reading the whole file as varchar(90) which is the total lenght of record in mainframe and then using conversion as below

FOR PIC X (01) :-
DataTypeEbcdicToAscii(FTP_MF_Data.VarRec[2,1])

FOR PIC S9(9) USAGE COMP:-Fmt(DataTypePicComp(FTP_MF_Data.VarRec[35,4]),"9'0'R")

This conversion is not working...any ideas what might be happening wrong?
rcanaran
Premium Member
Premium Member
Posts: 64
Joined: Wed Jun 14, 2006 3:51 pm
Location: CANADA

Re: Unable to Convert from Mainframe Binary to ASCII Type

Post by rcanaran »

What is the result you are getting? What was the result you were expecting? Or does the job not compile/execute?

When you view the file in a text editor, can you read the text portions? Or are they also in EBCDIC?
rcanaran
Premium Member
Premium Member
Posts: 64
Joined: Wed Jun 14, 2006 3:51 pm
Location: CANADA

Re: Unable to Convert from Mainframe Binary to ASCII Type

Post by rcanaran »

Sorry. missed the BINARY spec. So the entire file should be EBCDIC.

Don't convert the field (or any COMP / COMP-3 fields) from EBCDIC to binary. Do that ONLY to the text fields or display numeric fields.

The datatype for a binary numeric (PIC S9 COMP) field should be INTEGER (length could be 1 to 3). And Datastage shoud interpret this number correctly.
Post Reply