gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] Question about assignment in translated C by OpenC


From: henry wang
Subject: Re: [open-cobol-list] Question about assignment in translated C by OpenCOBOL
Date: Sun Nov 6 00:50:03 2005

I have soloved this assignment using cob_move(..)
>Why do you use packed decimal for this?
 
This is a legacy COBL program  written by another peple. I donLt know why.
 
I try to translated to C, then make interface with another program.
 
V is for decimal position.
 
Henry
 

"John R. Culleton" <address@hidden> wrote:
On Friday 04 November 2005 08:20 pm, henry wang wrote:
> Hi OpenCOBOL developers,
>
> I˜[m using the functionality of OpenCOBOL: translate
> COCOL program test1.cob to C, then add some API,
> Today I encounter the problem of assignment in
> translated C by OpenCOBOL.
>
> --------------- test1.cob (only 9 lines)
> ---------------
>
> IDENTIFICATION DIVISION.
> PROGRAM-ID. test1.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 01 HH0006 PIC S9(0007)V PACKED-DECIMAL VALUE 128.
>
> PROCEDURE DIVISION.
> DISPLAY "HH0006 is " HH0006.
> STOP RUN.
>
> -------------------end of test.cob
> --------------------------
> run:
> # cobc test1.cob -fmain -free -C
> I get test1.c and test1.c.h
>
> I want to change HH0006 from initial value 128 to 1,
> following two lines are added in the test.c:
> int new_value = 1;
> (*(int *) (b_5)) = new_value;
> Now I get the new value of HH0006:+0100000
> Euh... it is +0100000, I wish that '+0000001' will be
> displayed.
> In file test.c.h ˜[static unsigned char b_5[4];˜[ is
> generated for variable HH0006.
>
> Could you help me for the correct assignment? Thank
> you in advance!
>
> Kind regards,
> Henry
>
>
>t
I have a couple questions.

Why do you use packed decimal for this? I would think that
either display or computational would be more suitable to feed
into a C program to be modified later. Packed format is not
something that C has.

Why do you use a picture clause of 9(0007)V? What purpose does
the "V" serve?.

Finally, what is the purpose of your attempt?

Well, that is three questions. Perhaps someone else has some
answers for you.

--
John Culleton
Books with answers to marketing and publishing questions:
http://wexfordpress.com/tex/shortlist.pdf

Book coaches, consultants and packagers:
http://wexfordpress.com/tex/packagers.pdf

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


reply via email to

[Prev in Thread] Current Thread [Next in Thread]