Programs

Con-nect offers an interface which enables you to use an existing Natural program to create a document in Con-nect. The Natural program itself is not added to Con-nect, it is merely made known to Con-nect via a program definition.

For example, a Natural program can be written to list all entries in a customer's file, check the entries against another list containing the addressees of a recent direct mailing campaign, and indicate whether each customer has received an advertising letter. If you create a document with this program, the results are brought directly into the "Modify Document-name" screen (editor) where you can use them, for example, to write your monthly activity report.

See the example at the end of this document for a Natural program which is made known to Con-nect and used to create a document.

This document covers the following topics:


Adding a Program

When you add a program in Con-nect, you link an existing Natural program to a program name which can later be identified by Con-nect. This process does not bring the Natural program into Con-nect.

Issue the following command sequence from any point in Con-nect:

ADD Program

As a result, the "Add Program" screen appears.

  11:33 AM             * * *  C O N - N E C T  3  * * *                 4.Feb.94
  Cabinet LS                         Add Program                          Friday
                                                                                
           Folder Work___________ File _______________                          
                                                                                
     Program Name ________________________________                              
                                                                                
      Description ____________________________________________________________  
                  ____________________________________________________________  
                  ____________________________________________________________  
                  ____________________________________________________________  
                                                                                
                                                                                
          Program ________  and Library SYSCNT2_                                
                                                                                
      Private use _  or Security Read 7  Modify 7  Copy 7                       
                                                                                
                                                                                
                                                                                
                                                                                
 Complete the information above and press ENTER to add                          
    Command /                                                              /    
 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
       Help  Menu  Quit  In    Send  Foldr Docs  Note  Cal   Flip  Last  Home   

In addition to the information which you enter in every "Add" screen (see The "Add" Screens), you must specify the following program definition criteria in the "Add Program" screen.

Program Name

A unique name which identifies the program within Con-nect (the name can be the same as the name of the Natural program discussed below). The name must not exceed 32 characters.

Program

The Natural program which is to be executed whenever a document is added using the program name specified above.

The Natural program must have been defined previously (by the Con-nect administrator, yourself or another user).

Library

The name of the Natural library in which the program is cataloged. The library defined as STEPLIB is displayed by default. You can specify the current library by typing over the default. (Only the library defined as STEPLIB or the current library may be specified.)

Press ENTER to add the program.

Creating a Document with a Program

You can create documents using the programs which have been identified to Con-nect via the program definition.

The first step is to add a program as discussed in section Adding a Program.

To create a document using a program, issue the following command sequence from any point in Con-nect.

ADD Document name

The "Add Document" screen is displayed.

In addition to the document definition criteria, enter the name of the program you wish to use in creating the document.

Press ENTER.

The program creates the document and places it in the "Modify Document-name" screen, where you can modify it using the editor functions (see Text Processing).

After you have completed the document, issue the QUIT command to save it.

Managing Your Programs

Issue the following command sequence from any point in Con-nect to display a list of all available programs which have been made known to Con-nect:

DISPLAY Program

As a result, the "Display Programs" screen appears.

  11:35 AM             * * *  C O N - N E C T  3  * * *                 4.Feb.94
  Cabinet LS                    Display Programs                          Friday
                                                                                
  Cmd Program Name                   Program  Library  Folder        Date Filed 
  --- ------------------------------ -------- -------- ------------- -----------
  __  Vacation-letter                VAC      SYSCNT2  Work             4.Feb.94
  __  Mail                           MAIL     SYSCNT2  (S)              2.Feb.94
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
 Cmds are 1 or 2 characters from the list below (FLIP for PF-keys)              
    Command /                                                              /    
  Display  Erase    File     Modify   Send     Top                              
                                                                                

The programs are arranged alphabetically. Your own programs are displayed first, followed by those created by the Con-nect administrator. The columns display the following information:

Program Name

The Con-nect program name.

Program

The name of the Natural program to which the Con-nect program name refers.

Library

The name of the Natural library in which the program is cataloged.

Folder

The name of the folder in which the program is stored. Programs which have been created by the Con-nect administrator are marked with (S); you can use these programs, but cannot erase, file or modify them.

Date Filed

The date when the program was first filed in the cabinet.

Commands for Programs

The command prompting line of the "Display Programs" screen shows all the commands which apply to Con-nect programs. The commands are described in section Commands. The following exceptions apply when working with programs:

DISPLAY

The DISPLAY command displays the program definition criteria specified when the program was added. (The program itself is stored in a Natural library, and the only way to display it is via the appropriate Natural commands and statements.)

MODIFY

The MODIFY command allows you to modify the Con-nect program definition criteria, but does not allow you to modify the Natural program itself. You can, however, enter the name of another Natural program to be used for the Con-nect program.

SEND

When you SEND a Con-nect program, the "Send" screen appears; you enter addressee(s), attach a cover note (mandatory) to the program and send it with the CONFIRM command, just as with any other mail item.

When the addressee displays the new mail item in the Inbasket, the cover note is shown first. A message at the bottom of the Inbasket screen says that the mail item is a program. To display the program definition criteria, the addressee must issue the QUIT command.

To use the Con-nect program, the addressee must first FILE it and then specify its name in the "Add Document" screen as discussed in section Adding a Program.

If you want to send the actual Natural program to another user, you must use the IMPORT command to bring the program into Con-nect (see Importing to Con-nect) and then SEND it. However, this is not necessary since every user can access a Natural program.

Example

This example demonstrates how to create a document listing all employees in a specific department who have more than 20 remaining days of vacation in the year.

A Natural program must first be created to extract the data from the database, compute the vacation remaining and create the document.

The example is a Natural program which uses the API subprogram Z-ADD11 to add the document.

0010 ****************************************************************
0020 * PROGRAM NAME : SMPL3
0030 * created by   : Sonya Long
0040 * date         : 17.1.94
0050 *
0060 ***************************************************************
0070 DEFINE DATA LOCAL
0080 01 #CNT        (B10)
0090 01 #DEPARTMENT (A10)
0100 01 BEST-VIEW VIEW OF EMPLOYEES
0110   02 NAME
0120   02 FIRST-NAME
0130   02 DEPT
0140   02 LEAVE-START (1:12)
0150   02 LEAVE-END   (1:12)
0160   02 LEAVE-DUE
0170 01 #I        (N1)
0180 01 #N        (N1)
0190 *
0200 * PARAMETERS FOR API
0210 *
0220 01 RETURN-CODE  (N2)
0230 01 CABINET-NAME(A8)
0240 01 PASSWORD     (A8)
0250 01 DOC-NAME     (A32)
0260 01 SUBJECT      (A60/1:4)
0270 01 DOC-ISN      (P8)
0280 END-DEFINE
0290 *
0300 INPUT 'PLEASE INPUT DEPARTMENT: ' #DEPARTMENT
0310 *
0320 DEFINE PRINTER (1) OUTPUT 'SOURCE'  /* DEFINE THE OUTPUT AREA
0330 FORMAT(1) PS=0
0340 SET CONTROL 'Z'                     /*ERASE WORK AREA
0350 *
0360 MOVE *USER TO CABINET-NAME
0370 *
0380 WRITE (1)'THIS IS THE LIST OF EMPLOYEES IN DEPARTMENT'#DEPARTMENT
0390 WRITE (1)'WITH MORE THAN 20 DAYS OF VACATION REMAINING THIS YEAR'
0400 WRITE (1)'AND WITH THEIR LAST PLANNED VACATION DAYS IN THE YEAR'
0410 WRITE (1)' '
0420 WRITE (1)'NAME' 30T 'DEPT' 40T 'LEAVE-DUE' 50T 'PLANNED LEAVE'
0430 WRITE (1)'--------------------------------------------------------'*DATE
0440 WRITE (1)' '
0450 READ BEST-VIEW BY DEPT WHERE ((DEPT=#DEPARTMENT)AND (LEAVE-DUE > 20))
0460 *
0470 FOR #I=2 TO 5
0480  IF LEAVE-START(#I)= 000000 THEN
0490      COMPUTE #N = #I - 1
0500  END-IF
0510 MOVE 5 TO #I
0520 END-FOR
0530 WRITE (1) NOTITLE NAME 30T DEPT
0540              40T LEAVE-DUE 50T LEAVE-START(#N) LEAVE-END(#N)
0550 END-READ
0560 CALLNAT 'Z-ADD11' RETURN-CODE CABINET-NAME PASSWORD
0570              DOC-NAME SUBJECT(*) DOC-ISN
0580 *
0590 *
0600 IF NOT RETURN-CODE = 51
0610   WRITE 'RETURN-CODE' RETURN-CODE
0620 END-IF
0630 END

Add a program as described in section Adding a Program.

  11:36 AM             * * *  C O N - N E C T  3  * * *                 4.Feb.94
  Cabinet LS                         Add Program                          Friday
                                                                                
           Folder Work___________ File _______________                          
                                                                                
     Program Name Sample-3________________________                              
                                                                                
      Description Creates a special vacation list_____________________________  
                  ____________________________________________________________  
                  ____________________________________________________________  
                  ____________________________________________________________  
                                                                                
                                                                                
          Program SMPL3___  and Library SYSCNT2_                                
                                                                                
      Private use _  or Security Read 7  Modify 7  Copy 7                       
                                                                                
                                                                                
                                                                                
                                                                                
 Complete the information above and press ENTER to add                          
    Command /                                                              /    
 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
       Help  Menu  Quit  In    Send  Foldr Docs  Note  Cal   Flip  Last  Home   

Create a document ("ADD Document") and specify the name of the program to be used in creating the document.

  11:36 AM             * * *  C O N - N E C T  3  * * *                 4.Feb.94
  Cabinet LS                      Add Document                            Friday
                                                                                
           Folder Work___________ File _______________                          
                                                                                
    Document Name Vacation List___________________                              
                                                                                
      Create with Sample-3________________________  ( Form / Program )          
                                                                                
      Description A vacation list of all employees in COMP02__________________  
                  ____________________________________________________________  
                  ____________________________________________________________  
                  ____________________________________________________________  
                                                                                
         Keywords _______________  _______________  _______________             
                  _______________  _______________  _______________             
                                                                                
      Private use _  or Security Read 7  Modify 7  Copy 7  Print 7              
                                                                                
  Expiration Date 4.Feb.95___  Archive on Expiration x                          
 Complete the information above and press ENTER to add                          
    Command /                                                              /    
 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
       Help  Menu  Quit  In    Send  Foldr Docs  Note  Cal   Flip  Last  Home   

Press ENTER.

As a result, the "Modify Document-name" screen, containing the document created by the program appears.

  11:37 AM              * * *  C O N - N E C T  3  * * *                4.Feb.94
  Cabinet LS        Modify  Vacation List                                 Friday
  Folder  Work             File                          Page      1 Line      1
    ....+....10...+....20...+....30...+....40...+....50...+....60...+....70...+.
    THIS IS THE LIST OF EMPLOYEES IN DEPARTMENT COMP02                          
    WITH MORE THAN 20 DAYS OF VACATION REMAINING THIS YEAR                      
    AND WITH THEIR LAST PLANNED VACATION DAYS IN THE YEAR                       
                                                                                
    NAME                DEPT         LEAVE-DUE   PLANNED LEAVE                  
    -----------------------------------------------------94/02/04               
                                                                                
    BOLAN               COMP02        33         94/04/13 94/04/24              
    ROSE                COMP02        33         94/06/01 94/06/05              
    ULRICH              COMP02        32         94/03/16 94/03/20              
    HANSEN              COMP02        31         94/04/27 94/05/01              
    PINKERTON           COMP02        30         94/02/17 94/02/28              
    FORD                COMP02        30         94/02/26 94/02/28              
    LAMPERT             COMP02        29         94/03/18 94/03/20              
    BACH                COMP02        29         94/05/26 94/06/03              
    OSBOURNE            COMP02        28         94/03/26 94/03/27              
 Enter a command, press a PF-key, or enter * to list commands                   
    Command /                                          / used  3 %  Dir +  Del ,
 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
       Help  Menu  Quit  Set         X     Top   Bot   Y     Flip  CX-Y  Home