Progress
AppBuilder
Developer’s Guide


Access Section (adeuib/_accsect.p)

Use the adeuib/_accsect.p procedure to read and write code sections in AppBuilder:

Calling Sequence
RUN adeuib/_accsect.p
  ( INPUT        pc_mode ,
    INPUT        pi_context ,
    INPUT        pc_section ,
    INPUT-OUTPUT pi_srecid ,
    INPUT-OUTPUT pc_code
  ) . 

Input Parameters

The adeuib/_accsect.p procedure takes the following input parameters:

pc_mode

A quoted character string that specifies the mode of operation. Valid values are:

pi_context

The context ID of the object to access. If unknown (?), AppBuilder assumes the current window or procedure.

pc_section

The name of the code section to access. Valid values are:

Input-Output Parameters

The adeuib/_accsect.p procedure uses the following INPUT-OUTPUT parameters:

pi_srecid

The context ID of the current section. If its value is other than unknown, pc_section is ignored.

pc_code

The contents of the trigger or other code section.

Return Values

This procedure returns:

“Error”

Indicates that pi_context is not specified and there is no current procedure or window.

Examples

The following code resets the MAIN-CODE-BLOCK to an include file:

 /* Get the current value */
  pi_srecid=?.
  RUN adeuib/_accsect.p ("GET", ?, "MAIN-CODE-BLOCK",
                         INPUT-OUTPUT srecid
                         INPUT-OUTPUT code).
  IF RETURN-VALUE NE "Error" THEN DO:
    IF code ne "{include.i}" THEN DO:
       code = "{include.i}".
       RUN adeuib/_accsect.p ("SET", ?, ?,
                              INPUT-OUTPUT srecid,
                              INPUT-OUTPUT code). 
    END.
  END. 

The following example creates a AppBuilder-maintained procedure: a procedure that the Code Section Editor displays as a READ-ONLY procedure. The following code fragment calls adeuib/_accsect.p:

DEF VAR section_id as INTEGER INITIAL ?.
DEF VAR code AS CHAR .

RUN adeuib/_accsect.p(INPUT "SET":U,
                      INPUT ?, 
                    INPUT "PROCEDURE:mytest:maintain.p", 
                     INPUT-OUTPUT section_id,
                     INPUT-OUTPUT code). 

In this example:

This maintain.p procedure generates the code for the mytest internal procedure:

/*----------------------------------------------------------------------
File: maintain.p

Description:
    Sample procedure showing how a developer procedure can maintain
    a AppBuilder Code Section.
Input Parameters:
    p_id  - (INTEGER) context ID of the current procedure
    
Output Parameters:
    p_Code - (CHAR) code to return. (Including "END PROCEDURE." ). 
  
------------------------------------------------------------------------*/
DEFINE INPUT  PARAMETER     p_id      AS INTEGER    NO-UNDO.
DEFINE OUTPUT PARAMETER     p_code    AS CHAR       NO-UNDO.

DEFINE VAR ch AS CHAR NO-UNDO.

/* Line for comments. */
&Scoped-define COMMENT-LINE 
-----------------------------------------------------------------------
/* Standard End-of-line character */
&Scoped-define EOL CHR(10)

/* Get some info about the current procedure. */
RUN adeuib/_uibinfo.p (p_id, ?, "FILE-NAME", OUTPUT ch).

p_code =   
"/*{&COMMENT-LINE}" + {&EOL} +
"  Purpose:     Sample code for file " + ch + {&EOL} + 
"  Parameters:  <none>" + {&EOL} + 
"{&COMMENT-LINE}*/" + {&EOL} + {&EOL} +
"   MESSAGE ’Hello World!’:U." + {&EOL} + {&EOL} +
"END PROCEDURE.". 

The maintain.p procedure generates a mytest procedure that the Code Section Editor displays as read only. Here are the contents of the generated mytest procedure:

/*-----------------------------------------------------------------------
  Purpose:     Sample code for file C:\WORK\V-CUST.W
  Parameters:  <none>
------------------------------------------------------------------------*/

   MESSAGE ’Hello World!’:U.

END PROCEDURE. 

AppBuilder-maintained Procedures provide an alternative to traditional XFTRs. They basically fill the role of an XFTR with only a single WRITE handler. The advantages of AppBuilder-maintained procedures over XFTRs are:

Their disadvantages are:


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095