answersLogoWhite

0


Best Answer

You need to redefine the char field either in W/S or where it is defined in the input file. If you redefine a char field to numeric you should do a numeric test on the field before using it as numeric, otherwise your may abend with a S0C7. Yea, that's the hard way to do it above... This is one of the most common Easytrieve questions I encounter in the field. There is a macro that is shipped from CA called ALHPACON. You send it an alpha field and it returns a numeric. %ALHPACON ALPHA-FIELD NUMERIC-FIELD Ask your systems programmer to look for the shipped macros if it is not in your maclib.

User Avatar

Wiki User

16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you convert a CHAR to Numeric in easytrieve?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How to check whether a character is numeric in an alphanumeric field in easytrieve.?

IF WS-AGE NUMERIC DISPLAY "NUMERIC" ELSE DISPLAY "NOT NUMERIC' END-IF


How do you convert uppper case character to lower case in easytrieve?

There are a couple of different ways to convert upper case characters to lower case in easytrieve. One is to use the INSPECT/CONVERTING command.


How do you convert char array into unsigned char array in c?

You can't convert the data type of any variable.


How do you convert your income in to numeric value?

numeric value for monthly income


How do you convert char to string?

Character.toString('c')


How you convert 130000 in numeric numbers?

(CXXX)


How do you declare an array in easytrieve?

your wish


How do you convert alphanumeric to packed decimal in easytrieve?

convert alphanumeric to numeric data definitions required convert-this w 5 a convert-this-num convert-this 5 n 0 convert-this-byte convert-this 1 a occurs 5 index ctb-x this-packed w 3 p 0 error-flag 1 1 a procedure is error-flag = 'x' ctb-x = 0 do-while ctb-c < 5 case convert-this-byte value numeric error-flag = error-flag *or any other null action value ' ' convert-this-byte = '0' * if there are valid characters that need to be converted - test for them and convert them, in my day it was spaces to the left convert to zero blindly otherwiese error-flag = 'y' end-case ctb-x = ctb-x + 1 end-do if error-flag = 'y' *define an error routine and execute it else this-packed = convert-this-num * move the field to the resulting packed field "this-packed" end-if


Does Easytrieve have a version of the COBOL uppercase function?

no


How do you convert a char to and int in c plus plus but keep the value of the char so if the char was 3 the int would also be 3?

Formally, you cannot do this. A char containing a character value has a different bit configuration than an int. Attempting to convert between the two is non-portable. However, in the ASCII character set, the character '0' has the value 48, or 0x30. If you subtract 48 from the char you will get the int value, but only if the char was one of the digits '0' through '9'. It is better to use the library routines to convert, such as atoi and sscanf, because they will give you predictable, portable results.


How char data type is represented in the memory?

The char data type is a single 16-bit, unsigned Unicode character. It ranges from 0 to 65,535. They are not integral data type like int, short etc. i.e. the char data type can't hold the numeric values. The syntax of declaring a char type variable is shown as:char caps = 'c';


What is the C plus plus code to print all ASCII codes and the equivalent characters?

Although character data types such as char are intrinsically numeric, whenever you print a char you automatically print the symbol associated with the character code (the char's value), never the code. In order to print the code you must cast the character to a numeric data type, such as int. char c = 'A'; // ASCII value 65 decimal (0x41) std::cout << static_cast<int>(c); // puts the value 65 on std::cout