> I have a txt file which i want to convert to mastercard ipm format(EBCDIC), How do I go about this
Read the ascii file and at writing time use the charset IBM1047 to convert to ebcdic.
The following snippet just writes a sample 12345678 to a file using IBM1047 charset and the binary file will contain the non printable characters for EBCDIC f0f1f2f3f4f5f6f7f8.
Alternatively, if you don’t want to do it this way, you can use the ISOUtil.ascii2ebcdic https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/iso/ISOUtil.java#L102
pass in your ascii string data and get the ebcdic byte array that you can write. The isoutil method uses the IBM charset in the background
This is a quick and dirty snippet to give you an idea.
Path filePath = Paths.get("/path to write to/", "ebcdic.txt"); if (Files.notExists(filePath)) { Files.createFile(filePath); } Files.createDirectories(filePath.getParent()); BufferedWriter y = Files.newBufferedWriter(filePath, Charset.forName("IBM1047"), StandardOpenOption.WRITE); y.write("123456789"); // this would be data from your ascii file that needs conversion to ebcdic y.close();The output file will have funny characters. If viewed in an editor that understand ebcdic (or hex ) would show you F0..F8
-chhil
This is the txt file
This is the txt file
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/077de663-fc02-467d-9900-0797bf935083n%40googlegroups.com.