Hi,
Please let me know
how to add two fileds which are chars...
they may have the values as
premium1 = 0450{
premium2=0325{
the braces indicate positive or negative premium
DB2 - to add char fields having 450{ as one of its value
Moderators: Kalicharan, Moderator Group
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
as an after thought.
1. only idiots use char columns to contain numeric data that is intended for arithmetics.
2. you may end-up having to select both columns into host variables (pic x-type)
then use your programming language to place the data into numeric variables
and then perform the addition.
1. only idiots use char columns to contain numeric data that is intended for arithmetics.
2. you may end-up having to select both columns into host variables (pic x-type)
then use your programming language to place the data into numeric variables
and then perform the addition.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
we have a field called pos_12_to_98 in the table which may have both digits and alphabets... we have to add the data in particular positions in which we have digits and braces... we know that we can use cast for datatype conversion..
the problem is how to add when we have braces in the value? Is there any way to convert braces to '+' or '-'
POS
12
TO
98
+---------------------
00000000010}000000
00000000010}000000
the problem is how to add when we have braces in the value? Is there any way to convert braces to '+' or '-'
POS
12
TO
98
+---------------------
00000000010}000000
00000000010}000000
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
well, the close brace means -0,
and the others are as follows:
other values such as -104 would be stored as 10M.
and sure, there are all kinds of columnar functions that you could use to get the substr of the column
(db2 tables do not have fields)
into a usable format for arithmetics.
suggest you look at the manuals for your version of db2 and determine what you can do.
and the others are as follows:
Code: Select all
0 {
1 A
2 B
3 C
4 D
5 E
6 F
7 G
8 H
9 I
-0 }
-1 J
-2 K
-3 L
-4 M
-5 N
-6 O
-7 P
-8 Q
and sure, there are all kinds of columnar functions that you could use to get the substr of the column
(db2 tables do not have fields)
into a usable format for arithmetics.
suggest you look at the manuals for your version of db2 and determine what you can do.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
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