For Programmers: Free Programming Magazines  


Home > Archive > Cobol > May 2005 > DBACCESS POWERCOBOL AND NUMERIC FIELD









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 DBACCESS POWERCOBOL AND NUMERIC FIELD
ramzenit

2005-05-10, 8:55 pm

Hello,
I USE DBACCESS OCX FOR READ or write A MSACCESS TABLE.
IT WORK CORRECTLY BUT NOT WORK ON FIELD DEFINED :
NUMERIC
PRECISION 13
SCALE 2

POWERCOBOL DEFINE A FIELD S9(11)v99 but not read the field and not
write the record.

The code is

ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WorkLvl pic 9(4) comp-5.
01 CONTA PIC 999 VALUE ZERO.
01 CAMPO1 PIC s9(14)v9999 .
PROCEDURE DIVISION.
LLOP.
ADD 1 TO CONTA.
IF CONTA > 10 GO FINE.
*
MOVE CONTA TO "CODICE" OF DB-Jobs-Database.
MOVE "PIPPO" TO "DESCIRIZIONE" OF DB-Jobs-Database.
MOVE +123,45 TO CAMPO1.
*
MOVE campo1 TO "IMPORTO" OF DB-Jobs-Database.
MOVE "2005/05/25" TO "DATAE" OF DB-Jobs-Database.
INVOKE DB-Jobs-Database "WriteRecord".
GO LLOP.

FINE.

INVOKE DB-Jobs-Database "CloseDB".

Tanks in advance

ramzenit

2005-05-10, 8:55 pm

Thanks,
but not is this the problem.
On windows upper and lowercase is the same.
The problem is field structure.
on decimal field not work!!.

Robert Jones ha scritto:
> Hello Ramzenit,
>
> I don't know PowerCOBOL, but your definition "CAMP01" is slightly
> different from the name "campo1" in the MOVE statement. While COBOL
> should translate between upper and lowercase OK, it looks as though
> there is a zero in the definition and a letter 'o' in the name used

in
> the MOVE. I am surprised that the program got through the compiler,
> but maybe Powercobol interprets rather than compiles.
>
> Robert


Pete Dashwood

2005-05-10, 8:55 pm

Check that you have "decimal point is comma" in the environment division.

Make sure that your database definitions are compatible with the definitions
in WS.

Numeric fields cannot be more than s9(14)v9(4).

You cannot use binary fields.

"ramzenit" <mbazan@tin.it> wrote in message
news:1115453667.153576.17870@o13g2000cwo.googlegroups.com...
> Hello,
> I USE DBACCESS OCX FOR READ or write A MSACCESS TABLE.
> IT WORK CORRECTLY BUT NOT WORK ON FIELD DEFINED :
> NUMERIC
> PRECISION 13
> SCALE 2
>
> POWERCOBOL DEFINE A FIELD S9(11)v99 but not read the field and not
> write the record.
>

Where is this field defined? I don't see it below.

> The code is
>
> ENVIRONMENT DIVISION.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 01 WorkLvl pic 9(4) comp-5.
> 01 CONTA PIC 999 VALUE ZERO.
> 01 CAMPO1 PIC s9(14)v9999 .
> PROCEDURE DIVISION.
> LLOP.
> ADD 1 TO CONTA.
> IF CONTA > 10 GO FINE.
> *.
> MOVE CONTA TO "CODICE" OF DB-Jobs-Database.


Make sure you have connected to the database and specified the table you
want. You cannot reference database fields in the DB Object in the way you
are doing here. What is DB-Jobs-database? It cannot be a PowerCOBOL DB
connection object because that object does not have these properties...

> MOVE "PIPPO" TO "DESCIRIZIONE" OF DB-Jobs-Database.
> MOVE +123,45 TO CAMPO1.
> *
> MOVE campo1 TO "IMPORTO" OF DB-Jobs-Database.
> MOVE "2005/05/25" TO "DATAE" OF DB-Jobs-Database.
> INVOKE DB-Jobs-Database "WriteRecord".


This is a method of the PowerCOBOL connection object. But your field
references are not to properties of it.

Something is very wrong here...

> GO LLOP.


It LOOKS as if you have a reference to a table on a database and that
reference is called DB-Jobs-Database.

How did you get it?

Please post your code if you want proper analysis.


>
> FINE.
>
> INVOKE DB-Jobs-Database "CloseDB".
>
> Tanks in advance
>
>

....followed by the infantry...

Pete.



Pete Dashwood

2005-05-10, 8:55 pm

OK, I was puzzled by your problem and so I loaded the OCX into a PowerCOBOL
form and read the docs on it. I see now how you are referencing the fields.

Try defining fields that require a decimal as 'currency' on the ACCESS DB.
That worked for me. It is a clumsy workaround but for most commercial work
you never need more than 4 places.

A better solution is to move to MySQL as your database :-) (That's what I
did after using ACCESS for years; never regretted it.)

Pete

<snipped>



Sponsored Links







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

Copyright 2008 codecomments.com