Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Input and output in S variables (SDF-P)

S variables are always replaced automatically at input by the SDF dialog interface (see the manual “SDF Dialog Interface” [3 (Related publications)]), which LMS uses for all inputs.

LMS supports the output of selected data in S variables, which always produces lists of structures (see the manual “SDF-P” [12 (Related publications)]). In the supported statements, output in the
S variable can be switched locally using the operand STRUCTURE-OUTPUT=, apart from (independent of) the output stream.

Information can be output in S variables with the following statements:

COMPARE-ELEMENT
FIND-ELEMENT
SHOW-ELEMENT-ATTRIBUTES
SHOW-LIBRARY-ATTRIBUTES
SHOW-STATISTICS
SHOW-TYPE-ATTRIBUTES

The variable must be declared as follows:

/DECL-VAR  varname(TYPE=*STRUC),MULT-ELEM=*LIST

"varname" is a freely selectable name. The variable can also be output via the SYSINF stream. In this case, the command /ASSIGN-STREAM STREAM=SYSINF,
TO=*VAR(varname) must be executed before the statement that is to create the variable.

The command /ASSIGN-STREAM STREAM=SYSINF,TO=*DUMMY stops the creation of variables. LMS checks the SYSINF assignment internally if STRUCTURE-OUTPUT= *SYSINF applies, and, for reasons of performance, it only produces output in the SYSINF stream if the SYSINF assignment (direct or via SYSVAR) is not equal to *DUMMY.

Support for MIP variables

Selected LMS messages can be stored in MIP variables (MIP = Message Improvement Program). MIP variables are S variables in which the MIP product stores messages. The MIP variables can be evaluated in S procedures in order to control further operation. The following messages are provided for MIP variables:

LMS0302  ELEMENT (&00) NOT FOUND
         (&00): element designation in format
                *LIB-ELEM(library,element(version),type)
LMS0303  ELEMENT (&00) NOT IN RANGE OF REFERENCE CONDITION
         (&00): element designation (format, see LMS0302)
LMS0310  LMS VERSION '(&00)' STARTED
         (&00): LMS version in format dd.dldd   d=digit, l=letter
LMS0311  LMS VERSION '(&00)' TERMINATED NORMALLY
         (&00): LMS  version (format, see LMS0310)
LMS0312  LMS VERSION '(&00)' TERMINATED ABNORMALLY
         (&00): LMS  version (format, see LMS0310)

These messages appear in the message file with the attribute WARRANTY=*YES. The warranty applies to the message code and the inserts only, and not to the message text.

To be able to use MIP variables in LMS, the user must do the following:

  1. Declare the MIP variable as follows:

    /DECL-VAR varname(TYPE=*STRUC),MULT-ELEM=*LIST

    "varname" is a freely selectable name. The above declaration defines a list of structures. Each member in the list can hold one message and has the following format (e.g. the i-th list member):

    varname#i.MSG-TEXTcomplete message text
    varname#i.MSG-IDmessage code
    varname#i.I0insert  0
    :
    varname#i.In  insert  n

    The number of inserts depends on the message.

  2. Enter the command

    /ASSIGN-STREAM STREAM=SYSMSG,TO=*VAR(VAR-NAME=varname)

    to save the messages to the MIP variable, and the command

    /ASSIGN-STREAM STREAM=SYSMSG,TO=*DUMMY

    to stop this save process. All commands and statements executed in the meantime (not only those from LMS) save their guaranteed messages to the MIP variable.

Examples:

  • You want to check whether the LIB library is empty. In this case, LMS issues message LMS0302. The variable is to be called LMSMIP.

    /DECL-VAR LMSMIP(TYPE=*STRUC),MULT-ELEM=*LIST
    /START-LMS
    //HOLD-PROGRAM
    /ASSIGN-STREAM SYSMSG,TO=*VAR(LMSMIP)
    /RESUME-PROGRAM
    //SHOW-ELEM-ATTR *LIB(LIB),TEXT-OUTPUT=*NONE
    //HOLD-PROGRAM
    /ASSIGN-STREAM SYSMSG,TO=*DUMMY
    /IF  (IS-DECLARED('LMSMIP#1.MSG-ID'))
    /    IF  (LMSMIP#1.MSG-ID='LMS0302')
    /    WRITE-TEXT 'Library empty'
    /    END-IF
    /END-IF
    /RESUME-PROGRAM
    :
    :
    
  • Non-guaranteed LMS messages can be intercepted using the SDF-P built-in function STMT-SPINOFF [13].

    /ASSIGN-SYSDTA TO=*SYSCMD
    /BEGIN-BLOCK DATA-INSERTION=YES
    /START-LMS
    //OPEN-LIB XXX
    /A=STMT-SPINOFF()
    //STEP
    /IF (A EQ 'YES')
    //  WRITE-COM 'OPEN ERROR'
    /ELSE
    //  SHOW-ELEM-ATTR
    /END-IF
    //END
    /END-BLOCK