Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagetext
 D* procedure to override field data, from *SRVPGM PROFOUNDUI               
 D profoundui_overrideValue...                                              
 D                 pr                  ExtProc('profoundui_overrideValue') 
 D  FileName                       *   value options(*string:*trim)        
 D  RecordName                     *   value options(*string:*trim)        
 D  FieldName                      *   value options(*string:*trim)        
 D  Data                           *   value options(*string)              
 D  DataLen                      10i 0 value                   

 


How to use this procedure:

  1.  Include /COPY member PROFOUNDUI/QRPGLEINC, PUIRDF in your progarm.
  2.  Define the field with a small size (less than 32K) in your Rich Display File. The objective is to define the large fields with "dummy" small sizes so that the total size of the record format will be less than 32K so that the Rich Display File as normalcan be compiled.
  3.  In your program, before a WRITE or EXFMT, call procedure profoundui_overrideValue() to indicate to the Profound UI handler to use the data specified on the procedure call (instead of the data in the DDS record) for the specified field and record format. Use the parameters “Data” and “DataLen” to point to the location and length of the data.
  4.  Compile and run your program with service program PROFOUNDUI in the library list.
  5.  At WRITE or EXFMT time, the Profound UI handler will send that data to the Rich Display File for that field in that record format.

...

  • Suppose you have a customer address file CUSTADRP with the following fields
    • CUSTNO: zoned(4:0)
    • NAME: char(30)
    • STREET: char(30)
    • CITY: char(20)
    • STATE: char(2)
    • POSTAL: char(10)
  • The fields NAME, STREET, CITY are defined on the Rich Display File with their normal sizes.However, you "dummy" small sizes of char(30), char(30), char(20), respectively.
  • You want to send very large data (> 32K) for those fields to the Rich Display File at WRITE or EXFMT time.
  • The example program uses procedure profoundui_overrideValue() to override the value for those fields (NAME, CITY, STREET), using data from the big fields “bigName”, “bigStreet”, “bigCity”,  before doing WRITE or EXFMT to the record format,
  • The large fields can be type CHAR, VARCHAR, or CLOB, as shown in the example.
Code Block
languagetext
      /DEFINE PROFOUNDUI 
     FCUSTADRP  if   e           k disk
     FMYFILE    CF   E             WorkStn Handler('PROFOUNDUI(HANDLER)')
 
      /COPY QRPGLEINC,PUIRDF
 
        dcl-s  bigName    char(35000);
        dcl-s  bigStreet  varchar(40000);
        dcl-s  bigCity    sqlType(clob: 45000);
        dcl-s  temp       char(37000);
        dcl-s  fileName   char(10) inz('MYFILE');
 
        // main()
 
        custno = 1234;
        chain custno custadrp;
 
        if %found(custadrp);
 
          // Override fields NAME, STREET, CITY, to use large fields
 
          // char(35000) field; use %addr(field) for Data, -1 for DataLen for 0-terminated
          // string, 34K bytes
          bigName = *all'X';
          %subst(bigName: 1: 5) = 'START';
          %subst(bigName: 34000-3+1: 3) = 'END';
          %subst(bigName: 34000+1  : 1) = x'00';
 
          profoundui_overrideValue('MYLIB/MYFILE': 'FM01': 'name':        // fileName can be qualified name
                                   %addr(bigName  ): -1              );   // -1 for 0-terminated
 
          // varchar(40000) field; use %addr(field:*data) for Data, %len(field) for DataLen
          temp = *all'Y';      // 37K
          bigStreet = temp;    // use 37K of 40K
          %subst(bigStreet: 1: 5) = 'START';
          %subst(bigStreet: 37000-3+1: 3) = 'END';
 
          profoundui_overrideValue(fileName: 'FM01': 'street':
                                   %addr(bigStreet:*data): %len(bigStreet));
 
          // clob(45000) field; use %addr(field_data) for Data, field_len for DataLen
          exec SQL select BIGCITY
                    into  :bigCity
                    from  CUSTADRP2
                    where custno = :CUSTNO;
          if sqlCode <> 0;
             bigCity_data = 'bigCity not found in CUSTADRP2';
             bigCity_len = %len(%trim(bigCity_data));
          endif;
 
          profoundui_overrideValue(fileName: 'FM01':  'city':
                                   %addr(bigCity_data):  bigCity_len);
  
          exfmt FM01;
 
        endif;
 
        *InLr = *On;
        Return;
 

 

 


 As an example, the bound field "NAME" is defined in the Rich Display File as char(30). However, at run time, procedure profoundui_overrideValue() is used to send 34K bytes of data for that field to the browser, to be displayed. Bound field "STREET" is defined as char(30), but 37K of data will be sent for that field. Bound field "CITY" is defined as char(20), but 45K of data will be sent for that field.


Image Added


Example screen output:

Image Added