Appendix A: Parsing Server Startup Parameters

Natural Business Services supplies the BSSPARMN routine, which parses the keywords specified in the Server Start parameters fields on the Maintain Servers panel (for information, see Define Server Start Parameters and Routines). BSSPARMN uses the BSSPARMA and CDPDA-M parameter data areas, which define the interface to the routine.

This section describes these data areas. The following topics are covered:


BSSPARMA Data Area

This data area defines the parameter string, as well as the valid keywords. It returns the individual parameters after they have been parsed. The following input and output parameters are defined in this data area.

Input Parameters

The following table describes the input parameters for BSSPARMA:

Input Parameter Description
PARM (A1/1:500) String that defines the parameter values entered in the User parameters fields. If the value contains special characters, enclose it within quotes.

On the input panel, this string is divided into five blocks of 50 characters. Normally, it contains a series of keyword=value combinations separated by commas (or alternate Natural input delimiter characters).

C#KEYWORD (I2) Variable that tells BSSPARMN how many valid keywords are supplied in the KEYWORD field.
KEYWORD (A32/1:15) Array containing valid keywords. For every valid keyword, specify an entry in this array. Also assign C#KEYWORD to indicate the number of keywords passed.
SHOW-RESULTS (L) If this flag is set, BSSPARMN writes out the individual keyword values to the panel after parsing them. This allows you to supply the name of a test or trace facility.

Output Parameters

The following table describes the output parameters for BSSPARMA:

Output Parameter Description
C#INDIVIDUAL-PARMS (I2) Value indicating the number of individual parameter values identified by BSSPARMN.
KEYWORD-ENTERED (L/1:15) This field is set to true for occurrence n, if the nth keyword specified in the KEYWORD array was followed by an input assign character.

Note:
The assign character is normally an equal sign (=), but it can be overridden by the Natural IA parameter.

VALUE (A200) Field containing the value of a parameter. If the corresponding KEYWORD-ENTERED flag is set, this value corresponds to the KEYWORD value in the same occurrence. If KEYWORD-ENTERED is false, there may still be a value in the corresponding VALUE field, but this value was not preceded by a keyword.

CDPDA-M Parameter Data Area

If BSSPARMN was not able to parse the input parameters, CDPDA-M contains a message number in CDPDA-M.##MSG-NR to indicate the reason. This message number corresponds to a SYSERR message for the SYSBIZ library. Substitution parameters may also be returned in CDPDA-M.##MSG-DATA(1).

Example of Using BSSPARMN

DEFINE DATA
  LOCAL USING BSSPARMA
  LOCAL USING CDPDA-M
  LOCAL
  01 #I(I1)
END-DEFINE
*
* Parameter values in PARM-CHUNK are normally entered as INPUT 
* values
BSSPARMA.PARM-CHUNK(1) :=
 'JOB-NAME=SOMEJOB,NATPARM="FNAT=(1,2),PROFILE=SYSBIZD"'
*
* define 3 valid parameters
BSSPARMA.C#KEYWORD := 3
BSSPARMA.KEYWORD(1) := 'NATPARM'
BSSPARMA.KEYWORD(2) := 'USER'
BSSPARMA.KEYWORD(3) := 'JOB-NAME'
*
* Call BSSPARMN to parse the parameters
CALLNAT 'BSSPARMN' BSSPARMA CDPDA-M
*
* If there were no errors, show the results
IF CDPDA-M.##RETURN-CODE = ' ' THEN
  FOR #I = 1 TO BSSPARMA.C#INDIVIDUAL-PARMS
    DECIDE FOR FIRST CONDITION
      WHEN BSSPARMA.KEYWORD-ENTERED(#I)
        PRINT BSSPARMA.KEYWORD(#I) 'equals'
        BSSPARMA.VALUE(#I)(AL=50)
      WHEN BSSPARMA.VALUE(#I) NE ' '
        PRINT 'Value without keyword' BSSPARMA.VALUE(#I)(AL=50)
      WHEN NONE
        IGNORE
    END-DECIDE
    IF NOT BSSPARMA.KEYWORD-ENTERED(#I) AND #I LE BSSPARMA.C#KEYWORD 
    THEN
      PRINT 'No value entered for parameter' BSSPARMA.KEYWORD(#I)
    END-IF
  END-FOR
ELSE
  WRITE 'Parameter error' CDPDA-M.##MSG-NR CDPDA-M.##MSG-DATA(1)
END-IF
END