COMP-3 TO ALPHANUMERIC MOVE
Moderators: dbzTHEdinosauer, Moderator Group
-
- Member
- Posts: 4
- Joined: Thu Feb 16, 2006 12:24 pm
COMP-3 TO ALPHANUMERIC MOVE
Is it possible to move a COMP-3 variable to an Alphanumeric variable directly?
01 A1 PIC S9(3) COMP-3 VALUE 1234.
01 B1 PIC X(4).
....
...
MOVE A1 TO B1.
DISPLAY B1.
.....
What will be displayed and what would be the content of B1?
01 A1 PIC S9(3) COMP-3 VALUE 1234.
01 B1 PIC X(4).
....
...
MOVE A1 TO B1.
DISPLAY B1.
.....
What will be displayed and what would be the content of B1?
- Rupesh.KOthari
- Member
- Posts: 17
- Joined: Thu Feb 16, 2006 5:27 pm
Hi Jaydeeppal,
You cannot move a COMP-3 variable to alphanumeric directly. It will not give a SOC7 error but will you give you a return code 12 stating that comp-3 and alphanumeric variables did not follow the move compatibility rule.
The solution
01 A1 PIC S9(4) COMP-3 VALUE 1234.
01 A1-NUM PIC S9(4) VALUE ZEROES.
01 B1 PIC X(4).
MOVE A1 TO A1-NUM.
MOVE A1-NUM TO B1.
DISPLAY B1.
This will work
Happy coboling !!!
You cannot move a COMP-3 variable to alphanumeric directly. It will not give a SOC7 error but will you give you a return code 12 stating that comp-3 and alphanumeric variables did not follow the move compatibility rule.
The solution
01 A1 PIC S9(4) COMP-3 VALUE 1234.
01 A1-NUM PIC S9(4) VALUE ZEROES.
01 B1 PIC X(4).
MOVE A1 TO A1-NUM.
MOVE A1-NUM TO B1.
DISPLAY B1.
This will work
Happy coboling !!!
Thanks and Regards,
Prashant
Prashant
-
- Member
- Posts: 1
- Joined: Mon Feb 22, 2010 4:31 pm
Hi all,
I didnt got any abend when I used this concept in batch code.PFB code for your reference.
01 WS-COMP3-VAR PIC 9(06) COMP-3.
01 WS-NAME PIC X(09) VALUE 'RAMESH'.
MOVE WS-NAME TO WS-COMP3-VAR
DISPLAY 'comp3 VALUE IS' WS-COMP3-VAR
I got some junk values may converted data.
out put for the same is:
comp3 VALUE IS528000
Please let me know still u have any doubt so that i can share the code which i have for the same
Regards,
Ramesh.Ambadi.
[img][/img][url][list=][/list][/url][/code][/list]
I didnt got any abend when I used this concept in batch code.PFB code for your reference.
01 WS-COMP3-VAR PIC 9(06) COMP-3.
01 WS-NAME PIC X(09) VALUE 'RAMESH'.
MOVE WS-NAME TO WS-COMP3-VAR
DISPLAY 'comp3 VALUE IS' WS-COMP3-VAR
I got some junk values may converted data.
out put for the same is:
comp3 VALUE IS528000
Please let me know still u have any doubt so that i can share the code which i have for the same
Regards,
Ramesh.Ambadi.
[img][/img][url][list=][/list][/url][/code][/list]
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