For Programmers: Free Programming Magazines  


Home > Archive > Cobol > May 2004 > Re: Sign Problem---Following example









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Sign Problem---Following example
Dionisis Vrionis

2004-05-26, 2:30 pm

The problem is that i want to take the rm/cobol original values of sign
numeric decimal values to the fujitsu output format and sending(writing) to
the rm/cobol file again without converting them.

Example .

Rm/cobol Values Fujitsu Values.
display --- File Value display
67.50 --- 00000675{ 67.61
20.00 --- 00000200{ 20.0;
-67.59 --- 00000675R -67.50


"Leo Das" <ld@invalid.nospam.nl> wrote in message
news:40B4ABC1.7090502@invalid.nospam.nl...
> Hi Dionisis,
>
> Like Tom said:
> What is cmtext1? We need a bit more information, please.
>
> In general I am familiar with the "problem" of moving an amount with
> assumed decimal point to an alphanumeric field. So maybe the following
> general lesson already helps.
>
> Suppose in the DATA DIVISION we code:
> 01 rec-a.
> 02 kod-a pic x(7).
> 02 value-a pic 9(7)v9(2).
> 01 value-b pic 9(7).9(2).
> 01 value-c pic x(10).
>
> And in the PROCEDURE DIVISION we write:
> MOVE 67.50 TO VALUE-A
> MOVE VALUE-A TO VALUE-C
> Then the alphanumeric value in VALUE-C will not be what you want.
>
> The solution is:
> MOVE 67.50 TO VALUE-A
> MOVE VALUE-A TO VALUE-B
> MOVE VALUE-B TO VALUE-C
>
> But looking at your description, I doubt if that is the problem/solution
> here. If ctlist, cmstatic etc. have not been defined by yourself but
> belong to the features of the compiler, then study the proper Help items.
>
> - Leo -
>
> Dionisis Vrionis wrote:
etc).[color=darkred]
a[color=darkred]
>



William M. Klein

2004-05-26, 3:30 pm

I may be missing something, but it looks to me as if you WANT to have

Pic S9(07)V99 definition for your input
and
Pic -(6)9.99 definition for your output

(possibly Pic -9(7).99 / if you want to show leading zeroes).

--
Bill Klein
wmklein <at> ix.netcom.com
"Dionisis Vrionis" <diovr@dksoft.gr> wrote in message
news:c92ila$mte$1@ulysses.noc.ntua.gr...
> The problem is that i want to take the rm/cobol original values of sign
> numeric decimal values to the fujitsu output format and sending(writing) to
> the rm/cobol file again without converting them.
>
> Example .
>
> Rm/cobol Values Fujitsu Values.
> display --- File Value display
> 67.50 --- 00000675{ 67.61
> 20.00 --- 00000200{ 20.0;
> -67.59 --- 00000675R -67.50
>
>
> "Leo Das" <ld@invalid.nospam.nl> wrote in message
> news:40B4ABC1.7090502@invalid.nospam.nl...
> etc).
> a
>
>



Robert Wagner

2004-05-26, 7:30 pm

"Dionisis Vrionis" <diovr@dksoft.gr> wrote:

>The problem is that i want to take the rm/cobol original values of sign
>numeric decimal values to the fujitsu output format and sending(writing) to
>the rm/cobol file again without converting them.
>
>Example .
>
>Rm/cobol Values Fujitsu Values.
>display --- File Value display
>67.50 --- 00000675{ 67.61
>20.00 --- 00000200{ 20.0;
>-67.59 --- 00000675R -67.50



Try SIGN IS TRAILING. On Fujitsu, the default is 'leading'.



JerryMouse

2004-05-26, 8:30 pm

Robert Wagner wrote:
> "Dionisis Vrionis" <diovr@dksoft.gr> wrote:
>
>
>
> Try SIGN IS TRAILING. On Fujitsu, the default is 'leading'.


No it's not.


theotyflos

2004-05-27, 5:30 am

"Dionisis Vrionis" <diovr@dksoft.gr> wrote in message news:<c92ila$mte$1@ulysses.noc.ntua.gr>...
> The problem is that i want to take the rm/cobol original values of sign
> numeric decimal values to the fujitsu output format and sending(writing) to
> the rm/cobol file again without converting them.


Do I understand correctly that you want to read an RM/COBOL file with
FUJITSU cobol, process it and write to another RM/COBOL file? What do
you mean "without converting them"? Which cobol will read the
resulting file? RM or FUJITSU?

If I understand correctly your problem, then a solution is to redefine
value-a as a pic x(9) and send this to the receiving field:

01 rec-a.
02 kod-a pic x(7).
02 value-a pic 9(7)v9(2).
02 value-b redefines
value-a pic x(9).

move value-b to cmtext1.
Dionisis Vrionis

2004-05-27, 1:30 pm

1.Show the structure of rm file in first post. The structure a have a sign.
2.Not to another rm/file - the same rm/file.
3.Have you ever read and write rm/cobol files form fujitsu?? I do.
4.Something else instead of redefines??
5.Write or send e-mail in gr (for theotyflos).

"theotyflos" <tkan@in.gr> wrote in message
news:3451a3f8.0405262352.6004444f@posting.google.com...
> "Dionisis Vrionis" <diovr@dksoft.gr> wrote in message

news:<c92ila$mte$1@ulysses.noc.ntua.gr>...
to[color=darkred]
>
> Do I understand correctly that you want to read an RM/COBOL file with
> FUJITSU cobol, process it and write to another RM/COBOL file? What do
> you mean "without converting them"? Which cobol will read the
> resulting file? RM or FUJITSU?
>
> If I understand correctly your problem, then a solution is to redefine
> value-a as a pic x(9) and send this to the receiving field:
>
> 01 rec-a.
> 02 kod-a pic x(7).
> 02 value-a pic 9(7)v9(2).
> 02 value-b redefines
> value-a pic x(9).
>
> move value-b to cmtext1.



Frederico Fonseca

2004-05-27, 2:30 pm

On Wed, 26 May 2004 20:03:48 +0300, "Dionisis Vrionis"
<diovr@dksoft.gr> wrote:

Top posting corrected.
>"Leo Das" <ld@invalid.nospam.nl> wrote in message
>news:40B4ABC1.7090502@invalid.nospam.nl...
Just for info, although not the reason why.
cmtext1 is a Text Box from PowerCOBOL.[color=darkred]
>etc).
>a
>
>The problem is that i want to take the rm/cobol original values of sign
>numeric decimal values to the fujitsu output format and sending(writing) to
>the rm/cobol file again without converting them.
>
>Example .
>
>Rm/cobol Values Fujitsu Values.
>display --- File Value display
>67.50 --- 00000675{ 67.61
>20.00 --- 00000200{ 20.0;
>-67.59 --- 00000675R -67.50
>


as I said on an older thread on comp.lang.cobol, although the file
structure is the same (up to a certain point), the usage of the fields
is NOT.

Internal representation of numeric signed fields is done differently
in both Compiler vendors.

Just as an example, look at the following program, and at the output
of both FJ and RM.

Program
IDENTIFICATION DIVISION.
PROGRAM-ID. testing.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 v1 pic x(9).
01 v2 redefines v1 pic S9(7)V99.
01 vz pic -(8).99.
PROCEDURE DIVISION.
move -67.50 to v2
perform 10 times
move v2 to vz
display "vz= " vz " =="
" v1= " v1 " =="
" v2= " v2 " =="
subtract .01 from v2
end-perform.
move 67.50 to v2
perform 10 times
move v2 to vz
display "vz= " vz " =="
" v1= " v1 " =="
" v2= " v2 " =="
add .01 to v2
end-perform.
accept v1.
Very simple program, and the RM version only has a "convert" added to
the V2 display.

Output is as follows.
Fujitsu
vz= -67.50 == v1= 00000675P == v2= -000006750 ==
vz= -67.51 == v1= 00000675Q == v2= -000006751 ==
vz= -67.52 == v1= 00000675R == v2= -000006752 ==
vz= -67.53 == v1= 00000675S == v2= -000006753 ==
vz= -67.54 == v1= 00000675T == v2= -000006754 ==
vz= -67.55 == v1= 00000675U == v2= -000006755 ==
vz= -67.56 == v1= 00000675V == v2= -000006756 ==
vz= -67.57 == v1= 00000675W == v2= -000006757 ==
vz= -67.58 == v1= 00000675X == v2= -000006758 ==
vz= -67.59 == v1= 00000675Y == v2= -000006759 ==
vz= 67.50 == v1= 00000675@ == v2= +000006750 ==
vz= 67.51 == v1= 00000675A == v2= +000006751 ==
vz= 67.52 == v1= 00000675B == v2= +000006752 ==
vz= 67.53 == v1= 00000675C == v2= +000006753 ==
vz= 67.54 == v1= 00000675D == v2= +000006754 ==
vz= 67.55 == v1= 00000675E == v2= +000006755 ==
vz= 67.56 == v1= 00000675F == v2= +000006756 ==
vz= 67.57 == v1= 00000675G == v2= +000006757 ==
vz= 67.58 == v1= 00000675H == v2= +000006758 ==
vz= 67.59 == v1= 00000675I == v2= +000006759 ==
01 FJ-TBL-MINUS pic x(10) value "PQRSTUVWXY".

RM/COBOL

vz= -67.50 == v1= 00000675} == v2= -67.50 ==
vz= -67.51 == v1= 00000675J == v2= -67.51 ==
vz= -67.52 == v1= 00000675K == v2= -67.52 ==
vz= -67.53 == v1= 00000675L == v2= -67.53 ==
vz= -67.54 == v1= 00000675M == v2= -67.54 ==
vz= -67.55 == v1= 00000675N == v2= -67.55 ==
vz= -67.56 == v1= 00000675O == v2= -67.56 ==
vz= -67.57 == v1= 00000675P == v2= -67.57 ==
vz= -67.58 == v1= 00000675Q == v2= -67.58 ==
vz= -67.59 == v1= 00000675R == v2= -67.59 ==
vz= 67.50 == v1= 00000675{ == v2= 67.50 ==
vz= 67.51 == v1= 00000675A == v2= 67.51 ==
vz= 67.52 == v1= 00000675B == v2= 67.52 ==
vz= 67.53 == v1= 00000675C == v2= 67.53 ==
vz= 67.54 == v1= 00000675D == v2= 67.54 ==
vz= 67.55 == v1= 00000675E == v2= 67.55 ==
vz= 67.56 == v1= 00000675F == v2= 67.56 ==
vz= 67.57 == v1= 00000675G == v2= 67.57 ==
vz= 67.58 == v1= 00000675H == v2= 67.58 ==
vz= 67.59 == v1= 00000675I == v2= 67.59 ==


So as you see the representation is totally different, thus if you
have a file with any numeric field with a sign (when not sign
leading/trailing) separate, or with any COMP-xxx.

IF you really need to use FJ while still keeping the file available
for RM programs, then you will need to workout the values to write to
the file yourself.
e.g. something like this.

01 RM-TBL-MINUS pic x(10) value "}JKLMNOPQR".
01 FJ-TBL-MINUS pic x(10) value "PQRSTUVWXY".

01 field-CONV pic x(9).
01 field-rm-n pic S9(7)V99 REDEFINES FIELD-CONV.
01 field-FJ-n pic S9(7)V99 REDEFINES FIELD-CONV.

read from RM file into field-rm-n
inspect FIELD-CONV converting RM-TBL-MINUS TO FJ-TBL-MINUS

move FIELD-FJ-N TO "Text" OF CMTEXT1

(change value on CMTEXT1)
move "Text" OF CMTEXT1 TO FIELD-FJ-N

inspect FIELD-CONV converting FJ-TBL-MINUS TO RM-TBL-MINUS
write to file


This should work. Haven't tried it though.



Frederico Fonseca
ema il: frederico_fonseca at syssoft-int.com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com