[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [open-cobol-list] OpenCobol 1.0 MOVE bug?
From: |
Bill Klein |
Subject: |
Re: [open-cobol-list] OpenCobol 1.0 MOVE bug? |
Date: |
Fri, 25 Jan 2008 16:36:50 -0600 |
The Standard (current and recent) says that you may move an INTEGER numeric
to an alphanumeric receiving item, but your sending item is not an integer,
so it is illegal according to the Standard. PerCOBOL *may* have a
documented extension to allow the other case, but it isn't Standard (and
isn't something that most compilers that I know of allow).
If the sending numeric, non-integer item is "usage display" then you might
want to consider the solution of:
move verprijs (1:) to artikelnaam
reference modifying the sending item makes it alphanumeric and should give
you the answer that you want.
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Pieter Baele
> Sent: Thursday, January 24, 2008 11:11 PM
> To: address@hidden
> Subject: [open-cobol-list] OpenCobol 1.0 MOVE bug?
>
> Hi,
>
> We get lessons cobol on University College, and I try to use
> OC instead
> of legacyj percobol.
>
> When I try to compile the following, I recieve errors (but works in
> percobol)
>
> Short version:
>
> fd artikel.
> 01 artikel-rec.
> 05 verprijs pic s9(4)V99.
> ...
> working-storage section.
> 01 titellijn.
> 03 artikelnaam pic x(9) value 'ARTIKEL'.
> ...
> move verprijs to artikelnaam
>
>
> It seems it is not possible to move a number field to a
> string field...
> Or maybe our solution is wrong and there is a work-around?
>
> Complete version:
> address@hidden ~/cobol]$ cobc -x oef4.cbl
> oef4.cbl: In paragraph 'nieuwe-prijs-par':
> oef4.cbl:57: Error: Invalid MOVE statement
> oef4.cbl:58: Error: Invalid MOVE statement
> oef4.cbl:63: Error: Invalid MOVE statement
> oef4.cbl:64: Error: Invalid MOVE statement
> oef4.cbl:69: Error: Invalid MOVE statement
> oef4.cbl:70: Error: Invalid MOVE statement
>
>
> 000100 IDENTIFICATION DIVISION.
> 000200 PROGRAM-ID. oef4A_0708.
> environment division.
> input-output section.
> file-control.
> select artikel assign to "artikel"
> organization is indexed
> record key is artikelnr
> access mode is random.
> data division.
> file section.
> fd artikel.
> 01 artikel-rec.
> 05 artikelnr pic x(6).
> 05 naam pic x(20).
> 05 per pic xxx.
> 05 stock pic 999.
> 05 aanprijs pic s9(4)V99.
> 05 verprijs pic s9(4)V99.
> 05 categorie pic x(4).
> working-storage section.
> 01 ws-artikelnr pic x(6).
> 01 prijsverhoging pic 99.
> 01 tussenres pic s9(6)V99.
> 01 nieuwe-prijs pic s9(6)V99.
> 01 winst pic s9(7)V99.
> 01 nieuwe-winst pic s9(7)V99.
>
> 01 titellijn.
> 03 beschr pic x(20) value spaces.
> 03 artikelnaam pic x(9) value 'ARTIKEL'.
> 03 pic x(5) value spaces.
> 03 aang-artikel pic x(12) value
> 'ARTIKEL + X%'.
>
> procedure division.
> pgm.
> open i-o artikel.
> display 'geef artikelnummer'
> accept ws-artikelnr
> move ws-artikelnr to artikelnr
> read artikel invalid key
> display 'verkeerd artikelnr -
> bestaat niet'
> not invalid key
> perform nieuwe-prijs-par
> end-read
> accept ws-artikelnr
> close artikel.
> stop run.
> nieuwe-prijs-par.
> display 'geef prijsverhoging'
> accept prijsverhoging
> display titellijn
> multiply verprijs by prijsverhoging giving tussenres
> divide tussenres by 100 giving nieuwe-prijs rounded
> Add verprijs to nieuwe-prijs
> move 'verkoopprijs' to beschr
> move verprijs to artikelnaam
> move nieuwe-prijs to aang-artikel
> display titellijn
> subtract aanprijs from verprijs giving winst
> subtract aanprijs from nieuwe-prijs giving
> nieuwe-winst
> move 'winst op 1 item' to beschr
> move winst to artikelnaam
> move nieuwe-winst to aang-artikel
> display titellijn
> multiply stock by nieuwe-winst
> multiply stock by winst
> move 'totale winst' to beschr
> move winst to artikelnaam
> move nieuwe-winst to aang-artikel
> display titellijn.
>
>
> --------------------------------------------------------------
> -----------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> open-cobol-list mailing list
> address@hidden
> https://lists.sourceforge.net/lists/listinfo/open-cobol-list
>