HP 3000 Manuals

##entry/##endentry [ VIRTUOSO CODE GENERATOR Reference Manual ] MPE/iX 5.0 Documentation


VIRTUOSO CODE GENERATOR Reference Manual

#entry/#endentry 

Defines a block of text that is to be included in a specified section.

Syntax 

     #entry [name="entry-name"] section="section-name"
      .
      .
     statements 
      .
      .
     #endentry

Parameters 

entry-name       is the name of the block of text being defined.  It is
                 limited to 32 characters in length and is restricted to
                 valid generator keywords.  Refer to Chapter 2 for
                 information on valid keywords.  This keyword is
                 optional.

section-name     is the name of a section in which the block of generated
                 text is to be included.  Sections are defined with the
                 #section construct.

statements       are statements or user text lines.

Description 

This construct lets you define blocks of generated text which are placed
in specified sections of the output.  By defining an #entry you can
control the order of the generated text.  The prime benefit of the
construct is to allow the efficient and modular generation of code.

The text defined in the #entry/#endentry is placed in the specified
section.  The section can precede or follow the entry, but an error is
reported if the section is not defined.  All entries to be included in a
section are placed at the location of the #section statement.

The entries are ordered alphabetically by entry name within the
particular section.  Only a single occurrence of a named entry is placed
in the generated text For example, if an entry defines a paragraph to be
generated, you can be sure that the paragraph is generated only once.
Subsequent executions of the #entry construct with duplicate names do not
generate When the name keyword is omitted, the entry is placed before any
named entries within the section.  Each unnamed entry generates new code
within its section, in the order that the entries are defined.

Nesting of #entry/#endentry constructs is allowed, but remember that the
nesting limit is 40.  That is, there cannot be more than 40 nesting
levels in existence at one time.  This includes nesting of #for/#endfor,
#if/#endif, #include, #block/#endblock, #entry/#endentry and macro calls.

The #section construct can be used within an #entry to include
information defined by another entry.  See the #section description for
more details.

Examples 

The following source illustrates the use of the #entry and #section
constructs.

     IDENTIFICATION DIVISION.
     DATA DIVISION.
     WORKING-STORAGE SECTION.
        .
        .
        .
     PROCEDURE DIVISION.
        .
        .
     #section name="initialization-statements"
        .
        .
     #ReviewMaster element="!element" record="!record" &
     #      image-dataset="!image-dataset" image-database="!image-database"
        .
        .
        .
         GOBACK.
     #section name="image-routines"
     #DefineRecord record="!record" section="working-storage"

     Macros Invoked in the Source Code: 

     #macro ReviewMaster element=string        &
     #                   record=string         &
     #                   image-dataset=string  &
     #                   image-database=string
     #
          PERFORM REVMAST-!image-dataset
             THRU REVMAST-!image-dataset!-EXIT

     #entry name="REVMAST-!image-dataset"  section="image-routines"

      REVMAST-!image-dataset.
          PERFORM
           .
           .
           statements 
           .
           .
          END-PERFORM.
      REVMAST-!image-dataset!-EXIT.  EXIT.

     #endentry

     #macro DefineRecord record="string"  section="string"

     #if section="working-storage"
     #
     #   entry name="initialize-!record" section="initialization-statements"
             INITIALIZE !record!-DATA
     #   endentry
     #
     #endif
        .
        .
        .

The rearranged generated text looks like this when the image-dataset is
T-IMAGE-DATASET and record is TEST-RECORD:

     IDENTIFICATION DIVISION.
     DATA DIVISION.
     WORKING-STORAGE SECTION.
        .
        .
        .
     PROCEDURE DIVISION.
        .
        .
         INITIALIZE TEST-RECORD-DATA.
        .
        .
         PERFORM REVMAST-T-IMAGE-DATASET
             THRU REVMAST-T-IMAGE-DATASET-EXIT
        .
        .
        .
         GOBACK.
      REVMAST-T-IMAGE-DATASET.
          PERFORM
           .
           .
           statements 
           .
           .
          END-PERFORM.
      REVMAST-T-IMAGE-DATASET-EXIT.  EXIT.



MPE/iX 5.0 Documentation