INatAutoSysmain

This document covers the following topics:


Purpose

This interface contains methods related to the utility SYSMAIN. These methods include copying and moving Natural development objects between system files and environments, importing files as Natural development objects into a Natural system file and deleting and renaming Natural development objects.

Using properties, each instance of this interface can be configured independently of other instances. The properties define on which environments and system files the subsequently called methods will work. The properties control also certain options that influence the behavior of the subsequently called methods.

Properties

The following properties are available:

Parent

Used to navigate to the parent interface of this interface.

Natural Data Format Variant Type Remark
HANDLE OF OBJECT VT_DISPATCH (INatAutoSystem) Get only

Studio

Used to navigate to the root interface.

Natural Data Format Variant Type Remark
HANDLE OF OBJECT VT_DISPATCH (INatAutoStudio) Get only

SourceEnvironment

Specifies the source environment for the subsequent operations. Default is the local environment. If the property is changed to a different environment, the properties SourceDBnr and SourceFnr are automatically changed to the database number and file number of the user system file of that environment.

Natural Data Format Variant Type Remark
HANDLE OF OBJECT VT_DISPATCH (INatAutoEnvironment) Put only

SourceDBnr

Specifies the database number of the source system file for the subsequent operations. Default is the database number of the user system file of the local environment.

Natural Data Format Variant Type Remark
I4 VT_I4  

SourceFnr

Specifies the file number of the source system file for the subsequent operations. Default is the file number of the user system file of the local environment.

Natural Data Format Variant Type Remark
I4 VT_I4  

TargetEnvironment

Specifies the target environment of the subsequent operations. Default is the local environment. If the property is changed to a different environment, the properties TargetDBnr and TargetFnr are automatically changed to the database number and file number of the user system file of that environment.

Natural Data Format Variant Type Remark
HANDLE OF OBJECT VT_DISPATCH (INatAutoEnvironment) Put only

TargetDBnr

Specifies the database number of the target system file for the subsequent operations. Default is the database number of the user system file of the local environment.

Natural Data Format Variant Type Remark
I4 VT_I4  

TargetFnr

Specifies the file number of the target system file for the subsequent operations. Default is the file number of the user system file of the local environment.

Natural Data Format Variant Type Remark
I4 VT_I4  

OptionType

Specifies the Natural development object type on which the subsequent operation applies.

Natural Data Format Variant Type Remark
I4 VT_I4  

The supported types are listed below. The default is 0.

Type Number Type Name
0000 All types
1001 Parameter data area
1002 Copycode
1003 DDM
1004 Global data area
1005 Helproutine
1006 Local data area
1007 Map
1008 Subprogram
1009 Program
1010 Subroutine
1011 Text
1012 View
1013 Dialog
1014 Class
1015 Command processor
1017 Mainframe DDM
1018 Function
1019 Shared resource
1020 Error message file
1021 Adapter

OptionTimestamp

The subsequent operations apply to Natural development objects that have been saved or cataloged after the point in time specified in this option. The default is the lowest possible value of a Natural variable of format T.

Natural Data Format Variant Type Remark
T VT_DATE Put only

OptionUser

The subsequent operations apply to Natural development objects that have been saved or cataloged by the specified user. The default is an empty string.

Natural Data Format Variant Type Remark
A VT_BSTR Put only

OptionImportSM

If this option is set to TRUE, files to be imported as Natural development objects with the method Import are assumed to be in structured mode. If this turns out to be not the case, the import will fail with an error.

If this option is set to FALSE, files to be imported as Natural development objects with the method Import are assumed to be in report mode. If this turns out to be not the case, the import will fail with an error.

The default is the value that is specified for the Natural parameter SM.

Natural Data Format Variant Type Remark
L VT_BOOL Put only

Methods

The following methods are available:

Reset

Resets all properties of this interface instance to their default values.

FindLibraries

Returns a string containing an XML document that describes the Natural libraries contained in the Natural system file specified by the properties SourceEnvironment, SourceDBnr and SourceFnr. The XML document is structured according to the following DTD:

<?xml version="1.0"?>
<!ELEMENT flibs (flib+)>
<!ELEMENT flib (#PCDATA)>
Element Meaning
flib The library name.

Find

Returns a string containing an XML document that describes the Natural development objects contained in the Natural library specified in the parameter Library and by the properties SourceEnvironment, SourceDBnr and SourceFnr. The XML document is structured according to the following DTD:

<?xml version="1.0"?>
<!ELEMENT fitems (fitem+)>
<!ELEMENT fitem (ftype, fkey, fname, fcat, fuid)>
<!ELEMENT ftype (#PCDATA)>
<!ELEMENT fkey (#PCDATA)>
<!ELEMENT fname (#PCDATA)>
<!ELEMENT fcat (#PCDATA)>
<!ELEMENT fuid (#PCDATA)>
Element Meaning
ftype The object type. See the list of types that is available for the property OptionType.
fkey The object name.
fname For Natural classes: the class name. For Natural subroutines: the subroutine name. For Natural functions: the function name.
fcat Indicates if a source, a generated program or both exists for the object. See the values defined for the parameter Category.
fuid The user ID of the user who saved or cataloged the object.

Parameters

Name Natural Data Format Variant Type Remark
Return value A VT_BSTR  
Name A VT_BSTR By value
Library A VT_BSTR By value
Category I2 VT_I2 By value
Return value

A null BSTR (in Natural an empty string). Reserved for future use.

Name

A pattern that qualifies the names of the Natural development objects to be retrieved. The pattern may contain the wildcard characters "?" and "*", where "?" stands for one character and "*" for several characters.

Library

The name of the Natural library from which Natural development objects shall be retrieved.

Category

Specifies whether sources or generated programs shall be retrieved.

Value Meaning
0 Natural objects where either a source or a generated program exists are retrieved.
1 Only Natural objects where a source exists are retrieved.
2 Only Natural objects where a generated program exists are retrieved.
3 Only Natural objects where both a source and a generated program exist are retrieved.

Copy

Copies Natural development objects from the library specified by the properties SourceEnvironment, SourceDBnr and SourceFnr and the parameter SourceLibrary to the library specified by the properties TargetEnvironment, TargetDBnr and TargetFnr and the parameter TargetLibrary.

Parameters

Name Natural Data Format Variant Type Remark
Return value A VT_BSTR  
Name A VT_BSTR By value
SourceLibrary A VT_BSTR By value
TargetLibrary A VT_BSTR By value
Category I2 VT_I2 By value
Return value

A null BSTR (in Natural an empty string). Reserved for future use.

Name

A pattern that qualifies the names of the Natural development objects to be copied. The pattern may contain the wildcard characters "?" and "*", where "?" stands for one character and "*" for several characters.

SourceLibrary

The name of the Natural library from which Natural development objects shall be copied.

TargetLibrary

The name of the Natural library to which Natural development objects shall be copied.

Category

Specifies whether sources, generated programs or both shall be copied. For possible values, see the Find method.

Move

Moves Natural development objects from the library specified by the properties SourceEnvironment, SourceDBnr and SourceFnr and the parameter SourceLibrary to the library specified by the properties TargetEnvironment, TargetDBnr and TargetFnr and the parameter TargetLibrary.

Parameters

Name Natural Data Format Variant Type Remark
Return value A VT_BSTR  
Name A VT_BSTR By value
SourceLibrary A VT_BSTR By value
TargetLibrary A VT_BSTR By value
Category I2 VT_I2 By value
Return value

A null BSTR (in Natural an empty string). Reserved for future use.

Name

A pattern that qualifies the names of the Natural development objects to be moved. The pattern may contain the wildcard characters "?" and "*", where "?" stands for one character and "*" for several characters.

SourceLibrary

The name of the Natural library from which Natural development objects shall be moved.

TargetLibrary

The name of the Natural library to which Natural development objects shall be moved.

Category

Specifies whether sources, generated programs or both shall be moved. For possible values, see the Find method.

Delete

Deletes Natural development objects from the library specified by the properties SourceEnvironment, SourceDBnr and SourceFnr and the parameter Library.

Parameters

Name Natural Data Format Variant Type Remark
Return value A VT_BSTR  
Name A VT_BSTR By value
Library A VT_BSTR By value
Category I2 VT_I2 By value
Return value

A null BSTR (in Natural an empty string). Reserved for future use.

Name

A pattern that qualifies the names of the Natural development objects to be deleted. The pattern may contain the wildcard characters "?" and "*", where "?" stands for one character and "*" for several characters.

Library

The name of the Natural library from which Natural development objects shall be deleted.

Category

Specifies whether sources, generated programs or both shall be deleted. For possible values, see the Find method.

Rename

Renames the Natural development object specified by the properties SourceEnvironment, SourceDBnr and SourceFnr and the parameters Name and Library to the name specified by the parameter NewName.

Parameters

Name Natural Data Format Variant Type Remark
Return value A VT_BSTR  
Name A VT_BSTR By value
NewName A VT_BSTR By value
Library A VT_BSTR By value
Category I2 VT_I2 By value
Return value

A null BSTR (in Natural an empty string). Reserved for future use.

Name

The name of the Natural development object to be renamed.

NewName

The new name for the Natural development object.

Library

The name of the Natural library that contains the Natural development object to be renamed.

Category

Specifies whether the source, the generated program or both shall be renamed. For possible values, see the Find method.

Import

Imports the files specified by the parameters File and Path as Natural development objects into the library specified by the properties TargetEnvironment, TargetDBnr and TargetFnr and the parameter Library.

Parameters

Name Natural Data Format Variant Type Remark
Return value A VT_BSTR  
File A VT_BSTR By value
Path A VT_BSTR By value
Library A VT_BSTR By value
Return value

A null BSTR (in Natural an empty string). Reserved for future use.

File

A pattern that qualifies the names of the files to be imported. The pattern may contain the wildcard characters "?" and "*", where "?" stands for one character and "*" for several characters.

Path

The path that contains the files to be imported.

Library

The name of the Natural library into which the files shall be imported.