COBOL II/XL (663 Views)
Reply
Occasional Contributor
Robert Badillo
Posts: 5
Registered: ‎01-28-2002
Message 1 of 12 (663 Views)
Accepted Solution

COBOL II/XL

I have a third party TurboImage data base that contains BusinessBasic floating decimals (K2 and K3 items ). How can I process these numbers in a Cobol II/XL program?
Trusted Contributor
Lars Appel
Posts: 131
Registered: ‎12-27-1996
Message 2 of 12 (663 Views)

Re: COBOL II/XL

The internal storage format is documented in the following manual under "Floating-Point Decimal Format"...

http://docs.hp.com/cgi-bin/doc3k/B3265090015.10436/9

So, if nothing else helps, you might have to resort to writing your own conversion subroutines to and from a data type that COBOL supports.

You might probably save some effort by registering for a logon to the Invent3K system and using the BBXL compiler there to write a few little conversion subroutines...

http://jazz.external.hp.com/pads/

The above machine has all HP compilers installed and access is free of charge.
see www.google.com/search?q=lars+appel
Trusted Contributor
Lars Appel
Posts: 131
Registered: ‎12-27-1996
Message 3 of 12 (663 Views)

Re: COBOL II/XL

Oh, and yet another option might be to ask in the HP3000-L internet forum (also known as comp.sys.hp.mpe Usenet newsgroup)...

http://raven.utc.edu/archives/hp3000-l.html

http://groups.google.de/groups?group=comp.sys.hp.mpe

Maybe someone else already faced a similar issue in the past and is willing to share his or her solution.
see www.google.com/search?q=lars+appel
Advisor
susan gregory
Posts: 10
Registered: ‎02-05-2002
Message 4 of 12 (663 Views)

Re: COBOL II/XL

There are some compiler library routines/quasi-intrinsics called HPINEXT and HPEXTIN that will convert floats to ascii string numbers (PIC 9 DISPLAY) and back again and they can be called from COBOL. For native mode programs, it will assume IEEE format for the reals. If they are not in that format (HP3000 REALS) you may need to call HPFPCONVERT first and last.

Hope that helps.

Susan
Advisor
susan gregory
Posts: 10
Registered: ‎02-05-2002
Message 5 of 12 (663 Views)

Re: COBOL II/XL

If those quasi-intrinsics aren't what you need, then their are some other numeric type manipulation/conversion routines in the same compiler library manual.

Occasional Contributor
Robert Badillo
Posts: 5
Registered: ‎01-28-2002
Message 6 of 12 (663 Views)

Re: COBOL II/XL

Hello Susan and Lars,
I have already been trying these compiler routines. The routines work fine with R2 or R4 fields but I am having problems trying to convert these BBASIC floating decimals fields. I trying different combinations of the HPFPCONVERT and HPINEXT intrinsics at the moment. Thanks.

Trusted Contributor
Lars Appel
Posts: 131
Registered: ‎12-27-1996
Message 7 of 12 (663 Views)

Re: COBOL II/XL

I haven't tried it, but I doubt that those two intrinsics will work with Business Basic "floatingpoint" numbers. As far as I understand, they only apply to HP 3000 MPE/V reals and MPE/IX IEEE reals.

Also see http://docs.hp.com/cgi-bin/doc3k/B3265090015.10436/9
see www.google.com/search?q=lars+appel
Trusted Contributor
Lars Appel
Posts: 131
Registered: ‎12-27-1996
Message 8 of 12 (663 Views)

Re: COBOL II/XL

The easiest method might be writing a few small Business Basic subprograms for the conversion and linking them to your COBOL program.

Something in the line of...

5 GLOBAL OPTION SUBPROGRAM
10 SUB dec2real(SHORT DECIMAL D, SHORT REAL R)
20 LET R=D
30 SUBEND

This way the Business Basic runtime system has to take care of the conversion work.

Keep in mind, however that real number conversions are "lossy" operations, i.e. typically inexact due to the differences in internal represenation.

So it might be -in some cases- better to add your required operations to the subroutines instead of just doing conversion back and forth.

It depends ;-)
see www.google.com/search?q=lars+appel
Occasional Contributor
Robert Badillo
Posts: 5
Registered: ‎01-28-2002
Message 9 of 12 (663 Views)

Re: COBOL II/XL

Lars, what my problem is not converting to real but I am trying to access a third party data base which has BBASIC floating decimals stored as K2 or K4 item types via IMAGE/SQL (ODBCSE/Link) in MS Access . Query has a solution with the run time option PARM=%777, which handles the fields as decimal (D2 or D4) data types. What I need is a PARM=%777 option for ODBCSE/Link or converting the items via Cobol II (we do not have BBASIC on our system) and storing the data in a data base which MS Access can handle.
Thanks.
Trusted Contributor
Lars Appel
Posts: 131
Registered: ‎12-27-1996
Message 10 of 12 (663 Views)

Re: COBOL II/XL

Ah, not COBOL, but ODBC.

As far as I recall, a certain Image/SQL version introduced some SIGNED/UNSIGNED ZONED as well as BBASIC related type mapping...

Unfortunately, I don't recall details. Only that it the above changes were related to requests by Interex SIGIMAGE at that time.

The UPDATE TYPE commands in IMAGESQL were enhanced to allow targets like FLOAT with FORMAT=BB1 or BB2 or somesuch.

Sorry for not having better details at hand.
see www.google.com/search?q=lars+appel
Trusted Contributor
Lars Appel
Posts: 131
Registered: ‎12-27-1996
Message 11 of 12 (662 Views)

Re: COBOL II/XL

Hmmm... to follow up to my own reply... Found some info in an 6.5 Communicator article...

Communicator 3000 MPE/iX Release 6.5
-> Announcing a Post 6.5 Release Patch
--> IMAGE/SQL Date Mapping Enhancement
see www.google.com/search?q=lars+appel
Trusted Contributor
Lars Appel
Posts: 131
Registered: ‎12-27-1996
Message 12 of 12 (662 Views)

Re: COBOL II/XL

> (we do not have BBASIC on our system)

Also see http://jazz.external.hp.com/pads/ for info how to obtain a free logon to a 3000 on the public internet, where you could use all available HP compilers to create programs or subprograms as needed.

By the way, my above decimal-to-real example was somewhat silly as COBOL would not be able to use the real numbers easily ;-)
see www.google.com/search?q=lars+appel
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.