Working with Prototype Programs

This section describes Prototype Programs and how to handle them. An example prototype program is also given.

This section covers the following topics:


What Are Prototype Programs?

Prototype programs are basic program frameworks for reporting or data maintenance transactions. The program framework for a transaction is generated in Natural reporting mode. A Natural programmer can use the program framework as a prototype for further development. Because it doesn't contain any code specific to Super Natural, a prototype program can be used like any other Natural program.

Note:
When you use prototype programs, Super Natural no longer checks your activities, since you are working withNatural. That means that you are fully responsible for what you do.

Note:
Prototype programs created with Super Natural under Natural Version 2.2 cannot be cataloged under Natural Version 2.3 without revision. This is because the keyword LESS of the NEWPAGE statement is no longer optional, but required.

Listing Prototype Programs

Start of instruction setTo list the prototype programs generated in your present library

  • Issue the PROTOTYPE command.

    The Prototype List screen appears.

    The Prototype List screen functions in the same way as all object list screens. For further information on how to use object list screens, see Object List Screens in Starting Up.

Generating Prototype Programs

Start of instruction setTo generate a prototype program

  • Issue the GENERATE PROTOTYPE command from within a transaction you have finished creating or modifying.

    You can only generate prototype programs from transactions which can be run.

    Prototype programs generated with Super Natural are read into the Natural program editor where they can be modified, saved and/or executed.

    Enter Natural program editor commands at the top left corner of the screen after the greater than sign (>).

    For further information concerning the Natural program editor, refer to the Natural Reference documentation.

Saving Prototype Programs

Start of instruction setTo save a prototype program

  • Issue the SAVE command while in the Natural program editor.

Note:
If you do not save your prototype program before leaving the Natural program editor for the first time, you will lose the prototype and have to generate it again!

When you leave the Natural program editor, the Prototype List screen appears.

When you save a prototype program you have generated from an existing transaction, the transaction name appears on both the Transaction Listscreen and the Prototype List screen.

When you save a prototype program generated from a transaction you are creating which you have not saved or run, the transaction name (program name) appears on the Prototype List screen but not on the Transaction List screen and the transaction is lost.

When you save a prototype program generated from a transaction you are modifying which you haven't saved or run, the transaction name (program name) appears on the Prototype List screen but modifications you have made since you last saved the transaction are lost.

Running Prototype Programs

Do not run a prototype program if you have accessed from Super Natural as this is not a development environment. You will have problems if the program has errors in it. If you want to run a prototype program, access it directly from Natural.

Note:
Prototype programs created with Super Natural under Natural Version 2.2 cannot be cataloged under Natural Version 2.3 without revision. This is because the keyword LESS of the NEWPAGE statement is no longer optional, but required.

Leaving the Natural Program Editor

Start of instruction setTo leave the Natural program editor and return to Super Natural

  • Enter a period (.) in the top line of the editor and press Enter.

Note:
The prototype program is not saved.

Modifying Prototype Programs

Start of instruction setTo modify a prototype program

  • Enter the command abbreviation MO in the command column of the Prototype List screen next to the prototype program name.

    Or:
    Issue the MODIFY PROTOTYPE name command.

    The Natural program editor appears where you can modify the program.

In prototype programs created from data maintenance transactions, the data maintenance statements STORE, UPDATE, DELETE etc. are commented out with asterisks (*) to prevent accidental execution of data maintenance functions. If you access these programs directly from Natural and want to run them, you must remove the asterisks and provide END TRANSACTION and BACKOUT TRANSACTION statements yourself.

Copying Prototype Programs

Program Stored in Your Private Library

If you want to copy a prototype program stored in your private library, you simply save it under a different name in the Natural program editor.

Start of instruction setTo save a program stored in your private library

  1. Enter the command abbreviation MO in the command column of the Prototype List screen next to the prototype program name.

    The Natural program editor appears displaying the prototype program.

  2. Issue the SAVE command together with the name to be assigned (see the note below for naming conventions).

    To identify the new program as a prototype to Super Natural, the first character of the new name must be the prefix for prototype programs at your installation. Otherwise the program will not be listed on the Prototype List screen.

    Now the same program exists twice, but with two different names.

Program Stored in a Public Library

Start of instruction setTo copy a prototype program stored in a public library to your private library

  • Enter the command abbreviation CO in the command column next to the prototype program name of the Prototype List screen in the public library.

    Or:
    Issue the COPY PROTOTYPE name command.

    The prototype program is copied to your private library.

Deleting Prototype Programs

Start of instruction setTo delete a prototype program

  1. Enter the command abbreviation DE in the command column of the Prototype List screen next to the prototype program name.

    Or:
    Issue the DELETE PROTOTYPE name command.

    The Confirm Delete window appears. This window asks you to confirm that you want to delete the prototype program named.

  2. Enter "Y" to delete the prototype program.

    The prototype program is deleted.

Example Prototype Program

The following prototype program was generated with the transaction SAMPLE3 demonstrated in the Tutorial:

                                                                                
 >                                       > +  Program     XSAMPLE3 Lib YSBE     
 Top    ....+....1....+....2....+....3....+....4....+....5....+....6....+....7..
   0010 * PROGRAM: SAMPLE3                                                      
   0020 * AUTHOR : Super Natural                                                
   0030 * DATE   : 93-03-22                                                     
   0040 *                                                                       
   0050 SET GLOBALS LE=OFF ZD=OFF                                               
   0060 FORMAT PS=21 LS=80 SF=1 AD=I HW=OFF EM=OFF KD=ON MP=32767 ES=OFF        
   0070 IS=OFF SG=OFF ZP=OFF MC=1 PC=1                                          
   0080 RESET #HEAD(L)                                                          
   0090 RESET #BE(A8) #BI(A8)                                                   
   0100 PRI. READ ( 1000000 ) SAG-TOURS-E-CRUISE                                
   0110     PHYSICAL                                                            
   0120     WHERE CHARTER-YACHT-TYPE = 'ATLANTIC 29'                            
   0130   REDEFINE START-DATE(PRI.) (2X #BF(N2))                                
   0140   REDEFINE START-DATE(PRI.) (4X #BG(N2))                                
   0150   REDEFINE START-DATE(PRI.) (6X #BH(N2))                                
   0160   REDEFINE END-DATE(PRI.) (2X #BJ(N2))                                  
   0170   REDEFINE END-DATE(PRI.) (4X #BK(N2))                                  
   0180   REDEFINE END-DATE(PRI.) (6X #BL(N2))                                  
   0190   MOVE TRUE TO #HEAD                                                    
   0200   COMPRESS #BH '.' #BG '.' #BF INTO #BE LEAVING NO                      
        ....+....1....+....2....+....3....+....4....+....5....+... S 89   L 1