Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Knowing Data type of a Variable 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How do I know the data type of a variable which may be in binary, comp, comp3 , char, varchar etc any DB2 format.

I am writing a program that reads a flat file that has DB2 data, converts the data to some other form(char and integers and floats) which may be easily deciphered and writing the converted data to another flat file.
 
Manish,

If I understand your question correctly, I don't think you can tell with 100% certainty, what data format a particular field in a record is, just by looking at it. Your application program has to know what to expect (e.g copybooks).

You can peform appropriate validation on a data field to see what its properties are (binary / character / decimal etc), but this won't guarantee a correct answer e.g. a valid decimal field is also a valid hex field! You can't differentiate just by looking.

One idea, if the input record field formats are flexible, is to embed control information about the field just before it. This could be a few bits that identify what format the field is (hex / char / dec etc) and how long it is. The REXX program can then handle this 'flexible' file.

Hope this helps!

Cheers,
Dave.
mailto: dave.ring@barclays.co.uk

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top