× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Not the text that describes the field... The text that is on the screen.
Example:
INPUT1 'This is a 3 position input field'
On the screen:
Enter the company number...: III(Where III = Input1)

I need to extract the "company".

Michael 

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Scott Klement
Sent: Tuesday, February 28, 2006 3:15 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: QDFRTVFD


Hi Michael,

I don't like the QDFRTVFD (or QDBRTVFD) APIs.  They're extremely
cumbersome to use.  Assuming that all you need is to retrieve the
TEXT('whatever') data from the fields on a given file, I'd suggest using
QUSLFLD instead, it's much easier to use.

Here's a sample of a program that you can call to search the fields in a
file for a TEXT() keyword that contains a given string. You call it like
this:

      CALL SCHTEXT PARM('myfile' 'mylib' 'myformat' 'LINE')

In this example, it'll search a file called MYFILE in the MYLIB library. 
It'll search the fields that are in the record format named MYFORMAT.  The
string it searches for is LINE.

It sends it's output to a print file, and it'll look like this:
SCORD1     LINE 1 ORDER
SCCUS1     LINE 1 CUST
SCNME1     LINE 1 NAME
SCORD2     LINE 2 ORDER
SCCUS2     LINE 2 CUST
SCNME2     LINE 2 NAME
SCORD3     LINE 3 ORDER
SCCUS3     LINE 3 CUST
SCNME3     LINE 3 NAME

Showing the field name and the text that matched the search string...  The
program should work on both database files and display files (at least it
does on my machine)

Here's the sample program:

       FQSYSPRT   O    F   80        PRINTER

       D SCHTEXT         PR                  ExtPgm('SCHTEXT')
       D   schFile                     10A   const
       D   schLib                      10A   const
       D   schFormat                   10A   const
       D   schString                   32A   const
       D SCHTEXT         PI
       D   schFile                     10A   const
       D   schLib                      10A   const
       D   schFormat                   10A   const
       D   schString                   32A   const

       D QUSCRTUS        PR                  ExtPgm('QUSCRTUS')
       D   UserSpace                   20A   CONST
       D   ExtAttrib                   10A   CONST
       D   InitialSize                 10I 0 CONST
       D   InitialVal                   1A   CONST
       D   PublicAuth                  10A   CONST
       D   Text                        50A   CONST
       D   Replace                     10A   CONST options(*nopass)
       D   ErrorCode                32767A   options(*varsize:*nopass)

       D QUSPTRUS        PR                  ExtPgm('QUSPTRUS')
       D   UserSpace                   20A   CONST
       D   Pointer                       *

       D QUSDLTUS        PR                  ExtPgm('QUSDLTUS')
       D   UserSpace                   20A   CONST
       D   ErrorCode                32767A   options(*varsize)

       D QUSLFLD         PR                  ExtPgm('QUSLFLD')
       D   UsrSpc                      20A   const
       D   Format                       8A   const
       D   QualFile                    20A   const
       D   RcdFmt                      10A   const
       D   UseOvrd                      1A   const
       D   ErrorCode                32767A   options(*nopass:*varsize)

       D ErrorCode       ds                  qualified
       D   BytesProv                   10I 0 inz(0)
       D   BytesAvail                  10I 0 inz(0)

       D ListHeader      ds                  based(p_ListHeader)
       d   ListOffset                  10I 0 overlay(ListHeader:125)
       d   EntryCount                  10I 0 overlay(ListHeader:133)
       d   EntrySize                   10I 0 overlay(ListHeader:137)

       D Field           ds                  based(p_Field)
       D                                     qualified
       D   Name                        10A
       D   Type                         1A
       D   Use                          1A
       D   OutBufPos                   10I 0
       D   InpBufPos                   10I 0
       D   Size                        10I 0
       D   Digits                      10I 0
       D   DecPos                      10I 0
       D   Text                        50A
       D   EdtCde                       2A
       D   EdtWrdLen                   10I 0
       D   EdtWrd                      64A
       D   ColHdg1                     20A
       D   ColHdg2                     20A
       D   ColHdg3                     20A

       D upper           c                   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
       D lower           c                   'abcdefghijklmnopqrstuvwxyz'
       D TEMPSPC         C                   'FLDLIST   QTEMP'

       D FindStr         s             32A   varying
       D TempField       s                   like(Field.Text)
       D x               s             10I 0
        /free

            FindStr = %trim(%xlate(lower:upper:schString));


            // --------------------------------------------------
            // Delete the user space if it exists (ignore errors)
            // --------------------------------------------------

            ErrorCode.BytesProv = %size(ErrorCode);
            QUSDLTUS( TEMPSPC: ErrorCode );
            ErrorCode.BytesProv = 0;

            // --------------------------------------------------
            // Create a new 128k user space
            // --------------------------------------------------

            QUSCRTUS( TEMPSPC
                    : 'SCHTEXT'
                    : 128 * 1024
                    : x'00'
                    : '*EXCLUDE'
                    : 'List of fields in file'
                    : '*NO'
                    : ErrorCode );

            // --------------------------------------------------
            // Dump list of fields in file to user space
            // --------------------------------------------------

            QUSLFLD( TEMPSPC
                   : 'FLDL0100'
                   : SchFile + SchLib
                   : SchFormat
                   : *OFF
                   : ErrorCode );

            // --------------------------------------------------
            // Get a pointer to the user space
            // --------------------------------------------------

            QUSPTRUS( TEMPSPC: p_ListHeader );

            // --------------------------------------------------
            // Loop through all fields in space
            // --------------------------------------------------

            for x = 0 to (EntryCount - 1);
                p_Field = p_ListHeader + ListOffset + (EntrySize * x);

                TempField = %xlate(lower:upper:Field.Text);
                if %scan(FindStr: TempField) > 0;
                   except print;
                endif;

            endfor;

            // --------------------------------------------------
            // Delete temp user space & end program
            // --------------------------------------------------

            QUSDLTUS( TEMPSPC: ErrorCode );
            *inlr = *on;
        /end-free

       OQSYSPRT   E            Print
       O                       Field.Name          10
       O                       Field.Text          61


---
Scott Klement  http://www.scottklement.com


On Tue, 28 Feb 2006, jmichael.smith@xxxxxxxxxxx wrote:

> I need to provide "search" capabilites on the "text" that was used to 
> describe fields on several display files.
>
> While the text normally remains fixed once it has been changed... I 
> would like it to be dynamic enough to pickup "new" fields.
>
> The QDFTRVFD seems to be the answer(I know when the file changes)...
>
> I am having great difficulty in finding which table contains this 
> information, and then the path to that table.
> I would like to return the "This is a test for line1", etc to a 
> parsing subprocedure(again no problem with this part)
>
> Do you have any ideas?  I have paste'ed a "print screen" for a user 
> space that shows a test display field and the headings...
>
> Again thanks in advance for you time.
>
> Michael Smith
> Certegy, Inc
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.




------------------------------------------------------------------------------
This message contains information from Certegy, Inc which may be confidential 
and privileged.  If you are not an intended recipient, please refrain from any 
disclosure, copying, distribution or use of this information and note that such 
actions are prohibited.  If you have received this transmission in error, 
please notify by e:mail postmaster@xxxxxxxxxxxx
==============================================================================


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.