Method Syntax


 

The syntax used for all methods is as follows:

 

[label]

{obj}.{method}

[GIVING {res}] [USING [*{key}=]{parm}[:

 

 

[*{key}=]{parm}..]]

Note the following:

  1. [label} is an optional Program Execution Label.

  2. {obj} is an object variable that has supported methods.

  3. {method} is an identifier for the operation that is performed for the {object} variable. The syntax for {method} can be one of the following:

  4. {res} is a DIM, FORM, INTEGER, or an object (AUTOMATION, COLOR, FONT, IMAGELIST, or VARIANT) that receives the result of the method. The specific type allowed depends on the {method} requirements. If the {res} has a specific type of a DIM ( Character String Variable ), a FORM variable is allowed where the Character String data is moved to the FORM variable the same as described for a 'MOVE Character String to Numeric Field' (10.7). The {res} value is always optional.

  5. For enhanced performance when using the Sunbelt PL/B Application server, only specify a return value {res} if actually needed.

  6. {parm} is a DIM, FORM, INTEGER, immediate numeric value, expression, literal, or an object (AUTOMATION, COLOR, FONT, IMAGELIST, or VARIANT) specifying a parameter value. The specific type(s) allowed depend on the {method} requirements. If the {parm} has a specific type of a DIM (Character String Variable), a FORM variable is allowed such that the FORM string data is used and processed by the method. (10.7)

  7. {KEY} is a keyword name that can be used with the specified {method} parameters. The use of {KEY} is optional. It is possible that some {methods} may not have named keywords that means the parameters must be in the proper parameter position. If a {method} has any parameters without a {KEY} name, those parameters must be specified in the parameter list before parameters with keywords. {KEY} can be one of the following:

  8. The optional GIVING preposition must occur before any USING prepositions.

  9. If the USING list exceeds a single line, a colon (:) is used in place of a comma (,) to continue the list onto the next line.

  10. The method syntax allows a line continuation character (:) before and after the GIVING and USING prepositions.

Examples:

MYLIST

LISTVIEW

 

$10$

FORM

"10"

RESULT

INTEGER

4

USERNUM

INTEGER

4,"12345"

INDEXVAR

INIT

"INDEX"

.

 

 

 

CREATE

MYLIST...

 

MYLIST.SetItemParam GIVING RESULT USING 10,12345 // OK

 

MYLIST.SetItemParam USING *INDEX=10,*PARAM=USERNUM // OK

 

MYLIST.SetItemParam USING *PARAM=USERNUM,*INDEX=$10$ // OK

 

MYLIST.SetItemParam USING @INDEXVAR=10,*PARAM=12345 // OK

Line Continuation Examples:

 

MYLIST.SetItemParam

GIVING RESULT USING 10:

 

 

12345

 

MYLIST.SetItemParam

USING *INDEX=10:

 

 

*PARAM=USERNUM

 

MYLIST.SetItemParam

USING *PARAM=USERNUM:

 

 

,*INDEX=$10$

 

 

 

ABC

AUTOMATION

 

.

 

 

 

ABC.TEST

GIVING S$CMDLIN USING S$CMDLIN

 

ABC.TEST

GIVING:

 

 

S$CMDLIN USING S$CMDLIN

 

ABC.TEST

GIVING S$CMDLIN:

 

 

USING STCMDLIN

 

ABC.TEST

GIVING S$CMDLIN USING:

 

 

S$CMDLIN

 

ABC.TEST

GIVING:

 

 

   S$CMDLIN:

 

 

USING:

 

 

   S$CMDLIN:

 

 

   S$CMDLIN

 

 

See Also: Objects

 



PL/B Language Reference