It turns out the encoding isn't applied to a document loaded as a binary  
file from the filesystem:
that is just loaded with the bits as handed to the call. So load this as a  
text document (put <format>text</format> in the options). Since you expect  
to get ASCII out, that seems the reasonable thing to do.

//Mary

On Tue, 27 Jan 2015 23:30:03 -0800, Vipitha Kapildas  
<[email protected]> wrote:

> Hi,
> I am trying to convert a EBCDIC format file to ASCII using MarkLogic. I  
> am able to convert a simple EBCDIC file text, but when the file contains  
> COMP or COMP -3  colomn type, it stops the conversion and returns the  
> text till the beginning of COMP field.
>
> Here is what I have done till now.
>
> 1.       Kept a EBCDIC file name ZOS.FCUSTDAT.bin in my root folder  
> where MarkLogic is installed.
>
> 2.       Loaded the document into MarkLogic database and specified the  
> encoding format as 'ebcdic-cp-us' using :
>
>
>
> xquery version "1.0-ml";
>
> xdmp:document-load("\ZOS.FCUSTDAT.bin",
>
>    <options xmlns="xdmp:document-load">
>
>       <encoding>ebcdic-cp-us</encoding>
>
>    </options>
>
> )
>
> 3.       Confirmed the file content to be binary using:
>
>
>
> xquery version "1.0-ml";
>
> xdmp:describe(doc("\ZOS.FCUSTDAT.bin ")/node())
>
>
>
> This query returned:
>
> fn:doc("\ZOS.FCUSTDAT.bin")/binary()
>
>
>
> 4.        Using binary-decode I saved the file to ASCII format using:
>
>
>
> xdmp:save(
>
>   '/ test-output.txt',
>
>   text {
>
>     xdmp:binary-decode(doc('ZOS.FCUSTDAT.bin '), 'ebcdic-xml-us') },
>
>   <options xmlns="xdmp:save">
>
>     <output-encoding>ascii</output-encoding>
>
>   </options>)
>
>
>
> The copybook of the input file is as below:
>
>
>
>        01  CUSTOMER-DATA.
>
>            05 CUSTOMER-ID                    PIC 9(6).
>
>            05 PERSONAL-DATA.
>
>               10 CUSTOMER-NAME               PIC X(20).
>
>               10 CUSTOMER-ADDRESS            PIC X(20).
>
>               10 CUSTOMER-PHONE              PIC X(8).
>
>            05 TRANSACTIONS.
>
>               10 TRANSACTION-NBR             PIC 9(9) COMP.
>
>               10 TRANSACTION OCCURS 0 TO 5
>
>                  DEPENDING ON TRANSACTION-NBR.
>
>                 15 TRANSACTION-DATE         PIC X(8).
>
>                  15 FILLER REDEFINES TRANSACTION-DATE.
>
>                     20 TRANSACTION-DAY       PIC X(2).
>
>                     20 FILLER                PIC X.
>
>                     20 TRANSACTION-MONTH     PIC X(2).
>
>                     20 FILLER                PIC X.
>
>                     20 TRANSACTION-YEAR      PIC X(2).
>
>                  15 TRANSACTION-AMOUNT       PIC S9(13)V99 COMP-3.
>
>                  15 TRANSACTION-COMMENT      PIC X(9).
>
>
>
> File is getting encoded into ASCII only till 10 CUSTOMER-PHONE   PIC  
> X(8). The next colomn i.e the COMP field is not getting encoded. Please  
> suggest a solution.
>
>
>
>
>
> Thanks,
>
> Vipitha
>
>
>
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended  
> solely
> for the use of the addressee(s). If you are not the intended recipient,  
> please
> notify the sender by e-mail and delete the original message. Further,  
> you are not
> to copy, disclose, or distribute this e-mail or its contents to any  
> other person and
> any such actions are unlawful. This e-mail may contain viruses. Infosys  
> has taken
> every reasonable precaution to minimize this risk, but is not liable for  
> any damage
> you may sustain as a result of any virus in this e-mail. You should  
> carry out your
> own virus checks before opening the e-mail or attachment. Infosys  
> reserves the
> right to monitor and review the content of all messages sent to or from  
> this e-mail
> address. Messages sent to or from this e-mail address may be stored on  
> the
> Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***


-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to