1. How to declare comp-3 for a value -3/2
2. If i have subscript as I[2], which will be picked from below 5 values
Also if my index is set to 4, i.e SET I=4, then which will be picked.
| A | B | C | D | E |
Comp-3
Moderators: dbzTHEdinosauer, Moderator Group
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
There are two ways to define a packed-decimal field. One is with COMP-3. Across different COBOL compilers, COMP-3 is not always packed-decimal. So, for new programs it is good to use PACKED-DECIMAL which is identical to using COMP-3, but is transportable to other compilers.
-3/2, so you need a signed number, which means the PICture string must start with an S. The field must contain an implied decimal-place (since the answer you need to hold is -1.5) so it needs a V. You need one digit before the decimal place, and one digit after.
So, PACKED-DECIMAL PIC S9V9.
-3/2, so you need a signed number, which means the PICture string must start with an S. The field must contain an implied decimal-place (since the answer you need to hold is -1.5) so it needs a V. You need one digit before the decimal place, and one digit after.
So, PACKED-DECIMAL PIC S9V9.
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