Re: [Cobolforgcc-devel] MOVE 2002
Status: Pre-Alpha
Brought to you by:
timjosling
From: Tim J. <te...@me...> - 2001-04-03 08:54:24
|
Bill, The problem I have is that is says (p484 s14.10.24.3) "conversion of the sending operand to the internal representation takes place". That's good, but what sort of conversion? 01 v1 usage binary-long signed value 123. 01 v2 pic x(5). move v1 to v2. There are many ways to convert a binary number to an alphanumeric (see the C function printf for a list). The result could be: "123bb" (b=blank) or "00123" or "00000" (with the remaining digits 00123 truncated on the right, on the basis that the 32 bit integer gets converted to a 10 digit string because it needs that many characters to hold 32 bit numbers in general). Pre-COBOL 2002, the problem probably did not exist as everything has a PIC, so the number of characters is defined. Reading the standard again, I find that the reverse situation *is* covered OK (ie move pic x(n) to binary-*). So moving "123" to a binary-char gets you 123, whereas moving " 123" gets you an error. Tim Josling "William M. Klein" wrote: > > I believe that the MOVE rules in the FCD are all written talking about > "numeric" items as either INTEGER or NON-INTEGER. The BINARY-xxxx items > *are* integer, the FLOAT-xxxx depend on whether or not STANDARD arithmetic > is in effect and what the "evaluate" to. Rules that "explicitly" talk about > sign or non-signed depend on the "singed" phrase for BINARY-xxxx. I believe > that all the FLOAT-xxxx items are ALWAYS signed. > > Is there some specific rule that you have a question about? > > If you haven't already, look at the rules for "integers in general rules" on > page 20 of the FCD. > > > -----Original Message----- > > From: cob...@li... > > [mailto:cob...@li...]On Behalf Of Tim > > Josling > > Sent: Sunday, April 01, 2001 4:24 PM > > To: cobolforgcc-devel > > Subject: [Cobolforgcc-devel] COMPUTE and MOVE 2002 > > > > > > I have now implemented compute (compiler subset - no > > overflow/size error; only the subset's supported data types). > > Move is next. > > > > By the way Bill if you are reading this do you know what the > > following code should do (in COBOL 2002)? > > > > 01 v1 usage binary-char signed value 123. > > 01 v2 pic x(5). > > > > move v1 to v2. > > display "*" v2 "*". > > > > Is the answer the same if v1 is unsigned? > > > > how about this? > > > > move "00123" to v2 > > move v2 to v1 > > display v1. > > > > The description of move in the standards seems to assume a PIC is > > present for all elementary data items, but this is not so for > > binary-* and also for the floating point types which have a > > similar issue. > > > > Tim Josling > > > > _______________________________________________ > > Cobolforgcc-devel mailing list > > Cob...@li... > > http://lists.sourceforge.net/lists/listinfo/cobolforgcc-devel > > _______________________________________________ > Cobolforgcc-devel mailing list > Cob...@li... > http://lists.sourceforge.net/lists/listinfo/cobolforgcc-devel |