Extracting Table Data

Kalyansid

New Member
Hi,

Need your help on extracting table data on run time. The below query only gives field level information. But I need to extract data from a table given as input on runtime.

FOR EACH _FIELD OF _file NO-LOCK WHERE _file._file-name = v-inp.
EXPORT DELIMITER "," _FIELD.
END.

Please suggest. I am using progress version 8.3b on HP Unix box.
 
8.3 is incredibly ancient, dreadfully obsolete and woefully unsupported.

It lacks features like dynamic queries which would make your request possible (if I understand you properly you want to extract arbitrary data with a runtime only license -- in other words you lack a full compiler license).

You should upgrade.

You could do a "proutil tablename -C dump" and get a binary dump files which you could then load into a modern and supported release (like 10.2B or 11). You could write some shell scripts to do that dynamically. But I doubt that is what you are looking for.
 
8.3 is incredibly ancient, dreadfully obsolete and woefully unsupported.

It lacks features like dynamic queries which would make your request possible (if I understand you properly you want to extract arbitrary data with a runtime only license -- in other words you lack a full compiler license).

You should upgrade.

You could do a "proutil tablename -C dump" and get a binary dump files which you could then load into a modern and supported release (like 10.2B or 11). You could write some shell scripts to do that dynamically. But I doubt that is what you are looking for.

Thanks Tom. Do you have any workaround for Progress Ver 9.1d. Will this work?
 
Wow, even by my whats-wrong-with-outhouses-and-churning-your-own-butter standards, 8.3 is indeed long in the tooth.

In 9.1D you can use dynamic queries, which are exactly designed to do what you are talking about. They are kind of like on-the-fly SQL in mainstream languages. The downside is the syntax is much more complicated and therefore prone to runtime errors. Here is a quick snip that I found. "Some_Table" could be anything and could be input at runtime. This code is woefully lacking in error checking.

Code:
DEF VAR p_table AS C NO-UNDO INIT "some_table".
DEF VAR h_bh AS HANDLE NO-UNDO.
DEF VAR h_qh AS HANDLE NO-UNDO.
CREATE QUERY h_qh.
CREATE BUFFER h_bh FOR TABLE p_table.
h_qh:SET-BUFFERS(h_bh).
h_qh:QUERY-PREPARE("FOR EACH " + p_table).
h_qh:QUERY-OPEN.
REPEAT:
    h_qh:GET-NEXT.
    IF h_qh:QUERY-OFF-END
    THEN LEAVE.
    DEF VAR h_ct AS I NO-UNDO.
    DO h_ct = 1 TO h_bh:NUM-FIELDS:
        IF h_bh:BUFFER-FIELD(h_ct):EXTENT = 0
        THEN DISP h_bh:BUFFER-FIELD(h_ct):BUFFER-VALUE.
        ELSE DISP h_bh:BUFFER-FIELD(h_ct):EXTENT.
    END.
END.
DELETE OBJECT h_bh NO-ERROR.
DELETE OBJECT h_qh NO-ERROR.
 
9.1D is ancient, obsolete and unsupported.

As Greg points out it does, however, have dynamic queries.

If you are upgrading why aren't you upgrading to something current? Why go from one unsupported release to another? The effort is no greater to go to a current release. If you go to a current release you even save money on annual maintenance.

None the less -- if you are going to insist on "upgrading" from "incredibly ancient" 8.3 to "merely ancient" 9.1 you should at least go with 9.1E service pack 4. It is 6 years old and there will never be another release of v9 but 9.1E04 fixes all the bugs that will ever be fixed between 9.1D and 9.1E04.
 
I agree with Tom and Greg about that you should upgrade, but perhaps this will serve.

Code:
DEFINE VARIABLE c-Table AS CHAR FORMAT 'x(32)'.
REPEAT:
   UPDATE c-Table.
   OUTPUT TO z-export.p NO-ECHO.


   /* ---------------------------------------------- */
   PUT UNFORMATTED 
   'OUTPUT TO C:/TEMP/' c-Table '.d NO-ECHO.'   SKIP
   'FOR EACH ' c-Table ' NO-LOCK:'              SKIP
   '    EXPORT ' c-Table '.'                    SKIP
   'END.'                                       SKIP
   'OUTPUT CLOSE.'.
   /*----------------------------------------------- */
   OUTPUT CLOSE.
   
   COMPILE z-export.p SAVE NO-ERROR.
   
   IF NOT ERROR-STATUS:ERROR
   THEN
       RUN z-export.p .
END.

Regards.
 
We are working on the assumption that he lacks a compiler license (because he is asking for a runtime solution). But if we are mistaken and one is actually available this (or a variation of it) would certainly work.
 
Back
Top