9 195 PUT_SYSTEM_VARIABLE

LANSA Technical

9.195 PUT_SYSTEM_VARIABLE

Þ Note: Built-In Function Rules.

Creates / amends a system variable. If the system variable name specified does not already exist the system variable is added, if it does exist the system variable definition is updated with the new details.

Þ This is a Specialized Built-In Function for use in a Development Environment only.

For use with

LANSA for i

YES

Visual LANSA for Windows

YES

Visual LANSA for Linux

NO

 

 

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

System variable name A System variable name must begin with '*'.

5

20

 

 

2

A

Req

Description

1

40

 

 

3

A

Req

STATIC or DYNAMIC

6

7

 

 

4

A

Req

Data type (ALPHA, NUMBER)

5

6

 

 

5

N

Req

Length / Total digits

3

3

0

0

6

N

Req

Decimal positions

1

1

0

0

7

A

Req

Evaluation program

1

10

 

 

8

A

Req

Ev. program type (FUN, 3GL)

3

3

 

 

9

A

Req

Initial public access (ALL, NORMAL or NONE)

3

6

 

 

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Return code (OK, ER)

2

2

 

 

 

 

Example

A small program to allow the creation / amendment of system variables. The user is requested to fill in the system variable details and a message based on the return code notifies if the operation was successful.

GROUP_BY    NAME(#SYSVAR) FIELDS(#SYSNAM #SYSDES #SYSSOD #SYSTYP #SYSLEN #SYSDEC #SYSPGM #PGMTYP #ACCESS)
*********   Set some defaults
CHANGE      #SYSNAM *NULL
CHANGE      #SYSDES 'NULL VALUE'
CHANGE      #SYSSOD 'DYNAMIC'
CHANGE      #SYSTYP 'ALPHA '
CHANGE      #SYSLEN 1
CHANGE      #SYSDEC 0
CHANGE      #SYSPGM 'SVPGM'
CHANGE      #PGMTYP 'FUN'
CHANGE      #ACCESS 'NORMAL'
*********   Request System variable details
REQUEST     FIELDS(#SYSVAR)
*********      
USE         BUILTIN(PUT_SYSTEM_VARIABLE) WITH_ARGS(#SYSNAM #SYSDES #SYSSOD #SYSTYP #SYSLEN #SYSDEC #SYSPGM #PGMTYP #ACCESS) TO_GET(#RETCOD)
**********  Inform user of success / failure
IF          '#RETCOD *EQ OK'
MESSAGE     MSGF(SYSMSGS) MSGID(SYS0023) MSGDTA(#SYSNAM)
ELSE      
MESSAGE     MSGF(SYSMSGS) MSGID(SYS0024) MSGDTA(#SYSNAM)
* < -------   Handle any errors  ------- >
ENDIF