Data truncation in cobol

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
soumya.k
Member
Posts: 5
Joined: Mon Sep 03, 2012 9:45 pm

Data truncation in cobol

Post by soumya.k » Fri Sep 28, 2012 5:11 pm

How does the truncation happens on cobol data types when moving a variable with greater size to a smaller one? Is it from the left side or right side?

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Fri Sep 28, 2012 6:19 pm

Depends on the definition of the receiving field.

Numeric/numeric edited (PIC and some combinations of 9) left.

Alpha-numeric/alpha-numeric edited (PIC and some combinations of X) right, unless "JUST RIGHT" when it is left.

Alpha (PIC and some combinations of A) right.

COMP-1/-2 right, where possible to occur

You have a specific question?

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Sat Sep 29, 2012 12:19 am

And I do believe it is in the manual - look in the index for truncate or truncation for starters.
Regards
Nic

Post Reply

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



Other References
Mainframe Tools and others