Keith wrote:
"I have read other posts about the stringToByte service, but when I run it with a string it doesn’t seem to give me what I’m looking for, for example an input of ‘-21’ it returns: ‘[B@1ec90c3’ and in EBCDIC, the proper output should be ‘2J’. "
The stringToByte service will not do entirely what you want. The output you are seeing is the Java address of the resulting byte array structure, not a string represenation of a zoned decimal. Once converted to bytes, the data isn’t really human readable. You’ll need to do some extra work to create zoned/packed decimal representations. The links on the post that RMG referred to provide good definitions of what signed/zoned and packed decimal are if you need some more definition.
“Convert a string to EBCDIC, append it to a flat file,
If the fields needs to be packed decimal, first pack it then convert??”
Close. You definitely need to convert fields that should be zoned or packed decimal (they are not the same thing) using some Java code. This will probably be the hardest part for you if you’re not familiar with packed/zoned data and not a Java programmer. You might want to team up with someone within your company to do this part.
You may not need to convert to EBCDIC yourself as the mainframe normally can do the conversion for you–quite often as part of the FTP server facilities. If you need to do the convert, the stringToBytes call with code page/encoding as CP037 should do the trick. The pub.client:ftp service accepts an encoding parameter when the content parameter is a string, which if you set to CP037 should do the same thing as stringToBytes. Curiously, the pub.client.ftp:put does not accept a encoding parameter.
If you don’t do the EBCDIC conversion yourself, set the transfer mode to ASCII, which flags the mainframe to convert it. If you do the conversion, set the mode to binary.
As always, someone please correct me if I’m wrong on any detail here. I’m doing a lot of this from memory.
HTH.
#Integration-Server-and-ESB#Flow-and-Java-services#webMethods