SoftCode SCF/SCP Commands

Since function keys and program options are contained in a database rather than in the program, a number of the applications within the Soft Code system have command interfaces created to invoke SOFTCODE processes from a command line. The following commands may be entered to invoke Soft Code processes.

CPYSFTDTA: Copy soft code data    
EDTPNLKEY: Edit panel keys
EDTPNLOPT: Edit panel options
WRKPNLKEY: Work with panel keys
WRKPNLOPT: Work with panel options
WRKSECGTE: Work with security gate
WRKSFTUSR: Work with Soft Code Users

This set of commands provides an easy to remember management suite for the applications designed to use the soft coded utilities. If they seem familiar, they should. The command syntax mimics the IBM syntax of verb and object.

This suite of commands allows a developer to create and maintain application security, externally defined panel options, and externally defined function key events.

Program Options

Options are managed like function keys. Program options can be externally defined in a table. It is a different table than the function keys but is structured the same.

     A****************************************************************
     A* PHYSICAL FILE- SCOPTNPF                                      *
     A*                                                              *
     A* FUNCTION     - This file provides a definition of the        *
     A*                macro instructions to be executed from a      *
     A*                HLL, or the function editor program, as       *
     A*                selected user options.                        *
     A*                                                              *
     A* PROGRAMMER   - Steve Croy        04/11/06                    *
     A****************************************************************
     A          R RSCOPTN                   TEXT('PROGRAM OPTIONS')
     A            OPGMID        10          TEXT('PROGRAM ID')
     A                                      COLHDG('PROGRAM ID')
     A            OPNLID        10          TEXT('PANEL/SCREEN ID')
     A                                      COLHDG('PANEL' 'ID')
     A            OPTNID        10          TEXT('OPTION ID')
     A                                      COLHDG('OPTION' 'NUMBER')
     A            OMACRO        45          TEXT('OPTION ACTION')
     A                                      COLHDG('MACRO' 'ACTION')
     A            OPTEXT        20          TEXT('TEXT DESCRIPTION')
     A                                      COLHDG('DESRCIPTION')
     A            OPAUTL         3          TEXT('AUTHORITY LEVEL')
     A                                      COLHDG('Authority' 'Level')
      * Key section
     A          K OPGMID
     A          K OPNLID
     A          K OPTNID


Options and function keys were deliberately separated in case future developement causes them to diverge. I used the option file to store hyperlinks for CGI web script as well as providing dynamic options for 5250-based applications.

SoftCode Applications Continued

Database Driven Functions

The program function keys and macro instructions are contained in the data base file, SCFUNCPF. The program options and option macros are contained in the database file, SCOPTNPF. By removing the function keys and options from the program, the operations performed by the options and function keys may be maintained independently of the program itself.

Function key assignments and program options may be removed from the application without changing the program code. Conversely adding new functions or program options can be performed without changing the program code. (Unless a new parameter list happens to be introduced.)

Because the function editor manages a program’s options and functions, commands, such as DSPMSG, or WRKACTJOB may be added to a program without any change to existing program code. The Soft Code editor is coded to recognize a command (a string starting with an ampersand ‘&’) and execute the command. The program does not have to contain a routine to execute a command, the function editor with provide the capability. In effect, the database files supporting the Soft Code provide a method of building macro instructions for applications to share.

Another benefit of moving program functions and objects from the actual program (and display file) is the text of the function is stored with the function. The text displayed for the function or option is contained in the database along with the macro instruction. Thus a program can be designed to be multi-lingual. On one application the F3 (Exit) function may read ‘Exit’ and in another application the same function may read ‘Salida’ (Spanish), or ‘Ausgang’ (German).

A Soft Code application does not really react to a function key, or an option. The editor looks up the function key or panel option and returns the ‘function’ to the requesting program. This increases the flexibility of the application and allows it to be compatible with other system i environments. For example a program may be coded to exit when the macro instruction returned is ‘EXIT’. The macro ‘EXIT’ may be assigned to F3, to be consistent with AS/400 mode panels, or F7 (End Job) so it is familiar to users used to working in the S/36 environment.

The macro instruction field of the soft coded program options and function keys is 45 bytes long. This instruction may contain several different types of operations. And in SoftCode, the macro instruction may take several different formats. An ampersand '&' in byte 1 identifies a CL command. The Soft coded function editor will pass this command on to the generic command executive program to be processed.

    000000000111111111122222222223333333334444444
    123456789012345678901234567890123456789012345

    &WRKACTJOB
    |
    |____________Command to process

An asterisk (*) in byte 1 signals a reserved function. Code has been included in the soft-coded function editor to process the macro instruction, it will not be returned to the requesting program.

    000000000111111111122222222223333333334444444
    123456789012345678901234567890123456789012345

    *HELP
    |
    |____________Soft coded internal process

With no special characters imbedded in the instruction, the macro instruction will be returned to the requesting program for execution. In this case, the format is left to the requesting program to interpret. A standard format for macro instructions to drive subroutines is evident in the process of command keys and other common program operations.

           ThisFormat = fmtnam;                                                                     
           ThisPgm = prgnam;                                                                          
           GetFunction(thisPgm
		:thisFormat
		:keypressed
		:fkeyid:macro:authl); [1]
                                                                                                       
              SELECT;                                                                               
              WHEN KeyPressed = functionKey.ENTER;                                                  
                 EXSR @ENTER;                                                                       
              WHEN KeyPressed = functionKey.ROLLUP;                                                 
                 EXSR @LOAD;                                                                        
              WHEN KeyPressed = functionKey.ROLLDN;                                                 
                 EXSR @DOWN;                                                                        
              WHEN KeyPressed = functionKey.F23;                                                    
                   DisplayOptions(option: z$opt1: z$opt2: O);                                       
              WHEN KeyPressed = functionKey.F24;                                                    
                   DisplayKeys(cmdkey: z$key1: z$key2: M); [2]                                           
              WHEN Function = 'EXIT';                                                               
                 QUIT();                                                                            
              WHEN Function = 'CANCEL';                                                             
                 EXSR @return;                                                                      
              WHEN Function = 'RESET';                                                              
                 EXSR @RESET;                                                                       
              WHEN Function = 'PROMPT';                                                             
                 EXSR @PROMPT;                                                                      
                 IF promptDta <> *blanks;                                                           
                    PromptDta = *blanks;                                                            
                    EXSR @RESET;                                                                    
                 ENDIF;                                                                             
              WHEN Function = 'HELP';                                                               
                 HelpText(ThisPgm:fmt);                                                             
              WHEN SUBOP = 'CALL';                                                                  
                 EXSR @CALLS;                                                                       
              WHEN Function = 'CMDLINE';                                                            
                 CommandLine();  [3]                                                               
           ENDSL;                                                                                   
           CLEAR macro;                                                                             
        ENDDO;

Fig. 21                   

Function Table

SoftCode applications are serviced by table driven applications. The function keys defined are are associated with a function. A service procedure returns the function assigned to the function key to the requestor.

     A****************************************************************
     A* PHYSICAL FILE- SCFUNCPF                                      *
     A*                                                              *
     A* FUNCTION     - This file provides a set command function     *
     A*                macro instructions to be executed from a      *
     A*                HLL, or the function editor program.          *
     A*                                                              *
     A* PROGRAMMER   - Steve Croy        04/11/06                    *
     A****************************************************************
     A          R RSCFUNC                   TEXT('FUNCTION KEY ACTIONS')
      *
     A            FPGMID        10          TEXT('PROGRAM ID')
     A                                      COLHDG('Program ID')
     A            FPNLID        10          TEXT('PANEL ID')
     A                                      COLHDG('Panel' 'ID')
     A            FKEYID        10          TEXT('FUNCTION KEY ID')
     A                                      COLHDG('Function' 'Key')
     A            FMACRO        45          TEXT('FN KEY ACTION')
     A                                      COLHDG('Macro' 'Action')
     A            FKTEXT        20          TEXT('TEXT DESCRIPTION')
     A                                      COLHDG('Description')
     A            FKAUTL         3          TEXT('AUTHORITY LEVEL')
     A                                      COLHDG('Authority' 'Level')
     A          K FPGMID
     A          K FPNLID
     A          K FKEYID


The macro instruction field of the soft coded program options and function keys is 45 bytes long. This instruction may contain several different types of operations. And in SoftCode, the macro instruction may take several different formats. An ampersand '&' in byte 1 identifies a CL command. The Soft coded function editor will pass this command on to the generic command executive program to be processed.

Macro Instructions

      ********************************************************************
      * File Name    - SCMACRPF                                          *
      *                                                                  *
      * Function     - This file was designed to serve as an external    *
      *                data structure definition for the softcoded       *
      *                function macro field.                             *
      *                                                                  *
      * Programmer   - Steve Croy        04/11/06                        *
      ********************************************************************
     A          R RSCMACR                   TEXT('FUNCTION MACRO DS')
     A            SUBOP          5          COLHDG('OP' 'CODE')
     A            SUBPGM        10          COLHDG('OP' 'CODE')
     A            CALLPM        10          COLHDG('CALL' 'PARMS')
     A            SUBRSV        19          COLHDG('RESERVED')
     A            SUBACT         1          COLHDG('ACTION CODE')
     A*                                     A=ADD
     A*                                     C=CHANGE
     A*                                     D=DELETE
     A*                                     S=SORT, OR SELECT
     A*                                     V=VIEW

A file, SCMACRPF, has been created to be used as an externally defined data structure which can be used in a program to define the macro. Using the externally defined macro provides consistency in naming the various parts of the complex macro format.

Sample Code Features

The sample code (Fig. 21) illustrates a program designed to examine the macro (FUNCT) and perform the appropriate subroutine; such as display more keys (DisplayKeys), or more program options (DisplayOptions), or to exit the program (EXIT).

  • [1] GETFUNCTION is the procedure to look up the function associated with the key pressed.
  • [2] Keys ins the FUNCTIONKEY DS are compared to the key pressed (AID byte).
  • [3] Program actions based on the FUNCTION returned.