IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Moving group varibale to COMP3 variable


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
lakshmankumar
Currently Banned

New User


Joined: 02 Jun 2010
Posts: 6
Location: Mysore

PostPosted: Thu Jul 14, 2011 4:28 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jul 14, 2011 4:36 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 14, 2011 4:41 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jul 14, 2011 5:05 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts Compare latest 2 rows of a table usin... DB2 1
Search our Forums:

Back to Top