[jpos-users] Conversion of hex value to EBCDIC Format

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[jpos-users] Conversion of hex value to EBCDIC Format

Karimullah Syed

Hi All,


Data Elements
===============================
1100 2 :  
 3 :  004000
 4 :  000000001000
 11 :  000001
 12 :  010818004699
 14 :  
 19 :  356
 22 :  101150600120
 24 :  180
 25 :  1234
 26 :  5399
 42 :  200000000019
 49 :  356
=======================================
 
Hexa dump
====================================
1100703425c000408000164862698906428354004000000000001000000001010817262975130103561011506001200180123453993230303030303030303031392020200003333536

So we have required converting to EBCDIC Format

Ex:
(Bank Expecting) the below format
The Auth request packet should be in HEX EBCDIC format and would like –
AuthorizationRequestParam=F1F1F0F0703424C128E08200F1F5F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7F0F0F4F0F0F0F0F0F0F0F0F0F0F0F3F0F0F0F3F5F0F0F0F2F1F7F0F7F0F3F1F6F0F5F2F0F2F1F0F3F3F5F6F5F1F0F1F0F1F5F1F1F1F4C3F1F9F0F0F7F0F1F1F1F1F1F0F0F0F0F0F0F0F1F6F2F3F7F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7C4F2F1F0F3F2F0F1F1F5F0F4F1F2F3F4F5F0F0F0F0F0F7F1F8F4F1F0F3F5F0F0F0F2FXFXFXFXFXF0F7F1FXFXFXFXFXFXFXFXF8F54040404040F4F9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXD4E0F5XXXXXXXXXXXXXXXXXXXXXXXXXXF6F0F5F7C1C7D5E20001F34BC16BC1AC7C7D0706020103A4200224FC27EA0069000000800017070300000000003000035603563C000000000000000080


After Parsing the above
(Bank Excepting) the below format

F1F1F0F0
703424C128E08200
F1F5 F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7
F0F0F4F0F0F0
F0F0F0F0F0F0F0F0F3F0F0F0
F3F5F0F0F0F2
F1F7F0F7F0F3F1F6F0F5F2F0
F2F1F0F3
F3F5F6
F5F1F0F1F0F1F5F1F1F1F4C3
F1F9F0
F0F7F0F1
F1F1F1F1
F0F0F0F0F0F0F0F1F6F2F3F7
F3F7F4
F2F4F5F0F0F1F7F4F1F0F0F7C4F2F1F0F3F2F0F1F1F5F0F4F1F2F3F4F5F0F0F0F0F0F7F1F8F4F1F0F3F5F0F0F0F2FXFXFXFXFXF0F7F1FXFXFXFXFXFXFXFXF8F54040404040F4F9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXD4E0F5XXXXXXXXXXXXXXXXXXXXXXXXXXF6F0F5F7C1C7D5E20001F34BC16BC1AC7C7D0706020103A4200224FC27EA0069000000800017070300000000003000035603563C000000000000000080
=========================
Snippet code :
=========================
Below are the step we use to follow
Packing the Data Elements
byte[] a2 = getIsoMessage().pack();

public static String toHexString (byte[] b)  { 
StringBuilder sb = new StringBuilder( b.length * 2 ); 
for ( int i=0 ; i<b.length ; i++ ) {  
//look up high nibble char 
sb.append( hexChar [ ( b[ i] & 0xf0 ) >>> 4  ] ) ; 
//look up low nibble char 
sb.append( hexChar [ b[ i] & 0x0f ] ) ; 
return sb.toString() ; 
}
==================================
After packing the data converting to hex value
====================================
String msg = FormatUtils.toHexString(args);
Ex : 1100703425c000408000164862698906428354004000000000001000000001010817262975130103561011506001200180123453993230303030303030303031392020200003333536

After Parsing Hexa dump value
1100
703425c00040800016
4862698906428354
004000
000000001000
000001
010817262975
1301
0356  
101150600120
0180  
1234
5399
32 30303030303030303031392020200003  
33 35 36 
==========================
Converting the Hex value to EBCDIC Format
========================
byte[] bytes = msg.getBytes("CP1047");
int i;
for (i = 0; i < bytes.length; i++) {
formattedString += String.format("%X", bytes[i]);
logger.info(formattedString);
}

after converting to EBCDIC Format
below is the result

F1F1F0F0
F7F0F3F4F2F583F0F0F0F4F0F8F0F0F0F1F6
F4F8F6F2F6F9F8F9F0F6F4F2F8F3F5F4
F0F0F4F0F0F0F0F0F0F0F0F0F0F0F1F0F0F0F0F0F0F0F0F1F0F2F0F8F1F2F0F1F3F7F1F9F1F3F0F1F0F3F5F6F1F0F1F1F5F0F6F0F0F1F2F0F0F1F8F0F1F2F3F4F5F3F9F9F3F2F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F1F3F9F2F0F2F0F2F0F0F0F0F3F3F3F3F5F3F6

So my concern is even bit map is appended with 'F' which should not happened,may be what i'm converting is also not correct, it should be the above behaviour what Bank Expecting,Please guide me in the conversion if possible provide me the code snippet for the same.



Thanks,
Karimullah Syed.

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/ba9e2e31-435a-4027-8a1a-ec0f30d5c170%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[jpos-users] Re: Conversion of hex value to EBCDIC Format

Karimullah Syed
Please Suggest

On Wednesday, 2 August 2017 12:13:06 UTC+5:30, Karimullah Syed wrote:

Hi All,


Data Elements
===============================
1100 2 :  
 3 :  004000
 4 :  000000001000
 11 :  000001
 12 :  010818004699
 14 :  
 19 :  356
 22 :  101150600120
 24 :  180
 25 :  1234
 26 :  5399
 42 :  200000000019
 49 :  356
=======================================
 
Hexa dump
====================================
1100703425c000408000164862698906428354004000000000001000000001010817262975130103561011506001200180123453993230303030303030303031392020200003333536

So we have required converting to EBCDIC Format

Ex:
(Bank Expecting) the below format
The Auth request packet should be in HEX EBCDIC format and would like –
AuthorizationRequestParam=F1F1F0F0703424C128E08200F1F5F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7F0F0F4F0F0F0F0F0F0F0F0F0F0F0F3F0F0F0F3F5F0F0F0F2F1F7F0F7F0F3F1F6F0F5F2F0F2F1F0F3F3F5F6F5F1F0F1F0F1F5F1F1F1F4C3F1F9F0F0F7F0F1F1F1F1F1F0F0F0F0F0F0F0F1F6F2F3F7F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7C4F2F1F0F3F2F0F1F1F5F0F4F1F2F3F4F5F0F0F0F0F0F7F1F8F4F1F0F3F5F0F0F0F2FXFXFXFXFXF0F7F1FXFXFXFXFXFXFXFXF8F54040404040F4F9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXD4E0F5XXXXXXXXXXXXXXXXXXXXXXXXXXF6F0F5F7C1C7D5E20001F34BC16BC1AC7C7D0706020103A4200224FC27EA0069000000800017070300000000003000035603563C000000000000000080


After Parsing the above
(Bank Excepting) the below format

F1F1F0F0
703424C128E08200
F1F5 F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7
F0F0F4F0F0F0
F0F0F0F0F0F0F0F0F3F0F0F0
F3F5F0F0F0F2
F1F7F0F7F0F3F1F6F0F5F2F0
F2F1F0F3
F3F5F6
F5F1F0F1F0F1F5F1F1F1F4C3
F1F9F0
F0F7F0F1
F1F1F1F1
F0F0F0F0F0F0F0F1F6F2F3F7
F3F7F4
F2F4F5F0F0F1F7F4F1F0F0F7C4F2F1F0F3F2F0F1F1F5F0F4F1F2F3F4F5F0F0F0F0F0F7F1F8F4F1F0F3F5F0F0F0F2FXFXFXFXFXF0F7F1FXFXFXFXFXFXFXFXF8F54040404040F4F9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXD4E0F5XXXXXXXXXXXXXXXXXXXXXXXXXXF6F0F5F7C1C7D5E20001F34BC16BC1AC7C7D0706020103A4200224FC27EA0069000000800017070300000000003000035603563C000000000000000080
=========================
Snippet code :
=========================
Below are the step we use to follow
Packing the Data Elements
byte[] a2 = getIsoMessage().pack();

public static String toHexString (byte[] b)  { 
StringBuilder sb = new StringBuilder( b.length * 2 ); 
for ( int i=0 ; i<b.length ; i++ ) {  
//look up high nibble char 
sb.append( hexChar [ ( b[ i] & 0xf0 ) >>> 4  ] ) ; 
//look up low nibble char 
sb.append( hexChar [ b[ i] & 0x0f ] ) ; 
return sb.toString() ; 
}
==================================
After packing the data converting to hex value
====================================
String msg = FormatUtils.toHexString(args);
Ex : 1100703425c000408000164862698906428354004000000000001000000001010817262975130103561011506001200180123453993230303030303030303031392020200003333536

After Parsing Hexa dump value
1100
703425c00040800016
4862698906428354
004000
000000001000
000001
010817262975
1301
0356  
101150600120
0180  
1234
5399
32 30303030303030303031392020200003  
33 35 36 
==========================
Converting the Hex value to EBCDIC Format
========================
byte[] bytes = msg.getBytes("CP1047");
int i;
for (i = 0; i < bytes.length; i++) {
formattedString += String.format("%X", bytes[i]);
<a href="http://logger.info" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flogger.info\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flogger.info\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;">logger.info(formattedString);
}

after converting to EBCDIC Format
below is the result

F1F1F0F0
F7F0F3F4F2F583F0F0F0F4F0F8F0F0F0F1F6
F4F8F6F2F6F9F8F9F0F6F4F2F8F3F5F4
F0F0F4F0F0F0F0F0F0F0F0F0F0F0F1F0F0F0F0F0F0F0F0F1F0F2F0F8F1F2F0F1F3F7F1F9F1F3F0F1F0F3F5F6F1F0F1F1F5F0F6F0F0F1F2F0F0F1F8F0F1F2F3F4F5F3F9F9F3F2F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F1F3F9F2F0F2F0F2F0F0F0F0F3F3F3F3F5F3F6

So my concern is even bit map is appended with 'F' which should not happened,may be what i'm converting is also not correct, it should be the above behaviour what Bank Expecting,Please guide me in the conversion if possible provide me the code snippet for the same.



Thanks,
Karimullah Syed.

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/1c7a69c9-cc12-44b4-9943-6df300d102a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Conversion of hex value to EBCDIC Format

chhil
In reply to this post by Karimullah Syed
You should define your field packager to have fields of type IFE* (look at the packagers available at https://github.com/jpos/jPOS/tree/master/jpos/src/main/java/org/jpos/iso)

This will pack (to ebcidic bytes) and unpack (from ebcdic bytes).

-chhil

On Wed, Aug 2, 2017 at 12:13 PM, Karimullah Syed <[hidden email]> wrote:

Hi All,


Data Elements
===============================
1100 2 :  
 3 :  004000
 4 :  000000001000
 11 :  000001
 12 :  010818004699
 14 :  
 19 :  356
 22 :  101150600120
 24 :  180
 25 :  1234
 26 :  5399
 42 :  200000000019
 49 :  356
=======================================
 
Hexa dump
====================================
1100703425c000408000164862698906428354004000000000001000000001010817262975130103561011506001200180123453993230303030303030303031392020200003333536

So we have required converting to EBCDIC Format

Ex:
(Bank Expecting) the below format
The Auth request packet should be in HEX EBCDIC format and would like –
AuthorizationRequestParam=F1F1F0F0703424C128E08200F1F5F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7F0F0F4F0F0F0F0F0F0F0F0F0F0F0F3F0F0F0F3F5F0F0F0F2F1F7F0F7F0F3F1F6F0F5F2F0F2F1F0F3F3F5F6F5F1F0F1F0F1F5F1F1F1F4C3F1F9F0F0F7F0F1F1F1F1F1F0F0F0F0F0F0F0F1F6F2F3F7F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7C4F2F1F0F3F2F0F1F1F5F0F4F1F2F3F4F5F0F0F0F0F0F7F1F8F4F1F0F3F5F0F0F0F2FXFXFXFXFXF0F7F1FXFXFXFXFXFXFXFXF8F54040404040F4F9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXD4E0F5XXXXXXXXXXXXXXXXXXXXXXXXXXF6F0F5F7C1C7D5E20001F34BC16BC1AC7C7D0706020103A4200224FC27EA0069000000800017070300000000003000035603563C000000000000000080


After Parsing the above
(Bank Excepting) the below format

F1F1F0F0
703424C128E08200
F1F5 F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7
F0F0F4F0F0F0
F0F0F0F0F0F0F0F0F3F0F0F0
F3F5F0F0F0F2
F1F7F0F7F0F3F1F6F0F5F2F0
F2F1F0F3
F3F5F6
F5F1F0F1F0F1F5F1F1F1F4C3
F1F9F0
F0F7F0F1
F1F1F1F1
F0F0F0F0F0F0F0F1F6F2F3F7
F3F7F4
F2F4F5F0F0F1F7F4F1F0F0F7C4F2F1F0F3F2F0F1F1F5F0F4F1F2F3F4F5F0F0F0F0F0F7F1F8F4F1F0F3F5F0F0F0F2FXFXFXFXFXF0F7F1FXFXFXFXFXFXFXFXF8F54040404040F4F9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXD4E0F5XXXXXXXXXXXXXXXXXXXXXXXXXXF6F0F5F7C1C7D5E20001F34BC16BC1AC7C7D0706020103A4200224FC27EA0069000000800017070300000000003000035603563C000000000000000080
=========================
Snippet code :
=========================
Below are the step we use to follow
Packing the Data Elements
byte[] a2 = getIsoMessage().pack();

public static String toHexString (byte[] b)  { 
StringBuilder sb = new StringBuilder( b.length * 2 ); 
for ( int i=0 ; i<b.length ; i++ ) {  
//look up high nibble char 
sb.append( hexChar [ ( b[ i] & 0xf0 ) >>> 4  ] ) ; 
//look up low nibble char 
sb.append( hexChar [ b[ i] & 0x0f ] ) ; 
return sb.toString() ; 
}
==================================
After packing the data converting to hex value
====================================
String msg = FormatUtils.toHexString(args);
Ex : 1100703425c000408000164862698906428354004000000000001000000001010817262975130103561011506001200180123453993230303030303030303031392020200003333536

After Parsing Hexa dump value
1100
703425c00040800016
4862698906428354
004000
000000001000
000001
010817262975
1301
0356  
101150600120
0180  
1234
5399
32 30303030303030303031392020200003  
33 35 36 
==========================
Converting the Hex value to EBCDIC Format
========================
byte[] bytes = msg.getBytes("CP1047");
int i;
for (i = 0; i < bytes.length; i++) {
formattedString += String.format("%X", bytes[i]);
logger.info(formattedString);
}

after converting to EBCDIC Format
below is the result

F1F1F0F0
F7F0F3F4F2F583F0F0F0F4F0F8F0F0F0F1F6
F4F8F6F2F6F9F8F9F0F6F4F2F8F3F5F4
F0F0F4F0F0F0F0F0F0F0F0F0F0F0F1F0F0F0F0F0F0F0F0F1F0F2F0F8F1F2F0F1F3F7F1F9F1F3F0F1F0F3F5F6F1F0F1F1F5F0F6F0F0F1F2F0F0F1F8F0F1F2F3F4F5F3F9F9F3F2F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F1F3F9F2F0F2F0F2F0F0F0F0F3F3F3F3F5F3F6

So my concern is even bit map is appended with 'F' which should not happened,may be what i'm converting is also not correct, it should be the above behaviour what Bank Expecting,Please guide me in the conversion if possible provide me the code snippet for the same.



Thanks,
Karimullah Syed.

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/ba9e2e31-435a-4027-8a1a-ec0f30d5c170%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAPazefDXShOfF%3DPPaGPCcdLSh1yH2CyPhgG%2BK4eN-C1%2BF8X71A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Re: Conversion of hex value to EBCDIC Format

jPOS - Users mailing list
In reply to this post by Karimullah Syed
On 02/08/17 12:20, Karimullah Syed wrote:
> Please Suggest
Please don't feel the need to 'chase' an answer on a mailing list; it is
very likely to have the opposite effect you wanted.

--
Mark

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/4e2109a7-bf8f-e249-176f-62984e6ba30a%40talktalk.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Conversion of hex value to EBCDIC Format

karim.consultant
In reply to this post by chhil
Thanks Chill it works for me.

On Wednesday, August 2, 2017 at 8:12:37 PM UTC+5:30, chhil wrote:
You should define your field packager to have fields of type IFE* (look at the packagers available at <a href="https://github.com/jpos/jPOS/tree/master/jpos/src/main/java/org/jpos/iso" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjpos%2FjPOS%2Ftree%2Fmaster%2Fjpos%2Fsrc%2Fmain%2Fjava%2Forg%2Fjpos%2Fiso\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH_9nHbga3AY1SsiwjN-bQaU839wg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjpos%2FjPOS%2Ftree%2Fmaster%2Fjpos%2Fsrc%2Fmain%2Fjava%2Forg%2Fjpos%2Fiso\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH_9nHbga3AY1SsiwjN-bQaU839wg&#39;;return true;">https://github.com/jpos/jPOS/tree/master/jpos/src/main/java/org/jpos/iso)

This will pack (to ebcidic bytes) and unpack (from ebcdic bytes).

-chhil

On Wed, Aug 2, 2017 at 12:13 PM, Karimullah Syed <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="2YiR8tfFBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">syedka...@...> wrote:

Hi All,


Data Elements
===============================
1100 2 :  
 3 :  004000
 4 :  000000001000
 11 :  000001
 12 :  010818004699
 14 :  
 19 :  356
 22 :  101150600120
 24 :  180
 25 :  1234
 26 :  5399
 42 :  200000000019
 49 :  356
=======================================
 
Hexa dump
====================================
1100703425c000408000164862698906428354004000000000001000000001010817262975130103561011506001200180123453993230303030303030303031392020200003333536

So we have required converting to EBCDIC Format

Ex:
(Bank Expecting) the below format
The Auth request packet should be in HEX EBCDIC format and would like –
AuthorizationRequestParam=F1F1F0F0703424C128E08200F1F5F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7F0F0F4F0F0F0F0F0F0F0F0F0F0F0F3F0F0F0F3F5F0F0F0F2F1F7F0F7F0F3F1F6F0F5F2F0F2F1F0F3F3F5F6F5F1F0F1F0F1F5F1F1F1F4C3F1F9F0F0F7F0F1F1F1F1F1F0F0F0F0F0F0F0F1F6F2F3F7F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7C4F2F1F0F3F2F0F1F1F5F0F4F1F2F3F4F5F0F0F0F0F0F7F1F8F4F1F0F3F5F0F0F0F2FXFXFXFXFXF0F7F1FXFXFXFXFXFXFXFXF8F54040404040F4F9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXD4E0F5XXXXXXXXXXXXXXXXXXXXXXXXXXF6F0F5F7C1C7D5E20001F34BC16BC1AC7C7D0706020103A4200224FC27EA0069000000800017070300000000003000035603563C000000000000000080


After Parsing the above
(Bank Excepting) the below format

F1F1F0F0
703424C128E08200
F1F5 F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7
F0F0F4F0F0F0
F0F0F0F0F0F0F0F0F3F0F0F0
F3F5F0F0F0F2
F1F7F0F7F0F3F1F6F0F5F2F0
F2F1F0F3
F3F5F6
F5F1F0F1F0F1F5F1F1F1F4C3
F1F9F0
F0F7F0F1
F1F1F1F1
F0F0F0F0F0F0F0F1F6F2F3F7
F3F7F4
F2F4F5F0F0F1F7F4F1F0F0F7C4F2F1F0F3F2F0F1F1F5F0F4F1F2F3F4F5F0F0F0F0F0F7F1F8F4F1F0F3F5F0F0F0F2FXFXFXFXFXF0F7F1FXFXFXFXFXFXFXFXF8F54040404040F4F9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXD4E0F5XXXXXXXXXXXXXXXXXXXXXXXXXXF6F0F5F7C1C7D5E20001F34BC16BC1AC7C7D0706020103A4200224FC27EA0069000000800017070300000000003000035603563C000000000000000080
=========================
Snippet code :
=========================
Below are the step we use to follow
Packing the Data Elements
byte[] a2 = getIsoMessage().pack();

public static String toHexString (byte[] b)  { 
StringBuilder sb = new StringBuilder( b.length * 2 ); 
for ( int i=0 ; i<b.length ; i++ ) {  
//look up high nibble char 
sb.append( hexChar [ ( b[ i] & 0xf0 ) >>> 4  ] ) ; 
//look up low nibble char 
sb.append( hexChar [ b[ i] & 0x0f ] ) ; 
return sb.toString() ; 
}
==================================
After packing the data converting to hex value
====================================
String msg = FormatUtils.toHexString(args);
Ex : 1100703425c000408000164862698906428354004000000000001000000001010817262975130103561011506001200180123453993230303030303030303031392020200003333536

After Parsing Hexa dump value
1100
703425c00040800016
4862698906428354
004000
000000001000
000001
010817262975
1301
0356  
101150600120
0180  
1234
5399
32 30303030303030303031392020200003  
33 35 36 
==========================
Converting the Hex value to EBCDIC Format
========================
byte[] bytes = msg.getBytes("CP1047");
int i;
for (i = 0; i < bytes.length; i++) {
formattedString += String.format("%X", bytes[i]);
<a href="http://logger.info" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flogger.info\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flogger.info\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;">logger.info(formattedString);
}

after converting to EBCDIC Format
below is the result

F1F1F0F0
F7F0F3F4F2F583F0F0F0F4F0F8F0F0F0F1F6
F4F8F6F2F6F9F8F9F0F6F4F2F8F3F5F4
F0F0F4F0F0F0F0F0F0F0F0F0F0F0F1F0F0F0F0F0F0F0F0F1F0F2F0F8F1F2F0F1F3F7F1F9F1F3F0F1F0F3F5F6F1F0F1F1F5F0F6F0F0F1F2F0F0F1F8F0F1F2F3F4F5F3F9F9F3F2F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F1F3F9F2F0F2F0F2F0F0F0F0F3F3F3F3F5F3F6

So my concern is even bit map is appended with 'F' which should not happened,may be what i'm converting is also not correct, it should be the above behaviour what Bank Expecting,Please guide me in the conversion if possible provide me the code snippet for the same.



Thanks,
Karimullah Syed.

--
--
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: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="2YiR8tfFBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">sa...@...
---
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="2YiR8tfFBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jpos-users+...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="2YiR8tfFBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jpos-...@....
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jpos-users/ba9e2e31-435a-4027-8a1a-ec0f30d5c170%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jpos-users/ba9e2e31-435a-4027-8a1a-ec0f30d5c170%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jpos-users/ba9e2e31-435a-4027-8a1a-ec0f30d5c170%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jpos-users/ba9e2e31-435a-4027-8a1a-ec0f30d5c170%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.


Disclaimer: This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended addressee, or the person responsible for delivering it to them, you may not copy, forward disclose or otherwise use it or any part of it in any way. To do so may be unlawful. If you receive this e-mail by mistake, please advise the sender immediately.

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/9b165760-f5db-4e2e-87d6-03c0e4e62a09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] Conversion of hex value to EBCDIC Format

karim.consultant
In reply to this post by chhil
Thanks Chill it works for me.

On Wednesday, August 2, 2017 at 8:12:37 PM UTC+5:30, chhil wrote:
You should define your field packager to have fields of type IFE* (look at the packagers available at <a href="https://github.com/jpos/jPOS/tree/master/jpos/src/main/java/org/jpos/iso" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjpos%2FjPOS%2Ftree%2Fmaster%2Fjpos%2Fsrc%2Fmain%2Fjava%2Forg%2Fjpos%2Fiso\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH_9nHbga3AY1SsiwjN-bQaU839wg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjpos%2FjPOS%2Ftree%2Fmaster%2Fjpos%2Fsrc%2Fmain%2Fjava%2Forg%2Fjpos%2Fiso\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH_9nHbga3AY1SsiwjN-bQaU839wg&#39;;return true;">https://github.com/jpos/jPOS/tree/master/jpos/src/main/java/org/jpos/iso)

This will pack (to ebcidic bytes) and unpack (from ebcdic bytes).

-chhil

On Wed, Aug 2, 2017 at 12:13 PM, Karimullah Syed <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="2YiR8tfFBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">syedka...@...> wrote:

Hi All,


Data Elements
===============================
1100 2 :  
 3 :  004000
 4 :  000000001000
 11 :  000001
 12 :  010818004699
 14 :  
 19 :  356
 22 :  101150600120
 24 :  180
 25 :  1234
 26 :  5399
 42 :  200000000019
 49 :  356
=======================================
 
Hexa dump
====================================
1100703425c000408000164862698906428354004000000000001000000001010817262975130103561011506001200180123453993230303030303030303031392020200003333536

So we have required converting to EBCDIC Format

Ex:
(Bank Expecting) the below format
The Auth request packet should be in HEX EBCDIC format and would like –
AuthorizationRequestParam=F1F1F0F0703424C128E08200F1F5F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7F0F0F4F0F0F0F0F0F0F0F0F0F0F0F3F0F0F0F3F5F0F0F0F2F1F7F0F7F0F3F1F6F0F5F2F0F2F1F0F3F3F5F6F5F1F0F1F0F1F5F1F1F1F4C3F1F9F0F0F7F0F1F1F1F1F1F0F0F0F0F0F0F0F1F6F2F3F7F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7C4F2F1F0F3F2F0F1F1F5F0F4F1F2F3F4F5F0F0F0F0F0F7F1F8F4F1F0F3F5F0F0F0F2FXFXFXFXFXF0F7F1FXFXFXFXFXFXFXFXF8F54040404040F4F9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXD4E0F5XXXXXXXXXXXXXXXXXXXXXXXXXXF6F0F5F7C1C7D5E20001F34BC16BC1AC7C7D0706020103A4200224FC27EA0069000000800017070300000000003000035603563C000000000000000080


After Parsing the above
(Bank Excepting) the below format

F1F1F0F0
703424C128E08200
F1F5 F3F7F4F2F4F5F0F0F1F7F4F1F0F0F7
F0F0F4F0F0F0
F0F0F0F0F0F0F0F0F3F0F0F0
F3F5F0F0F0F2
F1F7F0F7F0F3F1F6F0F5F2F0
F2F1F0F3
F3F5F6
F5F1F0F1F0F1F5F1F1F1F4C3
F1F9F0
F0F7F0F1
F1F1F1F1
F0F0F0F0F0F0F0F1F6F2F3F7
F3F7F4
F2F4F5F0F0F1F7F4F1F0F0F7C4F2F1F0F3F2F0F1F1F5F0F4F1F2F3F4F5F0F0F0F0F0F7F1F8F4F1F0F3F5F0F0F0F2FXFXFXFXFXF0F7F1FXFXFXFXFXFXFXFXF8F54040404040F4F9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXD4E0F5XXXXXXXXXXXXXXXXXXXXXXXXXXF6F0F5F7C1C7D5E20001F34BC16BC1AC7C7D0706020103A4200224FC27EA0069000000800017070300000000003000035603563C000000000000000080
=========================
Snippet code :
=========================
Below are the step we use to follow
Packing the Data Elements
byte[] a2 = getIsoMessage().pack();

public static String toHexString (byte[] b)  { 
StringBuilder sb = new StringBuilder( b.length * 2 ); 
for ( int i=0 ; i<b.length ; i++ ) {  
//look up high nibble char 
sb.append( hexChar [ ( b[ i] & 0xf0 ) >>> 4  ] ) ; 
//look up low nibble char 
sb.append( hexChar [ b[ i] & 0x0f ] ) ; 
return sb.toString() ; 
}
==================================
After packing the data converting to hex value
====================================
String msg = FormatUtils.toHexString(args);
Ex : 1100703425c000408000164862698906428354004000000000001000000001010817262975130103561011506001200180123453993230303030303030303031392020200003333536

After Parsing Hexa dump value
1100
703425c00040800016
4862698906428354
004000
000000001000
000001
010817262975
1301
0356  
101150600120
0180  
1234
5399
32 30303030303030303031392020200003  
33 35 36 
==========================
Converting the Hex value to EBCDIC Format
========================
byte[] bytes = msg.getBytes("CP1047");
int i;
for (i = 0; i < bytes.length; i++) {
formattedString += String.format("%X", bytes[i]);
<a href="http://logger.info" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flogger.info\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flogger.info\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGOfWV_MqSEYOUyz77vBSYyM6smOg&#39;;return true;">logger.info(formattedString);
}

after converting to EBCDIC Format
below is the result

F1F1F0F0
F7F0F3F4F2F583F0F0F0F4F0F8F0F0F0F1F6
F4F8F6F2F6F9F8F9F0F6F4F2F8F3F5F4
F0F0F4F0F0F0F0F0F0F0F0F0F0F0F1F0F0F0F0F0F0F0F0F1F0F2F0F8F1F2F0F1F3F7F1F9F1F3F0F1F0F3F5F6F1F0F1F1F5F0F6F0F0F1F2F0F0F1F8F0F1F2F3F4F5F3F9F9F3F2F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F0F3F1F3F9F2F0F2F0F2F0F0F0F0F3F3F3F3F5F3F6

So my concern is even bit map is appended with 'F' which should not happened,may be what i'm converting is also not correct, it should be the above behaviour what Bank Expecting,Please guide me in the conversion if possible provide me the code snippet for the same.



Thanks,
Karimullah Syed.

--
--
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: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="2YiR8tfFBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">sa...@...
---
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="2YiR8tfFBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jpos-users+...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="2YiR8tfFBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jpos-...@....
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jpos-users/ba9e2e31-435a-4027-8a1a-ec0f30d5c170%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jpos-users/ba9e2e31-435a-4027-8a1a-ec0f30d5c170%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jpos-users/ba9e2e31-435a-4027-8a1a-ec0f30d5c170%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jpos-users/ba9e2e31-435a-4027-8a1a-ec0f30d5c170%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.


Disclaimer: This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended addressee, or the person responsible for delivering it to them, you may not copy, forward disclose or otherwise use it or any part of it in any way. To do so may be unlawful. If you receive this e-mail by mistake, please advise the sender immediately.

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/a50fedb9-0970-4430-ad32-811d634cc882%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.