{"id":1585,"date":"2025-01-09T06:00:15","date_gmt":"2025-01-09T06:00:15","guid":{"rendered":"https:\/\/craftcookcode.com\/?p=1585"},"modified":"2025-01-09T23:57:17","modified_gmt":"2025-01-09T23:57:17","slug":"postgres-ebcdic-decoding-through-a-javascript-function","status":"publish","type":"post","link":"https:\/\/craftcookcode.com\/?p=1585","title":{"rendered":"Postgres: EBCDIC decoding through a JavaScript Function"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">EBCDIC?  Didn&#8217;t that die out with punch cards and the Dinosaurs?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/en.wikipedia.org\/wiki\/EBCDIC\" target=\"_blank\" rel=\"noopener\" title=\"\">EBCDIC<\/a> (Extended Binary Coded Decimal Interchange Code) is an eight-bit character encoding that was created by IBM in the &#8217;60s.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While the rest of the world went on with ASCII and UTF-8; we still find fields in our DB2 database encoded in EBCDIC 037 just to make our lives miserable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Qlik Replicate when replicating from these fields on its default settings; brings it across as a normal &#8220;string&#8221; and becomes quite unusable when loaded into a destination system.  <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Decoding EBCDIC in Postgres<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To have the flexibility to decode particular fields in EBCDIC; we need to bring the fields across as BYTES instead of that QR suggests.  This can be done in the Table Settings for the table in question:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"2787\" height=\"1524\" src=\"https:\/\/craftcookcode.com\/wp-content\/uploads\/2025\/01\/code_ebcdic_function_01.png\" alt=\"\" class=\"wp-image-1587\" srcset=\"https:\/\/craftcookcode.com\/wp-content\/uploads\/2025\/01\/code_ebcdic_function_01.png 2787w, https:\/\/craftcookcode.com\/wp-content\/uploads\/2025\/01\/code_ebcdic_function_01-300x164.png 300w, https:\/\/craftcookcode.com\/wp-content\/uploads\/2025\/01\/code_ebcdic_function_01-1024x560.png 1024w, https:\/\/craftcookcode.com\/wp-content\/uploads\/2025\/01\/code_ebcdic_function_01-768x420.png 768w, https:\/\/craftcookcode.com\/wp-content\/uploads\/2025\/01\/code_ebcdic_function_01-1536x840.png 1536w, https:\/\/craftcookcode.com\/wp-content\/uploads\/2025\/01\/code_ebcdic_function_01-2048x1120.png 2048w\" sizes=\"(max-width: 2787px) 100vw, 2787px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">On the destination Postgres database; load the table into a bytea field.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now with a udf function in Postgres; we can decode the EBCDIC bytes fields into something readable:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nCREATE OR REPLACE FUNCTION public.fn_convert_bytes2_037(\n    in_bytes bytea)\n    RETURNS character varying\n    LANGUAGE &#039;plv8&#039;\n    COST 100\n    VOLATILE PARALLEL UNSAFE\nAS $BODY$\n    const hex_037 = new Map(&#x5B;\n        &#x5B;&quot;40&quot;, &quot; &quot;,],\n        &#x5B;&quot;41&quot;, &quot; &quot;,],\n        &#x5B;&quot;42&quot;, &quot;\u00e2&quot;,],\n        &#x5B;&quot;43&quot;, &quot;\u00e4&quot;,],\n        &#x5B;&quot;44&quot;, &quot;\u00e0&quot;,],\n        &#x5B;&quot;45&quot;, &quot;\u00e1&quot;,],\n        &#x5B;&quot;46&quot;, &quot;\u00e3&quot;,],\n        &#x5B;&quot;47&quot;, &quot;\u00e5&quot;,],\n        &#x5B;&quot;48&quot;, &quot;\u00e7&quot;,],\n        &#x5B;&quot;49&quot;, &quot;\u00f1&quot;,],\n        &#x5B;&quot;4a&quot;, &quot;\u00a2&quot;,],\n        &#x5B;&quot;4b&quot;, &quot;.&quot;,],\n        &#x5B;&quot;4c&quot;, &quot;&lt;&quot;,],\n        &#x5B;&quot;4d&quot;, &quot;(&quot;,],\n        &#x5B;&quot;4e&quot;, &quot;+&quot;,],\n        &#x5B;&quot;4f&quot;, &quot;|&quot;,],\n        &#x5B;&quot;50&quot;, &quot;&amp;&quot;,],\n        &#x5B;&quot;51&quot;, &quot;\u00e9&quot;,],\n        &#x5B;&quot;52&quot;, &quot;\u00ea&quot;,],\n        &#x5B;&quot;53&quot;, &quot;\u00eb&quot;,],\n        &#x5B;&quot;54&quot;, &quot;\u00e8&quot;,],\n        &#x5B;&quot;55&quot;, &quot;\u00ed&quot;,],\n        &#x5B;&quot;56&quot;, &quot;\u00ee&quot;,],\n        &#x5B;&quot;57&quot;, &quot;\u00ef&quot;,],\n        &#x5B;&quot;58&quot;, &quot;\u00ec&quot;,],\n        &#x5B;&quot;59&quot;, &quot;\u00df&quot;,],\n        &#x5B;&quot;5a&quot;, &quot;!&quot;,],\n        &#x5B;&quot;5b&quot;, &quot;$&quot;,],\n        &#x5B;&quot;5c&quot;, &quot;*&quot;,],\n        &#x5B;&quot;5d&quot;, &quot;)&quot;,],\n        &#x5B;&quot;5e&quot;, &quot;;&quot;,],\n        &#x5B;&quot;5f&quot;, &quot;\u00ac&quot;,],\n        &#x5B;&quot;60&quot;, &quot;-&quot;,],\n        &#x5B;&quot;61&quot;, &quot;\/&quot;,],\n        &#x5B;&quot;62&quot;, &quot;\u00c2&quot;,],\n        &#x5B;&quot;63&quot;, &quot;\u00c4&quot;,],\n        &#x5B;&quot;64&quot;, &quot;\u00c0&quot;,],\n        &#x5B;&quot;65&quot;, &quot;\u00c1&quot;,],\n        &#x5B;&quot;66&quot;, &quot;\u00c3&quot;,],\n        &#x5B;&quot;67&quot;, &quot;\u00c5&quot;,],\n        &#x5B;&quot;68&quot;, &quot;\u00c7&quot;,],\n        &#x5B;&quot;69&quot;, &quot;\u00d1&quot;,],\n        &#x5B;&quot;6a&quot;, &quot;\u00a6&quot;,],\n        &#x5B;&quot;6b&quot;, &quot;,&quot;,],\n        &#x5B;&quot;6c&quot;, &quot;%&quot;,],\n        &#x5B;&quot;6d&quot;, &quot;_&quot;,],\n        &#x5B;&quot;6e&quot;, &quot;&gt;&quot;,],\n        &#x5B;&quot;6f&quot;, &quot;?&quot;,],\n        &#x5B;&quot;70&quot;, &quot;\u00f8&quot;,],\n        &#x5B;&quot;71&quot;, &quot;\u00c9&quot;,],\n        &#x5B;&quot;72&quot;, &quot;\u00ca&quot;,],\n        &#x5B;&quot;73&quot;, &quot;\u00cb&quot;,],\n        &#x5B;&quot;74&quot;, &quot;\u00c8&quot;,],\n        &#x5B;&quot;75&quot;, &quot;\u00cd&quot;,],\n        &#x5B;&quot;76&quot;, &quot;\u00ce&quot;,],\n        &#x5B;&quot;77&quot;, &quot;\u00cf&quot;,],\n        &#x5B;&quot;78&quot;, &quot;\u00cc&quot;,],\n        &#x5B;&quot;79&quot;, &quot;`&quot;,],\n        &#x5B;&quot;7a&quot;, &quot;:&quot;,],\n        &#x5B;&quot;7b&quot;, &quot;#&quot;,],\n        &#x5B;&quot;7c&quot;, &quot;@&quot;,],\n        &#x5B;&quot;7d&quot;, &quot;&#039;&quot;,],\n        &#x5B;&quot;7e&quot;, &quot;=&quot;,],\n        &#x5B;&quot;7f&quot;, &quot;,&quot;],\n        &#x5B;&quot;80&quot;, &quot;\u00d8&quot;,],\n        &#x5B;&quot;81&quot;, &quot;a&quot;,],\n        &#x5B;&quot;82&quot;, &quot;b&quot;,],\n        &#x5B;&quot;83&quot;, &quot;c&quot;,],\n        &#x5B;&quot;84&quot;, &quot;d&quot;,],\n        &#x5B;&quot;85&quot;, &quot;e&quot;,],\n        &#x5B;&quot;86&quot;, &quot;f&quot;,],\n        &#x5B;&quot;87&quot;, &quot;g&quot;,],\n        &#x5B;&quot;88&quot;, &quot;h&quot;,],\n        &#x5B;&quot;89&quot;, &quot;i&quot;,],\n        &#x5B;&quot;8a&quot;, &quot;\u00ab&quot;,],\n        &#x5B;&quot;8b&quot;, &quot;\u00bb&quot;,],\n        &#x5B;&quot;8c&quot;, &quot;\u00f0&quot;,],\n        &#x5B;&quot;8d&quot;, &quot;\u00fd&quot;,],\n        &#x5B;&quot;8e&quot;, &quot;\u00fe&quot;,],\n        &#x5B;&quot;8f&quot;, &quot;\u00b1&quot;,],\n        &#x5B;&quot;90&quot;, &quot;\u00b0&quot;,],\n        &#x5B;&quot;91&quot;, &quot;j&quot;,],\n        &#x5B;&quot;92&quot;, &quot;k&quot;,],\n        &#x5B;&quot;93&quot;, &quot;l&quot;,],\n        &#x5B;&quot;94&quot;, &quot;m&quot;,],\n        &#x5B;&quot;95&quot;, &quot;n&quot;,],\n        &#x5B;&quot;96&quot;, &quot;o&quot;,],\n        &#x5B;&quot;97&quot;, &quot;p&quot;,],\n        &#x5B;&quot;98&quot;, &quot;q&quot;,],\n        &#x5B;&quot;99&quot;, &quot;r&quot;,],\n        &#x5B;&quot;9a&quot;, &quot;\u00aa&quot;,],\n        &#x5B;&quot;9b&quot;, &quot;\u00ba&quot;,],\n        &#x5B;&quot;9c&quot;, &quot;\u00e6&quot;,],\n        &#x5B;&quot;9d&quot;, &quot;\u00b8&quot;,],\n        &#x5B;&quot;9e&quot;, &quot;\u00c6&quot;,],\n        &#x5B;&quot;9f&quot;, &quot;\u00a4&quot;,],\n        &#x5B;&quot;a0&quot;, &quot;\u00b5&quot;,],\n        &#x5B;&quot;a1&quot;, &quot;~&quot;,],\n        &#x5B;&quot;a2&quot;, &quot;s&quot;,],\n        &#x5B;&quot;a3&quot;, &quot;t&quot;,],\n        &#x5B;&quot;a4&quot;, &quot;u&quot;,],\n        &#x5B;&quot;a5&quot;, &quot;v&quot;,],\n        &#x5B;&quot;a6&quot;, &quot;w&quot;,],\n        &#x5B;&quot;a7&quot;, &quot;x&quot;,],\n        &#x5B;&quot;a8&quot;, &quot;y&quot;,],\n        &#x5B;&quot;a9&quot;, &quot;z&quot;,],\n        &#x5B;&quot;aa&quot;, &quot;\u00a1&quot;,],\n        &#x5B;&quot;ab&quot;, &quot;\u00bf&quot;,],\n        &#x5B;&quot;ac&quot;, &quot;\u00d0&quot;,],\n        &#x5B;&quot;ad&quot;, &quot;\u00dd&quot;,],\n        &#x5B;&quot;ae&quot;, &quot;\u00de&quot;,],\n        &#x5B;&quot;af&quot;, &quot;\u00ae&quot;,],\n        &#x5B;&quot;b0&quot;, &quot;^&quot;,],\n        &#x5B;&quot;b1&quot;, &quot;\u00a3&quot;,],\n        &#x5B;&quot;b2&quot;, &quot;\u00a5&quot;,],\n        &#x5B;&quot;b3&quot;, &quot;\u00b7&quot;,],\n        &#x5B;&quot;b4&quot;, &quot;\u00a9&quot;,],\n        &#x5B;&quot;b5&quot;, &quot;\u00a7&quot;,],\n        &#x5B;&quot;b6&quot;, &quot;\u00b6&quot;,],\n        &#x5B;&quot;b7&quot;, &quot;\u00bc&quot;,],\n        &#x5B;&quot;b8&quot;, &quot;\u00bd&quot;,],\n        &#x5B;&quot;b9&quot;, &quot;\u00be&quot;,],\n        &#x5B;&quot;ba&quot;, &quot;&#x5B;&quot;,],\n        &#x5B;&quot;bb&quot;, &quot;]&quot;,],\n        &#x5B;&quot;bc&quot;, &quot;\u00af&quot;,],\n        &#x5B;&quot;bd&quot;, &quot;\u00a8&quot;,],\n        &#x5B;&quot;be&quot;, &quot;\u00b4&quot;,],\n        &#x5B;&quot;bf&quot;, &quot;\u00d7&quot;,],\n        &#x5B;&quot;c0&quot;, &quot;{&quot;,],\n        &#x5B;&quot;c1&quot;, &quot;A&quot;,],\n        &#x5B;&quot;c2&quot;, &quot;B&quot;,],\n        &#x5B;&quot;c3&quot;, &quot;C&quot;,],\n        &#x5B;&quot;c4&quot;, &quot;D&quot;,],\n        &#x5B;&quot;c5&quot;, &quot;E&quot;,],\n        &#x5B;&quot;c6&quot;, &quot;F&quot;,],\n        &#x5B;&quot;c7&quot;, &quot;G&quot;,],\n        &#x5B;&quot;c8&quot;, &quot;H&quot;,],\n        &#x5B;&quot;c9&quot;, &quot;I&quot;,],\n        &#x5B;&quot;ca&quot;, &quot;\u00ad&quot;,],\n        &#x5B;&quot;cb&quot;, &quot;\u00f4&quot;,],\n        &#x5B;&quot;cc&quot;, &quot;\u00f6&quot;,],\n        &#x5B;&quot;cd&quot;, &quot;\u00f2&quot;,],\n        &#x5B;&quot;ce&quot;, &quot;\u00f3&quot;,],\n        &#x5B;&quot;cf&quot;, &quot;\u00f5&quot;,],\n        &#x5B;&quot;d0&quot;, &quot;}&quot;,],\n        &#x5B;&quot;d1&quot;, &quot;J&quot;,],\n        &#x5B;&quot;d2&quot;, &quot;K&quot;,],\n        &#x5B;&quot;d3&quot;, &quot;L&quot;,],\n        &#x5B;&quot;d4&quot;, &quot;M&quot;,],\n        &#x5B;&quot;d5&quot;, &quot;N&quot;,],\n        &#x5B;&quot;d6&quot;, &quot;O&quot;,],\n        &#x5B;&quot;d7&quot;, &quot;P&quot;,],\n        &#x5B;&quot;d8&quot;, &quot;Q&quot;,],\n        &#x5B;&quot;d9&quot;, &quot;R&quot;,],\n        &#x5B;&quot;da&quot;, &quot;\u00b9&quot;,],\n        &#x5B;&quot;db&quot;, &quot;\u00fb&quot;,],\n        &#x5B;&quot;dc&quot;, &quot;\u00fc&quot;,],\n        &#x5B;&quot;dd&quot;, &quot;\u00f9&quot;,],\n        &#x5B;&quot;de&quot;, &quot;\u00fa&quot;,],\n        &#x5B;&quot;df&quot;, &quot;\u00ff&quot;,],\n        &#x5B;&quot;e0&quot;, &quot;\\\\&quot;,],\n        &#x5B;&quot;e1&quot;, &quot;\u00f7&quot;,],\n        &#x5B;&quot;e2&quot;, &quot;S&quot;,],\n        &#x5B;&quot;e3&quot;, &quot;T&quot;,],\n        &#x5B;&quot;e4&quot;, &quot;U&quot;,],\n        &#x5B;&quot;e5&quot;, &quot;V&quot;,],\n        &#x5B;&quot;e6&quot;, &quot;W&quot;,],\n        &#x5B;&quot;e7&quot;, &quot;X&quot;,],\n        &#x5B;&quot;e8&quot;, &quot;Y&quot;,],\n        &#x5B;&quot;e9&quot;, &quot;Z&quot;,],\n        &#x5B;&quot;ea&quot;, &quot;\u00b2&quot;,],\n        &#x5B;&quot;eb&quot;, &quot;\u00d4&quot;,],\n        &#x5B;&quot;ec&quot;, &quot;\u00d6&quot;,],\n        &#x5B;&quot;ed&quot;, &quot;\u00d2&quot;,],\n        &#x5B;&quot;ee&quot;, &quot;\u00d3&quot;,],\n        &#x5B;&quot;ef&quot;, &quot;\u00d5&quot;,],\n        &#x5B;&quot;f0&quot;, &quot;0&quot;,],\n        &#x5B;&quot;f1&quot;, &quot;1&quot;,],\n        &#x5B;&quot;f2&quot;, &quot;2&quot;,],\n        &#x5B;&quot;f3&quot;, &quot;3&quot;,],\n        &#x5B;&quot;f4&quot;, &quot;4&quot;,],\n        &#x5B;&quot;f5&quot;, &quot;5&quot;,],\n        &#x5B;&quot;f6&quot;, &quot;6&quot;,],\n        &#x5B;&quot;f7&quot;, &quot;7&quot;,],\n        &#x5B;&quot;f8&quot;, &quot;8&quot;,],\n        &#x5B;&quot;f9&quot;, &quot;9&quot;,],\n        &#x5B;&quot;fa&quot;, &quot;\u00b3&quot;,],\n        &#x5B;&quot;fb&quot;, &quot;\u00db&quot;,],\n        &#x5B;&quot;fc&quot;, &quot;\u00dc&quot;,],\n        &#x5B;&quot;fd&quot;, &quot;\u00d9&quot;,],\n        &#x5B;&quot;fe&quot;, &quot;\u00da&quot;]\n    ]);\n \n    let in_varchar = &quot;&quot;;\n    let build_string = &quot;&quot;;\n     \n    for (var loop_bytes = 0; loop_bytes &lt; in_bytes.length; loop_bytes++)\n    {\n        \/* Converts a byte character to a hex representation*\/\n        let focus_char = (&#039;0&#039; + (in_bytes&#x5B;loop_bytes] &amp; 0xFF).toString(16)).slice(-2); \n        let return_value = hex_037.get(focus_char.toLowerCase());\n \n        \/* If no mapping found - replace the character with a space *\/\n        if(return_value === undefined)\n        {\n            return_value = &quot; &quot;;\n        }\n \n        build_string = build_string.concat(return_value)\n    }\n \n    return build_string\n$BODY$;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The function can now be used in SQL:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: sql; title: ; notranslate\" title=\"\">\nSELECT public.fn_convert_bytes2_037(my_EBCDIC_byte_column)\nFROM public.foo;\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Reference<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">JavaScript bytes to HEX string function: Code Shock &#8211; <a href=\"https:\/\/codeshock.dev\/news\/how-to-convert-between-hexadecimal-strings-and-byte-arrays-in-javascript\/\" target=\"_blank\" rel=\"noopener\" title=\"\">How to Convert Between Hexadecimal Strings and Byte Arrays in JavaScript<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>EBCDIC? Didn&#8217;t that die out with punch cards and the Dinosaurs? EBCDIC (Extended Binary Coded Decimal Interchange Code) is an eight-bit character encoding that was created&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[64,16],"tags":[79,78,75,56,36],"class_list":["post-1585","post","type-post","status-publish","format-standard","hentry","category-postgres","category-qlik-replicate","tag-79","tag-ebcdic","tag-javascript","tag-postgres","tag-qlikreplicate"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"EBCDIC? Didn&#039;t that die out with punch cards and the Dinosaurs? EBCDIC (Extended Binary Coded Decimal Interchange Code) is an eight-bit character encoding that was created by IBM in the &#039;60s. While the rest of the world went on with ASCII and UTF-8; we still find fields in our DB2 database encoded in EBCDIC 037\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"jonny.donker@gmail.com\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/craftcookcode.com\/?p=1585\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Craft Cook Code - c^3?\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Postgres: EBCDIC decoding through a JavaScript Function - Craft Cook Code\" \/>\n\t\t<meta property=\"og:description\" content=\"EBCDIC? Didn&#039;t that die out with punch cards and the Dinosaurs? EBCDIC (Extended Binary Coded Decimal Interchange Code) is an eight-bit character encoding that was created by IBM in the &#039;60s. While the rest of the world went on with ASCII and UTF-8; we still find fields in our DB2 database encoded in EBCDIC 037\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/craftcookcode.com\/?p=1585\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2025-01-09T06:00:15+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2025-01-09T23:57:17+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Postgres: EBCDIC decoding through a JavaScript Function - Craft Cook Code\" \/>\n\t\t<meta name=\"twitter:description\" content=\"EBCDIC? Didn&#039;t that die out with punch cards and the Dinosaurs? EBCDIC (Extended Binary Coded Decimal Interchange Code) is an eight-bit character encoding that was created by IBM in the &#039;60s. While the rest of the world went on with ASCII and UTF-8; we still find fields in our DB2 database encoded in EBCDIC 037\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1585#blogposting\",\"name\":\"Postgres: EBCDIC decoding through a JavaScript Function - Craft Cook Code\",\"headline\":\"Postgres: EBCDIC decoding through a JavaScript Function\",\"author\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?author=1#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/craftcookcode.com\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/code_ebcdic_function_01.png\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1585\\\/#articleImage\",\"width\":2787,\"height\":1524},\"datePublished\":\"2025-01-09T06:00:15+00:00\",\"dateModified\":\"2025-01-09T23:57:17+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1585#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1585#webpage\"},\"articleSection\":\"Postgres, Qlik Replicate, 037, ebcdic, javascript, postgres, qlikreplicate\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1585#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/craftcookcode.com\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=13#listItem\",\"name\":\"Code\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=13#listItem\",\"position\":2,\"name\":\"Code\",\"item\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=13\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=16#listItem\",\"name\":\"Qlik Replicate\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=16#listItem\",\"position\":3,\"name\":\"Qlik Replicate\",\"item\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=16\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1585#listItem\",\"name\":\"Postgres: EBCDIC decoding through a JavaScript Function\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=13#listItem\",\"name\":\"Code\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1585#listItem\",\"position\":4,\"name\":\"Postgres: EBCDIC decoding through a JavaScript Function\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?cat=16#listItem\",\"name\":\"Qlik Replicate\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/#person\",\"name\":\"jonny.donker@gmail.com\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1585#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/12ea7810156e378894993fa29611c905482263dd05898a50ae5ece294bb6aff0?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"jonny.donker@gmail.com\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?author=1#author\",\"url\":\"https:\\\/\\\/craftcookcode.com\\\/?author=1\",\"name\":\"jonny.donker@gmail.com\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1585#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/12ea7810156e378894993fa29611c905482263dd05898a50ae5ece294bb6aff0?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"jonny.donker@gmail.com\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1585#webpage\",\"url\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1585\",\"name\":\"Postgres: EBCDIC decoding through a JavaScript Function - Craft Cook Code\",\"description\":\"EBCDIC? Didn't that die out with punch cards and the Dinosaurs? EBCDIC (Extended Binary Coded Decimal Interchange Code) is an eight-bit character encoding that was created by IBM in the '60s. While the rest of the world went on with ASCII and UTF-8; we still find fields in our DB2 database encoded in EBCDIC 037\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?p=1585#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?author=1#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/?author=1#author\"},\"datePublished\":\"2025-01-09T06:00:15+00:00\",\"dateModified\":\"2025-01-09T23:57:17+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/#website\",\"url\":\"https:\\\/\\\/craftcookcode.com\\\/\",\"name\":\"Craft Cook Code\",\"description\":\"c^3?\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/craftcookcode.com\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Postgres: EBCDIC decoding through a JavaScript Function - Craft Cook Code","description":"EBCDIC? Didn't that die out with punch cards and the Dinosaurs? EBCDIC (Extended Binary Coded Decimal Interchange Code) is an eight-bit character encoding that was created by IBM in the '60s. While the rest of the world went on with ASCII and UTF-8; we still find fields in our DB2 database encoded in EBCDIC 037","canonical_url":"https:\/\/craftcookcode.com\/?p=1585","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/craftcookcode.com\/?p=1585#blogposting","name":"Postgres: EBCDIC decoding through a JavaScript Function - Craft Cook Code","headline":"Postgres: EBCDIC decoding through a JavaScript Function","author":{"@id":"https:\/\/craftcookcode.com\/?author=1#author"},"publisher":{"@id":"https:\/\/craftcookcode.com\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/craftcookcode.com\/wp-content\/uploads\/2025\/01\/code_ebcdic_function_01.png","@id":"https:\/\/craftcookcode.com\/?p=1585\/#articleImage","width":2787,"height":1524},"datePublished":"2025-01-09T06:00:15+00:00","dateModified":"2025-01-09T23:57:17+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/craftcookcode.com\/?p=1585#webpage"},"isPartOf":{"@id":"https:\/\/craftcookcode.com\/?p=1585#webpage"},"articleSection":"Postgres, Qlik Replicate, 037, ebcdic, javascript, postgres, qlikreplicate"},{"@type":"BreadcrumbList","@id":"https:\/\/craftcookcode.com\/?p=1585#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/craftcookcode.com#listItem","position":1,"name":"Home","item":"https:\/\/craftcookcode.com","nextItem":{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?cat=13#listItem","name":"Code"}},{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?cat=13#listItem","position":2,"name":"Code","item":"https:\/\/craftcookcode.com\/?cat=13","nextItem":{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?cat=16#listItem","name":"Qlik Replicate"},"previousItem":{"@type":"ListItem","@id":"https:\/\/craftcookcode.com#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?cat=16#listItem","position":3,"name":"Qlik Replicate","item":"https:\/\/craftcookcode.com\/?cat=16","nextItem":{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?p=1585#listItem","name":"Postgres: EBCDIC decoding through a JavaScript Function"},"previousItem":{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?cat=13#listItem","name":"Code"}},{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?p=1585#listItem","position":4,"name":"Postgres: EBCDIC decoding through a JavaScript Function","previousItem":{"@type":"ListItem","@id":"https:\/\/craftcookcode.com\/?cat=16#listItem","name":"Qlik Replicate"}}]},{"@type":"Person","@id":"https:\/\/craftcookcode.com\/#person","name":"jonny.donker@gmail.com","image":{"@type":"ImageObject","@id":"https:\/\/craftcookcode.com\/?p=1585#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/12ea7810156e378894993fa29611c905482263dd05898a50ae5ece294bb6aff0?s=96&d=mm&r=g","width":96,"height":96,"caption":"jonny.donker@gmail.com"}},{"@type":"Person","@id":"https:\/\/craftcookcode.com\/?author=1#author","url":"https:\/\/craftcookcode.com\/?author=1","name":"jonny.donker@gmail.com","image":{"@type":"ImageObject","@id":"https:\/\/craftcookcode.com\/?p=1585#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/12ea7810156e378894993fa29611c905482263dd05898a50ae5ece294bb6aff0?s=96&d=mm&r=g","width":96,"height":96,"caption":"jonny.donker@gmail.com"}},{"@type":"WebPage","@id":"https:\/\/craftcookcode.com\/?p=1585#webpage","url":"https:\/\/craftcookcode.com\/?p=1585","name":"Postgres: EBCDIC decoding through a JavaScript Function - Craft Cook Code","description":"EBCDIC? Didn't that die out with punch cards and the Dinosaurs? EBCDIC (Extended Binary Coded Decimal Interchange Code) is an eight-bit character encoding that was created by IBM in the '60s. While the rest of the world went on with ASCII and UTF-8; we still find fields in our DB2 database encoded in EBCDIC 037","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/craftcookcode.com\/#website"},"breadcrumb":{"@id":"https:\/\/craftcookcode.com\/?p=1585#breadcrumblist"},"author":{"@id":"https:\/\/craftcookcode.com\/?author=1#author"},"creator":{"@id":"https:\/\/craftcookcode.com\/?author=1#author"},"datePublished":"2025-01-09T06:00:15+00:00","dateModified":"2025-01-09T23:57:17+00:00"},{"@type":"WebSite","@id":"https:\/\/craftcookcode.com\/#website","url":"https:\/\/craftcookcode.com\/","name":"Craft Cook Code","description":"c^3?","inLanguage":"en-US","publisher":{"@id":"https:\/\/craftcookcode.com\/#person"}}]},"og:locale":"en_US","og:site_name":"Craft Cook Code - c^3?","og:type":"article","og:title":"Postgres: EBCDIC decoding through a JavaScript Function - Craft Cook Code","og:description":"EBCDIC? Didn't that die out with punch cards and the Dinosaurs? EBCDIC (Extended Binary Coded Decimal Interchange Code) is an eight-bit character encoding that was created by IBM in the '60s. While the rest of the world went on with ASCII and UTF-8; we still find fields in our DB2 database encoded in EBCDIC 037","og:url":"https:\/\/craftcookcode.com\/?p=1585","article:published_time":"2025-01-09T06:00:15+00:00","article:modified_time":"2025-01-09T23:57:17+00:00","twitter:card":"summary_large_image","twitter:title":"Postgres: EBCDIC decoding through a JavaScript Function - Craft Cook Code","twitter:description":"EBCDIC? Didn't that die out with punch cards and the Dinosaurs? EBCDIC (Extended Binary Coded Decimal Interchange Code) is an eight-bit character encoding that was created by IBM in the '60s. While the rest of the world went on with ASCII and UTF-8; we still find fields in our DB2 database encoded in EBCDIC 037"},"aioseo_meta_data":{"post_id":"1585","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2025-01-09 05:55:11","updated":"2025-06-04 13:28:32","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/craftcookcode.com\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/craftcookcode.com\/?cat=13\" title=\"Code\">Code<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/craftcookcode.com\/?cat=16\" title=\"Qlik Replicate\">Qlik Replicate<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tPostgres: EBCDIC decoding through a JavaScript Function\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/craftcookcode.com"},{"label":"Code","link":"https:\/\/craftcookcode.com\/?cat=13"},{"label":"Qlik Replicate","link":"https:\/\/craftcookcode.com\/?cat=16"},{"label":"Postgres: EBCDIC decoding through a JavaScript Function","link":"https:\/\/craftcookcode.com\/?p=1585"}],"_links":{"self":[{"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/posts\/1585","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1585"}],"version-history":[{"count":2,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/posts\/1585\/revisions"}],"predecessor-version":[{"id":1590,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=\/wp\/v2\/posts\/1585\/revisions\/1590"}],"wp:attachment":[{"href":"https:\/\/craftcookcode.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/craftcookcode.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}