View previous topic :: View next topic
|
Author |
Message |
lakshmankumar Currently Banned New User
Joined: 02 Jun 2010 Posts: 6 Location: Mysore
|
|
|
|
01 PARM-PRCSS-YYMMDD.
10 PARM-PRCSS-YY PIC 9(02) VALUE 12.
10 PARM-PRCSS-MM PIC 9(02) VALUE 34.
10 PARM-PRCSS-DD PIC 9(02) VALUE 56.
01 PRCSS-DATE PIC S9(09) COMP-3 VALUE ZEROS
Move PARM-PRCSS-YYMMDD TO PRCSS-DATE .
OUTPUT : PRCSS-DATE 12345
-----------------------------------------
PARM-PRCSS-YYMMDD : 123456 but I after move comp-3 having 12345
but i am exepecting same value 123456
truncation is happaning why ? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What the heck were you expecting? Tell us, exactly, in the five-byte packed-decimal field, what were you expecting when you moved a six byte group item to it? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
that is the problem with the new compliers.
instead of forcing people to use NUMVAL/IF NUMERIC etc..
it allows idiot code to compile and then expects the same coders to have read the documentation and understand what happens.
it is like teaching someone to drive and providing only one instruction:
here is the gas pedal. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
lakshmankumar: your problems are many here:
1. There is a link at the top of the page to Manuals. Click on it, find the COBOL Language Reference manual, and read it until you understand the internal format for DISPLAY, group, COMP-3 variables.
2. You have invalid values for month and day in your grouip variable -- never a good idea.
3. If you read section 6.2.24.3 of the COBOL Language Reference manual, you will find that using a group for your MOVE source means no data conversion will happen. This is important because COMP-3 and DISPLAY do not have the same internal format.
4. If you do not understand why PRCSS-DATE is a 5-byte variable, you need to go back to the COBOL Language Reference manual for more reading.
Finally, based upon your issue and your complete and total lack of understanding of COBOL, I highly recommend you leave this forum and join the Beginners and Students Forum instead. This forum is for professional programmers and you are a long way from being a professional programmer. |
|
Back to top |
|
|
|