Basic Correlative Interpreter 
Author Message
 Basic Correlative Interpreter

On Sat, 10 Apr 1999 02:53:18 +0100, "Hans Appelo"

Quote:

>For some years now I have used file extract correlatives in basic programs
>and this works very well. E.g. WK1 = OCONV(000100,'TST.CST;X1;;10) will
>return the first value in attribute 10 in file ST.CST on item 000100.  In
>some way this statement interprets a correlative within basic. I have been
>trying unsuccesfully to extend this concept for other types of correlatives
>as well. This has its problems, as a statement of that sort will have to
>refer to a file, item and the correlative itself. A typical logical syntax
>to me would seem WK1 = OCONV(OCONV(000100,'ST.MST'),'F;5;10;*'). I have
>tried many variations of this and have no luck so far and would like to
>request and users out there if they have succeeded with a correlative
>'interpretation' statement.

>Regards - Hans Appelo

I Execute the REFORMAT verb which uses any correlative that can be
written for Access (Pick Access that is!) and it writes the value to a
temporary file, read the result back in, and you have got the answer.

I use it with a report generator which allows the user to place values
from dictionaries into report forms. They select the dictionary that
they wish to use, and position it in a template on the form. The
program calculates the position, executes a Reformat on the dictionary
defined, and includes the value in the report.. This allows the users
to design or modify reports without having to write any code, just
select the dictionaries. A bit like mail-merge.

REFORMAT needs to be handled carefully as you can write back to the
original file if you are not careful! I can mail you some outline
Basic code if you like, drop me an email.

Regards
----------------------------------

Diadem Computing Services Ltd (UK)
Tel:01344 774266  Fax:01344 778069
----------------------------------



Tue, 25 Sep 2001 03:00:00 GMT
 Basic Correlative Interpreter

On Sat, 10 Apr 1999 02:53:18 +0100, "Hans Appelo"

Quote:

>For some years now I have used file extract correlatives in basic programs
>and this works very well. E.g. WK1 = OCONV(000100,'TST.CST;X1;;10) will
>return the first value in attribute 10 in file ST.CST on item 000100.  In
>some way this statement interprets a correlative within basic. I have been
>trying unsuccesfully to extend this concept for other types of correlatives
>as well. This has its problems, as a statement of that sort will have to
>refer to a file, item and the correlative itself. A typical logical syntax
>to me would seem WK1 = OCONV(OCONV(000100,'ST.MST'),'F;5;10;*'). I have
>tried many variations of this and have no luck so far and would like to
>request and users out there if they have succeeded with a correlative
>'interpretation' statement.

>Regards - Hans Appelo

Hans
Further to my first reply, as usual, there is more than one way of
doing things in Pick

I've just remembered another way that can interpret a number of
dictionaries in one go, a little easier and faster than Reformat.

A little used form of SELECT alows you to select an individual item
and by including dict names get the interpreted values for all the
dicts specified eg:

SELECT MYFILE "000100" NAME ADDRESS1 DATE.OF.BIRTH

This will return three values using the correlatives listed,

If you are using this from within a program, execute the statement,
pass the result to an array (How, depends on the version of Pick you
are using) and you have your result.

I used standard subroutine to which is passed the filename, itemname,
and string of dictionaries, it returns an attribute mark delimited
array of the values which can then be utilised from within the
program. The subroutine can be used to trap error messages if
dictionaries are missing..!

Regards

Roger
----------------------------------

Diadem Computing Services Ltd (UK)
Tel:01344 774266  Fax:01344 778069
----------------------------------



Tue, 25 Sep 2001 03:00:00 GMT
 Basic Correlative Interpreter

Quote:

> For some years now I have used file extract correlatives in basic programs
> and this works very well. E.g. WK1 = OCONV(000100,'TST.CST;X1;;10) will
> return the first value in attribute 10 in file ST.CST on item 000100.  In
> some way this statement interprets a correlative within basic. I have been
> trying unsuccesfully to extend this concept for other types of correlatives
> as well. This has its problems, as a statement of that sort will have to
> refer to a file, item and the correlative itself. A typical logical syntax
> to me would seem WK1 = OCONV(OCONV(000100,'ST.MST'),'F;5;10;*'). I have
> tried many variations of this and have no luck so far and would like to
> request and users out there if they have succeeded with a correlative
> 'interpretation' statement.

> Regards - Hans Appelo

Hans,

The reason your original "correlative" works is because it's not really a
correlative, it's a conversion (a subtle, sometime nit-picky difference).
Within Pick Basic, an xCONV is a call to the CONV processor within the Pick O/S
(or dbms, whatever).  The only difference between Iconv and Oconv is a single
bit set to true for Iconv and false for Oconv (I-true; O-false; cute, huh?)
All conversions eventually pass through CONV, the difference is what's
available to the CONV processor when it gets there.

What I mean is, is the first example, you are asking CONV to read a record from
a specific file and bring back a specific attribute.  But the second one has
some serious problems.  First, what would the CONV proc do with
OCONV(000100,'ST.MST')?  ST.MST is not a valid conversion code, so it would
choke.  Second, the correlative processor ASSUMES it has the full record, item
id and all, with a special register pointing at the item body so it can figure
out where 5 and 10 are.  And lastly, the math involved in 5;10;* is a little
more subtle than just multiply attr 5 by attr 10.  And that work depends on
other registers and pointers being setup properly when it gets there.

If you are on a standard Pick platform later than release 6.1.0, there is a
user exit (u85) which is used by the verify-index process to create key data
from the basic record.  The syntax is:

    x = oconv(func:am:lvl:am:id:am:rec:am,'u85')

where func = the correlative you want to execute
          lvl    = the value mark level you are processing at (normally 1)
          id    = the item id of the record
          rec  = the entire record (at least up to the attr you need)
          am  = an attribute mark.  they are important

In the case of the verify-index process, there is an additional user exit
necessary just to setup the index control block that the index correlative is
going to use.

=============================
As Roger pointed out, there is always another way to skin the cat.  You can use
the FILE command in standard Pick Basic.  It's a compiler directive shortcut
that creates a default file descriptor (fv.filename), dimensioned array and
does correlative processing.  For example:

     file CUSTOMERS

     read CUSTOMERS from cust.no then
             print CUSTOMERS(name)
             print CUSTOMERS(address)
             print CUSTOMERS(csz)
     end

In this example, name, address and csz are dictionary items within the
customers file.  At compile time, we figure out what CUSTOMERS(NAME) means and
plug in the code.  If CSZ is a translate with some math, no problemo.  But it
does it because it's expecting to do so.

Everything within the Pick product is inter-related somehow.  As with life,
when you circumvent those relationships, sometimes you get lucky, sometime you
get caught.

--
Sincerely,

--
Mark Brown
Manager, Continuing Engineering
Pick Systems, Inc.   USA

Just when I was winning the rat race, they sent in faster rats.



Tue, 25 Sep 2001 03:00:00 GMT
 Basic Correlative Interpreter
For some years now I have used file extract correlatives in basic programs
and this works very well. E.g. WK1 = OCONV(000100,'TST.CST;X1;;10) will
return the first value in attribute 10 in file ST.CST on item 000100.  In
some way this statement interprets a correlative within basic. I have been
trying unsuccesfully to extend this concept for other types of correlatives
as well. This has its problems, as a statement of that sort will have to
refer to a file, item and the correlative itself. A typical logical syntax
to me would seem WK1 = OCONV(OCONV(000100,'ST.MST'),'F;5;10;*'). I have
tried many variations of this and have no luck so far and would like to
request and users out there if they have succeeded with a correlative
'interpretation' statement.

Regards - Hans Appelo



Wed, 26 Sep 2001 03:00:00 GMT
 Basic Correlative Interpreter
Hans,

Some years ago, I wrote a correlative converter subroutine. If it's of any
interest, I'll dig it out and send you a copy. It will slow down your
processing somewhat (being an external subroutine), but if you're doing many
T-translates from your programs, you're killing your system, anyway ;-). For
several translates from the same file, better to just open the file and read
what you want.

Regards,
Charlie

Quote:

>For some years now I have used file extract correlatives in basic >programs

and this works very well. E.g. WK1 =
Quote:
>OCONV(000100,'TST.CST;X1;;10) will return the first value in >attribute 10 in

file ST.CST on item 000100.  In some way this >statement interprets a
correlative within basic. I have been trying >unsuccesfully to extend this
concept for other types of correlatives
Quote:
>as well. This has its problems, as a statement of that sort will have to
>refer to a file, item and the correlative itself. A typical logical syntax
>to me would seem WK1 = >OCONV(OCONV(000100,'ST.MST'),'F;5;10;*'). I have tried

many >variations of this and have no luck so far and would like to request >and
users out there if they have succeeded with a correlative

Quote:
>'interpretation' statement.

>Regards - Hans Appelo




Wed, 26 Sep 2001 03:00:00 GMT
 
 [ 5 post ] 

 Relevant Pages 

1. A or F correlative in BASIC oconv

2. Basic Subroutine/Correlative Critique Needed

3. Error Interpreter needed

4. Ann: C interpreter for ODBC is available

5. sql interpreter

6. VB interpreter for Access DoCmd

7. External Perl interpreter

8. interpreter or converter for rpt files

9. Server Side Javascript Interpreter ?

10. Update perl cartridge interpreter

11. cursel 0.0.8 : form and menu interpreter

12. SPRL/I - an interpreter for Informix Stored Procedure regression


 
Powered by phpBB® Forum Software