Convert Number To Packed Decimal

The other nibbles each contain one decimal digit, represented by X'0' through X'9' (if "n" is even, the leftmost nibble is padded with X'0'). For example, the number 48. I have a physical file that includes a large alphanumeric field that is defined differently for many different record types. Decimal numbers make use of 10 symbols from 0 to 9 and its combinations to represent different values. I am trying to figure out how to take a binary number and convert it to BCD (packed or unpacked). As the packed decimal is amount which shud be numeric. d format writes missing numerical data as -0. Can anyone suggest me how I can read this data element from the file and convert it into SQL decimal datatype. txt might contain: 0x000010df073a7da0 If I use the below code this works. Which method is used to convert a binary numbers into decimal number? To convert a binary number into decimal number we use Expansion method. This scheme allows 4 digits to be packed into a 16 bit word, or 8 digits into a 32 bit word, as shown below. The starting position of the field in the output record. Converting Packed Decimal to Displayable Format PD values are stored as integers in a compressed internal format but if you know what kind of value is stored in the filed you can use the EDIT feature of DFSORT to make these readable, the EDIT feature also allows you to insert comas , hyphens to make the fields more interpretable as well. My Favorite BIF (Built-In Function): %dec submitted by Steve Kontos. To convert from zoned to packed. decimal to binary and visa versa) · Many applications, especially business application that deals with money, requires full accuracy of the numbers. So, the first two numbers, "12" will be represented as a single byte with the binary value of 12 or like this in binary - 0001 0010. The method here can be referred to as Simple Binary-Coded Decimal (SBCD) or BCD 8421. IBM‘s practice is to use X’F’ for positive numbers and X’D’ for negative numbers. How to Convert a Fraction to a Decimal. I have read several messages on converting packed decimals (EBCDIC) in a C++ program, but they were all for AS400 systems. Is there any way to convert the packed decimal to numeric or char in Unix ?. Convert integer to the Unicode character it represents. The fractional part of the number is determined by the informat or format because there is no separate mantissa and exponent. The FTP'ed files have many columns in packed decimal (comp-3). The number may be preceded by a plus or minus sign or followed by a Lor U. sort - convert pd to zd in displayable format (zdf) In most of the scenarios, your input file has data either in Packed decimal (COMP-3) format which is not in readable format. One of the basic skills a programmer needs is the ability to convert numbers between decimal, hexadecimal, and binary. However, it won't accept currency symbols, thousands separators, and asterisks. We use it in the form %DEC(date time or timestamp expression {:format}) The converted decimal value will have the number of digits like the date or time format that we mention here in 2nd parameter. CS_FLOAT, an 8-byte decimal value. I tried CAST(SUBSTR(COLVARCHAR,1,6) AS DECIMAL) but it did not work. Hope this helps, Thanks, Phantom. It retains the decimal positions of the number and right-justifies it with leading spaces. The online Decimal to BCD Converter is used to convert decimal (Base-10) integer to BCD (Binary-coded decimal). +/-79,228,162,514,264,337,593,543,950,335 for zero-scaled numbers, that is, numbers with no decimal places. i thought about the STRING function but isn't that only for alphas? 01 WS-TEMP. Hence is there a way where we can read PD and convert it in to numeric or alphanumeric. p must be a value from 1 to 38. You can optionally specify a format string that specifies how the date is stored in the decimal number. i was wondering if someone could please help me. Data may be stored on disk in packed format. Calculating Decimal Equivalent. FOCUS for Mainframe Using Functions Version 7. Each decimal digit is converted separately to binary, and stored in one nibble. 63 2 decimal places Count the number of decimal places in the question. Hope this helps, Thanks, Phantom. I have to convert a decimal number (1-255) to packed binary-coded decimal. Convert IBM packed decimal / zoned decimal in java. data 76 but want to show 76. Conversely, if the length and decimal for arithmetic output are not defined, it will become a packed field when output to a database file. The 4 bytes of output represent a 4 digit hex number, which must be converted to decimal in order to find the relative date. How do I convert a string such as x=’12345′ to an integer (int) under Python programming language? How can I parse python string to integer? You need to use int(s) to convert a string or number to an integer. That's a funky bit format for storing numbers. The method here can be referred to as Simple Binary-Coded Decimal (SBCD) or BCD 8421. Reading off the remainders, we note that 102 10 =64 16 Converting a Number in Base b to a Decimal Number A number, such as 101 in base 2 can be thought of as 1 2 0 1 1, where the superscripts are reminders that in the position to the right of the index, the number in base 10 is that number times that power of two. I need to convert it to packed decimal digit S9(15)-COMP3 format. So if you have a PIC 9(1) comp-3 field in a COBOL file layout, that is a one-byte packed field. Converts the value of the specified object to an equivalent decimal number, using the specified culture-specific formatting information. The first thing you need is a definition of the EBCDIC file. The topics include 1. Binary coded decimal numbers may be represented in a number of ways. To change this to readable format, you need to convert these numbers into ZONED Decimal (ZD) format. Densely packed decimal (DPD) is a way to efficiently store decimal digits in binary. i was wondering if someone could please help me. DECIMAL columns do not permit values larger than the range implied by the column definition. It can be converted to the Adaptive Server money, char, numeric, or Sybase-decimal datatype with cs_convert. The only way to convert just the EBCDIC fields leaving the packed decimal fields untouched would be coding a DATAEXIT on the C:D z/OS that would do the translation and sending the file. For example, 38 decimal digits can be encoded in 127 bits, or 71 digits can be encoded in 237. World's simplest decimal to text converter. Example − convert (00101001) BCD to Binary. I am having a file in which amount fields are given in a Packed Decimal format. The resultant of it has garbage chars. Get the integer quotient for the next iteration. Type the character / String in the below given field. This article will demonstrate the conversions between each of these bases. @100 cnt_Mos_Deln $03 has value as 006. jar in your class path and below is an example for coverting packed decimal. Sasanka, when you use packed decimal, you have to say Decimal not decimal external. Computers convert binary data into the hexadecimal (hex) number system because it is much less complex than converting data into decimal numbers, and it is much easier for human beings to read hex numbers than to read binary numbers. The following example shows how to copy and convert a file that contains packed decimal fields. When using PTOA to convert a number containing decimals to a character string, you must specify an alphanumeric format large enough to accommodate both the integer and decimal portions of the number. If you redefine a char field to numeric you should do a numeric test on the field before using it as. 234,56 or 1,234. I have tried the EDIT= option. 2) Do conversion by writing your own logic without using any predefined methods. This can be accomplished, and it can be done with no script tasks or script components. We use SQL for our database. Packed decimal numbers multiple choice questions (MCQs), packed decimal numbers, cache memory, printers, data processing, communication protocol quiz for online information technology associate's degree. Can anyone suggest me how I can read this data element from the file and convert it into Oracle Number datatype. BCD Number − (00101001) BCD. For easy understanding below screen shot is given. Storing numbers in Packed Decimal format improves application performance for arithmetic processing. Following is an example of how to use Query/400 to change from a packed field to a zoned field and from a zoned field to packed field. Before converting the packed-decimal fields it should be determined if a conversion is necessary. To convert from zoned to packed. World's simplest decimal to text converter. As you type in one of the text boxes above, the other boxes are converted on the fly. The file being used has two fields: P_NUM and Z_NUM. Packed Decimal Packed decimal numbers are similar to zoned decimal numbers. Convert them to timestamps, and compute the difference with timestampdiff. When you convert a value of a packed decimal type to an integer type, the value becomes a packed decimal(20,0), which then becomes an integer type. Open ClientConnect supports the following five decimal types: CS_REAL, a 4-byte decimal value. But the BCD code is wasteful as many of the 4-bit states (10-to-16) are not used but decimal displays have important applications. The packed decimal alone was converted properly (a few characters in one field received is packed decimal). Exmplained: convert to binary instruction - register to store binary value - location of a packed decimal value English: the second operand is changed from decimal to binary and the result is placed at the first operand location (a register) NOTE: the packed decimal number must reside in a doubleword. Convert the following numbers to decimal. e or E Convert number to scientific notation in the form x. Converting Pega Date to DB2 Date in query; How to convert ISO date to Pega date format. If the character field Amount has a value of '00123. i thought about the STRING function but isn't that only for alphas? 01 WS-TEMP. and finally i want to packed these 2 number in 32 bit(4 bytes). I have the idea of how it's supposed to work. tool converts Character / String to ASCII code, converting to Binary from its ASCII code, conversion of Character / String to Decimal from its ASCII code, calculate or convert Hexa Decimal from its ASCII code. However, it won't accept currency symbols, thousands separators, and asterisks. Decimal BCD Binary-coded decimal (BCD) is a class of binary encodings of decimal numbers where each decimal digit (from 0 to 9) is represented by a fixed … Continue reading BCD Calculator →. Hi, We have mainframe files being FTP'ed to HDFS and needs to be loaded into Hive. Converting an EBCDIC Signed field to ASCII as-if it were a character field, using a translation table, results in an improper data-type, as described in detail below. The online Hex to BCD Converter is used to convert hex (Base-16) number to BCD (Binary-coded decimal). Can I define a DFDL/MRM to define my entire data, and then define another DFDL/MRM just to define the Packed Decimal field. Here's a primer to that. Vickery's Home Page. The term BCD in digital electronics often abbreviated as Binary Coded Decimal and it's represented by the seperate group of binary bits. For example, lets say that I have the binary equivalent of 11. packed decimal(16,2) means total 15 digits (including 2 decimal places) plus a sign nibble. 2) Do conversion by writing your own logic without using any predefined methods. Hence is there a way where we can read PD and convert it in to numeric or alphanumeric. It is a standard that was defined in 1963 to allow computers to exchange information, regardless of the manufacturer. Not that I'm aware of, but a Google of "java conversion to packed decimal" threw up lots of attempts by others. The length and decimal positions of ** the resulting value be specified dynamically, however ** we use 30 with 9 decimals since we're assigned the result ** to our own field with presumably the proper field length. Before converting the packed-decimal fields it should be determined if a conversion is necessary. The packed decimal value is 14 digits. ILE C Source to Convert a Packed Decimal to a Packed Decimal with Smaller Integral Part and Smaller Precision. Can anyone suggest me how I can read this data element from the file and convert it into SQL decimal datatype. So we had to manipulate the last nibble to get the correct value. Using a Python recipe? Installing ActivePython is the easiest way to run your project. The following table represents decimal digits from 0 to 9 in various BCD systems. ] [ Convert Decimal Floating-Point Numbers to IEEE-754 Hexadecimal Representations. Following 2 lines of code are equivalent and declare a 3 length PACKED number D PACKNUMBER s 3P 0 D PACKNUMBER s 3 0. Example: Convert 133 to BCD 1. please suggest a method to convert a numeric field to packed decimal in cobol program. Converting to BCD and ASCII We use Hex and Octal numbers to simplify number representation Any symbol can be represented by a code Example: American Standard Code for Information Interchange (ASCII) Each symbol is represented by a seven-bit code (How many symbols can be represented? – 127). The packed decimal format uses half a byte to store each decimal digit. The real problem occurs when the DECIMAL value exceeds the precision of 25 digits (vary upon the Informatica versions). One of the common problems with converting EBCIDIC encoded files is packed numbers (also called "Computational-3", "Packed Decimal", or "Packed") because they are not characters and there is no byte-to-byte conversion for these fields. About 4 bits. Hi all, I need DB2 query to convert Packed decimal to signed decimal value. hello everyone, probably a dumb question. Binary coded decimal numbers may be represented in a number of ways. 2891 has a precision of 6 and a scale of 4. I have worked out how to do most of this, but am having a problem with > a particular field, which in the resulting file on the AS/400 needs to be a > packed decimal number. The IDUG DB2-L Listserv is only part of your membership in IDUG. The radix for Hexadecimal number is 16 i. Binary-coded Decimal. You can have DB2 on the AIX-box convert the EBCIDIC file from the host even when it contains packed decimal numbers. CHECK_AND_CONVERT_NUMERICS is a standard SAP function module available within R/3 SAP systems depending on your version and release level. d format writes missing numerical data as -0. This is true even if the file has Packed Decimal (Comp-3) Fields. As the packed decimal is amount which shud be numeric. My main issue was using the Double data type, the Currency data type, try as I may I couldn't get the value to show with 2 decimals. In that mode, normally packed decimal quantities are little-endian as well, but they are then addressed by the byte at the highest address, unlike operands of every other type, so that the address points to the most significant digit of a packed decimal number just as normal addresses point to the most significant digit of a character string. The answer is a formula that converts the source number into a decimal that Excel can evaluate as a time value. do you have the specification for how the packed decimal data should be ENCODED you have "number" data in Oracle, not really "decimal" data, but if you find the SPECIFICATION for your packed decimal, you should be able to generate a program that can take a number and output it that way. Decimal-place-vn (ARG4) requires an integer or the name of an 8-byte packed decimal work field that specifies the number of decimal places returned in the output. So for every byte of packed decimals, the hex notation will be exactly the same as the decimal equivalent. You can also add edit options to a number converted by PTOA. thats not even important actually i hate bcd :). Step 1 - Convert to BCD. Unpacked BCD format. One of the common problems with converting EBCIDIC encoded files is packed numbers (also called "Computational-3", "Packed Decimal", or "Packed") because they are not characters and there is no byte-to-byte conversion for these fields. Convert SQL decimal to string with 2 decimal places From http://stackoverflow. A decimal point can be specified and blanks are allowed. But in the database world character can be fixed length “Nick ” or varying length “Nick%” and numerics are commonly stored as packed decimal data so 67 could be stored in a field that is 15,5p so would look like. When converting a floating-point or packed-decimal field to alphanumeric format, EDIT removes the sign, the decimal point, and any number to the right of the decimal point. The binary-coded decimal scheme described in this article is the most common encoding, but there are many others. Below is my code. Then, you raise it to a power of 0 and increase that power by 1 each time according to the hexadecimal number equivalent. My Favorite BIF (Built-In Function): %dec submitted by Steve Kontos. in above irq_no get random generated in decimal so by using it i have to calculate the register address which is in hexadecimal. * * This program would best be used by the organization sending the file, * because it has a Cobol compiler and could better deal with. For testing purpose, defined a string called x=’123456′, run. Not that I'm aware of, but a Google of "java conversion to packed decimal" threw up lots of attempts by others. This is described in further detail with reference to FIG. The number may be preceded by a plus or minus sign or followed by a Lor U. I'm trying to use the UTL_FILE package to read a flat file (created in Cobol) that has packed decimal values (COMP-3). The following code: Defines the input file containing the field to be converted (PACKED-NUMBER). So for every byte of packed decimals, the hex notation will be exactly the same as the decimal equivalent. « on: May 03, 2005, 11:26:46 PM » I need to write a procedure that coverts a 4-byte packed BCD to a string of ASCII decimals. As scomack said, if you want to use it as a number, you don't need to convert it: it is already a number. Another larger-than-31-bit function. ] [ Reference Material on the IEEE-754 Standard. The simple way to handle this is to extract the mainframe data into character format, ftp this accross performing the ascii conversion, and then reload this data and convert the character digits into a number when stored. Get the integer quotient for the next iteration. We use it in the form %DEC(date time or timestamp expression {:format}) The converted decimal value will have the number of digits like the date or time format that we mention here in 2nd parameter. The matter of the fact, I received excellent answers to my earlier questions and the blog post has been excellent resource of the solution when it someone wants to convert Hex to Decimal. Now we will write another Assembly program to convert ASCII code to its BCD equivalent. How do I convert a decimal number to a packed decimal number?. I'm trying to convert a field in a text file from Packed Decimal (COMP-3 COBOL) to Character in VB 6. For example, a DECIMAL(3,0) column supports a range of -999 to 999. So that's settled. but more compact. 68, the result will be x'02468C'. Packed BCD: In Packed BCD, two decimal digits are stored into a single byte. Number representation. And present day VLSI, low power is the major consideration for the Design. Computers convert binary data into the hexadecimal (hex) number system because it is much less complex than converting data into decimal numbers, and it is much easier for human beings to read hex numbers than to read binary numbers. But the BCD code is wasteful as many of the 4-bit states (10-to-16) are not used but decimal displays have important applications. Therefore the following ABAP code demonstrates how to always round a number DOWN, the exmaple shows hopw to do it from 2 decimal places to 1 dp but its the same for different variations. JCL & VSAM: Hello, I am trying to convert a packed decimal (S9(7)V99) value to decimal using JCL SYNCSORT. x'000000000F' and x'999999999F' are considered invalid dates, so I want to load nulls into the corresponding. Can we read Packed decimal and convert it to numeric. You can either use 'ZD,TO=PD' or 'ZD,PD' depending upon the Sort product/version your shop has. Is there a formula function that can convert the decimal #'s so I can see the actual roll number in Ascii?. Within the computer, both binary and hex are identical, since they result in the same bit pattern for a given number. Converting a 4-byte packed (BCD) decimal number to a string of ASCII decimals. For example A is 065. The following list provides some basic guidelines. It then right-justifies the remaining digits and adds leading zeros to achieve the specified field length. Conversion functions in BODS_Part2. cast functions to convert data type or db2 functions to convert data types. This format is widely available. Technically it is a rounding operation also. The translate function will convert one character into another and can be used to do Ascii <--> EBCDIC conversion. The byte2base64() function converts an array of bytes to a string in base64 representation. it contains a hex value. Converting a single Signed field to leading sign could cause hundreds of other fields to shift position, causing cascading problems. January 19, 2005 Hey, Ted. Hexadecimal notation shows the contents of memory in four bit chunks. The following code will convert the array of BCD digits in variable bcd to a 32-bit binary value in hex. i want to convert in this number in fixed point 16,14 (2 bytes). Standard algorithms are available, however, such as are used in Ref. To convert from HEX to BCD, you have to first convert the HEX to Decimal, then convert the Decimal digits to BCD digits, by converting each Decimal digit to 4 binary digits. The problem is that I can display the roll order number in 5 cells as decimal numbers from the CLX but it represents an Ascii code. To convert A -> 1, B -> 2 do s = translate(s,'12','AB') the X2C can be used to setup the packed decimal (for packed decimal to String ther is a c2x function) code to convert a character string (number) to packed Decimal is roughly:. Converting numbers to characters is quite easy. By using dd command in Unix one can convert EBCDIC file into ASCII. The device requires that the numbers be in what we used to call "packed decimal" format. Applications must convert EBCDIC numbers into either packed or zoned decimal to perform arithmetic functions. Method of Conversion for Binary & Decimal Numbers. The rules for converting a decimal number into floating point are as follows: Convert the absolute value of the number to binary, perhaps with a fractional part after the binary point. Hope this helps, Rich. x'000000000F' and x'999999999F' are considered invalid dates, so I want to load nulls into the corresponding. Because decimal integers must consist of whole bytes and there must be a sign code on the right, the number of decimal digits is always odd. If you know that other characters are there in the data then you must preprocess that before you use any of the built-in functions using the %XLATE function. Hi all, I need DB2 query to convert Packed decimal to signed decimal value. Converting Packed Decimal to Displayable Format PD values are stored as integers in a compressed internal format but if you know what kind of value is stored in the filed you can use the EDIT feature of DFSORT to make these readable, the EDIT feature also allows you to insert comas , hyphens to make the fields more interpretable as well. For example, if you add the binary number 5 (bit pattern 0101) to binary number 6 (bit pattern 0110), you get the binary result of 11 (bit pattern 1011, or hexadecimal B). By using dd command in Unix one can convert EBCDIC file into ASCII. DAS − decimal Adjust After Subtraction. When converting a floating-point or packed-decimal field to alphanumeric format, EDIT removes the sign, the decimal point, and any number to the right of the decimal point. You can also add edit options to a number converted by PTOA. 2891 has a precision of 6 and a scale of 4. The byte2base64() function converts an array of bytes to a string in base64 representation. Conversion functions in BODS_Part2. As of V5R3, the %dec built-in-function was offically put on steroids. Converting Pega Date to DB2 Date in query; How to convert ISO date to Pega date format. The file being used has two fields: P_NUM and Z_NUM. p must be a value from 1 to 38. In this tip we will look at the issue and how. hi i want to convert 2 double number 0. Hope this helps, Thanks, Phantom. Generates an IEEE floating-point value by multiplying a number by 10 raised to the dth power: Writes packed decimal data in IBM mainframe. About 4 bits. It will convert a decimal number to its nearest single-precision and double-precision IEEE 754 binary floating-point number, using round-half-to-even rounding (the default IEEE rounding mode). PACKED Number : In Fix Format RPG datatype “P” represents PACKED number and for a standalone numeric filed if you dont define a data type it will be default to PACKED number. You can use this method even when you want to covert a binary number such as 1. By using dd command in Unix one can convert EBCDIC file into ASCII. The second parameter 2, tells Python we have a number based on 2 elements (1 and 0). BCD means more memory to hold numbers and more complex schemes for numbers operations. For instance, "p3. The first thing you need is a definition of the EBCDIC file. About the Decimal to Floating-Point Converter. This paper uses densely packed decimal encoding to store significant part of the decimal floating point number. please tell me how i can do this operation in matlab. Is there a formula function that can convert the decimal #'s so I can see the actual roll number in Ascii?. This paper gives a general understanding of how to convert numeric and character SAS variables correctly. 9 Numerical value last digit is the sign digit : A|C|E|F => + ; B|D => - ; the decimal point is virtual its position is defined in the second byte of dec_len. Some examples of conversions from binary to decimal are given in figure 1. The following table represents decimal digits from 0 to 9 in various BCD systems. Here's one way to convert it: d ds d packed 1 8p 0 d hex 1 7 d packsign s 15p 0 c eval packed = 0. Binary-coded Decimal. Short for binary-coded decimal, BCD is also known as packet decimal and is numbers 0 through 9 converted to four-digit binary. Then, Packed (P) format was expanded to allow up to 31 significant digits, since 'D' only allows 15. How to Convert Packed Decimal (PD) COMP-3 Fields to Zoned Decimal Field using DFSORT Sometimes it is needed to convert packed decimal fields to numeric Or display formats for debugging or analysis purposes. The radix for Hexadecimal number is 16 i. Remember to move the decimal 2 places to the right. NUMBERVALUE(Text, [Decimal_separator], [Group_separator ]) The NUMBERVALUE function syntax has the following arguments. Which method is used to convert a binary numbers into decimal number? To convert a binary number into decimal number we use Expansion method. x, this is depricated. A review of IBM S/370 floating point formats, focusing on the precision with which real numbers can be stored. I did look into this a few years back, but decided it was all too hard. To use it, include jt400. In most of the scenarios, your input file has data either in Packed decimal (COMP-3) format or Binary (COMP) format which is not in readable format. x'F1' would pack as x'1F'. I have worked out how to do most of this, but am having a problem with > a particular field, which in the resulting file on the AS/400 needs to be a > packed decimal number. How to Convert a Fraction to a Decimal. If you have only whole numbers use the following. IBM hardware supports packed decimal operations on up to 16-byte packed decimal values. There are a number of instructions devoted to data conversion that we will examine; specifically, we will discuss conversion instructions involving four important data types: Zoned Decimal, Character, Packed Decimal, and Binary data types. Does anyone have experience with packed decimal format? I'm writing a Crystal Report that we can use to export data into a text file to be sent to another agency. This means that a seven-digit packed field with two decimal positions that's edited with %EDITC() and the 'J' edit code will occupy 10 positions when converted to character-seven for the original value, one for the decimal position, one for the thousands notation, and one for the negative sign. You may have to register before you can post: click the register link above to proceed. When you say "decimal number" do you mean a packed or zoned decimal? When you say hex, do you mean a binary number x04D2 = 1234 decimal or the actual string '04D2'? If binary, a simple eval into an integer field does the trick. Conversion from Decimal to BCD is straightforward. For example A is 065. See the complete list of FMs for Decimal Conversion. Packed Decimal Packed decimal numbers are similar to zoned decimal numbers. Packed decimal representation stores decimal data with exact precision. The problem is the packed string doesn't have a sign (assuming it really is decimal packed, and not binary). For testing purpose, defined a string called x=’123456′, run. In computing and electronic systems, binary-coded decimal (BCD) is a digital encoding method for decimal numbers in which each digit is represented by its own binary sequence. Fixed Point Arithmetic and the Packed Decimal Format This set of lectures discusses the idea of fixed point arithmetic and its implementation by Packed Decimal Format on the IBM Mainframes. For decimal arithmetic, the number of decimal digits in the packed format can vary from one to 31. 5-17 bytes. s No conversion; just insert string. Least significant 4-bits carry the weight-age of the decimal digit, while most significant once carry the non-relevant content. Decimal-place-vn (ARG4) requires an integer or the name of an 8-byte packed decimal work field that specifies the number of decimal places returned in the output. f Convert number to signed decimal string of the form xx. [convert]::ToString(15,2) The command and associated output appear here. CONVERTING NUMERIC VARIABLES TO CHARACTER VARIABLES The simpliest way to convert numeric data to character data is using the PUT function. Ravi, you cannot convert a value to a format; I assume your question is actually how to convert one format into another format, in your case going from a string representation of a number to a packed format of that number. For a monetary field of dollars/cents, the assumed number of fractional digits would usually be '2'. When using PTOA to convert a number containing decimals to a character string, you must specify an alphanumeric format large enough to accommodate both the integer and decimal portions of the number. (this example is for 8-bits, other sizes follow the same pattern). BCD is a binary representation of numbers from 0 to 9 Since there could be max 4 bit change from 0 to 9 therefor BCD could be represented by 4 bits. You can convert three decimal digits into ten bits and then back again with no real math at all. data 76 but want to show 76. File is a fixed length. Convert text into ASCII number format. 29 you may still want the result to be 22. ShowTextEncryptedProperty doesnt support TextArea field. Subject: Number Conversion - decimal to binary to hex, etc Questoin #1: Is there a function or module to convert numbers to/from decimal, binary, and hex? Question #2: Is there a function or module to perform binary calculations (AND, OR, XOR)? Russell J Foster e. For example, 38 decimal digits can be encoded in 127 bits, or 71 digits can be encoded in 237. Divide to solve the problem. So 25 is a decimal number and 25h is a hex one. By using dd command in Unix one can convert EBCDIC file into ASCII. Characters are stored in binary in their ASCII representation, such that the number 1 = ascii 49. Is there any java function availabe for the same?If yes,please provide it or some other helpful link. Hope this helps, Thanks, Phantom.