Could you please explain how the movement in cobol occurs?
Suppose I have an alphanumeric literal defined as x(1) and an numeric lietral defined as 9(1). How does the movement ocurs? Suppose the alphanumeric literal has the value 'A' and the numeric literal has the value 0 . I moved alphanumeric literal to the numeric literal, the numeric literal displays the value as '1' when displayed. How this happens? I know that 'A' has the equivalent value 'F1'(first four bits as F and last four bits as 1) when viewed in the hexadecimal mode, but is it the the case whenever a non numeric value is moved into a numeric field then the equivalent numeric value in the hexadecimal form for the non numeric field is moved into the numeirc field. ALso since all characters in cobol are in EBCDIC format(in which one byte is divided into two 4 bits zone, where the first four bits consitute the zone and the last four bits constitute the digits), does the movement of only first four bits occurs?
I already know that we should avoid doing so, but just need a clarification.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
You have to get your terms straight.
PIC 9 VALUE 1, is not a numeric literal. A numeric literal is, for instance, 1. The part after the word VALUE is a literal, but the data-item you are defining is not a literal. Similarly with the alpha-numeric. "THIS" is a literal. PIC X(4) VALUE "THIS" is a data-item with an initial value established by writing the literal "THIS".
You whole post in in similar half-grasped terms. It would take too long to go through everything. Take your own post. Assume that you know nothing about the subject. Look up everything in manuals. See what you still don't understand and post again.
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
The lack of understanding you display in a single post is awe-inspiring. Your questions cannot be answered in a forum like this, as someone needs to sit you down and spend WEEKS teaching you the fundamentals of COBOL -- not a role for a forum like this.
Your best way to derive an answer is going to be to find the COBOL Language Reference and Programming Guide manuals (hint: there's a link to them at the top of this page), and start reading. You need to read AT LEAST sections 1.39 on Literals, 5.1.6 on Data relationships, and 5.3 on Data division - data description entry to even begin to understand the answer to your question. Don't worry -- if you print them out, that's only 93 pages you need to read. But reading both manuals, cover to cover, would do you a WORLD of good.
And, by the way, the letter A in EBCDIC is x'C1', not x'F1' -- which is a number 1. You also need to spend some time learning the EBCDIC collating sequence, too.