Hi,
I have a table with one of the varaibles declared as VARCHAR(4000).
at position 50 for that variable, i have a packed value of s9(9) comp-3
i need to query this table to pick records that have a value of 5000 @ 5.
Sample data in hex format
0004400000
00C000050C
when i use the cast funciton to just select this record i get the below error message. 'An invalid character string argument was used with the DECIMAL function.'
query used is
CAST(SUBSTR(ORE_RECORD_DATA,5,5) AS DEC(5))
Please, help me out.
Thanks
Bola
CAST function
Moderators: Kalicharan, Moderator Group
Cast function
Bola,
I haven't had to do your requirement before, but I played around with it a little and this seems to work. There may be easier ways to accomplish the same thing. Maybe someone else will chime in with a different way.
HEX(SUBSTR(ORE_RECORD_DATE,5,5) = HEX(CAST(5000 AS DEC(9)))
Dave
I haven't had to do your requirement before, but I played around with it a little and this seems to work. There may be easier ways to accomplish the same thing. Maybe someone else will chime in with a different way.
HEX(SUBSTR(ORE_RECORD_DATE,5,5) = HEX(CAST(5000 AS DEC(9)))
Dave
-
- Member
- Posts: 8
- Joined: Fri Sep 21, 2007 11:03 pm
CAST Function - done thanks
Hi Dave,
thanks very much for the reply. yes, it is working fine and also the below format is doing fine.
SUBSTR(ORE_RECORD_DATA,1390,5) = X'000005000C'
Thanks
Bola
thanks very much for the reply. yes, it is working fine and also the below format is doing fine.
SUBSTR(ORE_RECORD_DATA,1390,5) = X'000005000C'
Thanks
Bola
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page