Contents Developing Windows Clients  

LanguageService Object

A service for submitting SAS language and obtaining output from the SAS list and log.

LanguageService Full Description

Attributes

Parent Property
Async Property
SuspendOnError Property
LineSeparator Property
StoredProcessService Property

Methods

Submit Method
SubmitLines Method
FlushLog Method
FlushLogLines Method
FlushList Method
FlushListLines Method
ResetLogLineNumbers Method
Continue Method
Reset Method
Cancel Method

Event Methods

ProcStart Event
SubmitComplete Event
ProcComplete Event
DatastepStart Event
DatastepComplete Event
StepError Event

Enumerations

LineType Enumeration
CarriageControl Enumeration

Description

This object provides acccess to the services of the SAS System 4GL programming language. Those services include the ability to submit SAS language source code originating with the client, execute SAS language source code stored in a server repostitory, and receive SAS language execution feedback and results information.



Readonly Property Parent

Parent Workspace property

Type: Workspace

Description

This property allows you to navigate back to the Workspace of this LanguageService object.

Example

Dim ls as SAS.LanguageService
Dim ws as SAS.Workspace
set ws = ls.Parent

Usage


Property Async

Asynchronous execution property

Type: Boolean

Description

This property controls the blocking or non-blocking mode associated with the Submit, Execute, and ExecuteWithResults methods. If false, the client is blocked in the method call until the associated program source frame has completed execution. If true, control returns as soon as the program source frame is queued for execution; your client program receives notification for completion of the submitted frame of program source via the SubmitComplete event.

Default: False.

Example

Dim ls as SAS.LanguageService
ls.Async = True

Usage


Property SuspendOnError

SuspendOnError control property

Type: Boolean

Description

This property controls the behavior of the LanguageService when a step error is encountered. Use of this features requires that the LanguageService be in asynchronous mode (see Async).

When this property is set to false, the asyncrhonous (background) processing of submitted SAS lanaguage statememts continues after an error is encountered. When it is set to true, processing is suspended.

Notification of the step error can be received via the StepError event. Once suspended, processing will not proceed until the Continue method is executed.

Default: False

Example

Dim ls as SAS.LanguageService
ls.SuspendOnError = True

Usage


Property LineSeparator

The line separator character or characters used by the flush methods when returning multiple lines in a single string.

Type: String

Description

The line separator character or characters that are used by the flush methods when returning multiple list or log lines in a single output string. Clients typically want either a single linefeed (LF) or a carriage return (CR) followed by a linefeed (LF).

Default: A single linefeed character (also called LF or newline).

Example

Usage


Readonly Property StoredProcessService

StoredProcessService property

Type: StoredProcessService

Description

This property provides access to the StoredProcessService object for executing stored processes. A stored process is a SAS language program stored on a server. See documentation of that object for details.

Example

Dim ls as SAS.LanguageService
Dim sp as SAS.StoredProcessService
set sp = ls.StoredProcessService

Usage


Method Submit

Submit method

Description

Submit SAS language statements provided by the client. Lines in the source buffer may be separated by carriage return and/or newline characters (that is C-language '\r' and '\n' respectively).

Usage

Parameters

Name Direction Type Description
stmts  in  String  Source statement buffer. The maximum source statement line length is 2048 characters.  

Example

Dim ls as SAS.LanguageService
Dim sourceBuffer as String
sourceBuffer = "data; x=1; proc print; run;"
ls.Submit sourceBuffer

See Also


Method SubmitLines

Submit lines of SAS language statements.

Description

This method submits an array containing lines of SAS language. The input array contains an element for each line of the program to be executed.

Usage

Parameters

Name Direction Type Description
stmts  in  String(index)  Source statement lines array. The maximum source statement line length is 2048 characters.  

Example

Dim ls as SAS.LanguageService
Dim sourceLines() as String
' SourcePad is a TextBox object
sourceLines = Split(SourcePad.Text, vbCrLf, -1, vbTextCompare)
ls.SubmitLines sourceLines

See Also


Method FlushLog

Flush log lines that were spooled by program execution.

Description

This method retrieves log lines that were spooled by program execution. A buffer of characters not exceeding the "numCharsRequested" parameter is returned. The LineSeparator string or other carriage control (such as formfeed) is inserted between lines. These lines are flushed from the server's spool. Subsequent calls will return subsequent lines.

Usage

Parameters

Name Direction Type Description
numCharsRequested  in  Long  Specifies an upper limit on number of characters to be returned. This number should not be excessively large because a buffer of this size is allocated in the server.  

Returns String

FlushLog return buffer. When the length of this buffer is zero, all current log output has been flushed.

Example

Dim ls as SAS.LanguageService
Dim logBuffer as String
logBuffer = ls.FlushLog(100000)

See Also


Method FlushLogLines

Flush log lines that were spooled by program execution.

Description

This method retrieves log lines that were spooled by program execution. An array of lines not exceeding the "numLinesRequested" parameter is returned. This output array contains the log lines that were retrieved. These lines are flushed from the server's spool. Subsequent calls will return subsequent lines.

Usage

Parameters

Name Direction Type Description
numLinesRequested  in  Long  Specifies an upper limit on number of lines to be returned.  
carriageControls  out  CarriageControl(index)  An array that indicates carriage control for each line returned.  
lineTypes  out  LineType(index)  An array that indicates the line type for each line returned.  
logLines  out  String(index)  Contains the SAS log output lines retrieved by this call. When this returned array is shorter than requested size, all current log output has been flushed.  

Example

Dim ls as SAS.LanguageService
Dim cc() as SAS.LanguageServiceCarriageControl
Dim lt() as SAS.LanguageServiceLineType
Dim logLines() as String
ls.FlushLogLines 32, cc, lt, logLines

See Also


Method FlushList

Flush list lines that were spooled by program execution.

Description

This method retrieves list lines that were spooled by program execution. A buffer of characters not exceeding the "numCharsRequested" parameter is returned. The LineSeparator string or other carriage control (such as formfeed) is inserted between lines. These lines are flushed from the server's spool. Subsequent calls will return subsequent lines.

Usage

Parameters

Name Direction Type Description
numCharsRequested  in  Long  Specifies an upper limit on number of characters to be returned. This number should not be excessively large because a buffer of this size is allocated in the server.  

Returns String

FlushList return buffer. When the length of this buffer is zero, all current list output has been flushed.

Example

Dim ls as SAS.LanguageService
Dim listBuffer as String
listBuffer = ls.FlushList(100000)

See Also


Method FlushListLines

Flush list lines that were spooled by program execution.

Description

This method retrieves list lines that were spooled by program execution. An array of lines not exceeding the "numLinesRequested" parameter is returned. This output array contains the list lines that were retrieved. These lines are flushed from the server's spool. Subsequent calls will return subsequent lines.

Usage

Parameters

Name Direction Type Description
numLinesRequested  in  Long  Specifies an upper limit on number of lines to be returned.  
carriageControls  out  CarriageControl(index)  An array that indicates carriage control for each line returned.  
lineTypes  out  LineType(index)  An array that indicates line type for each line returned.  
listLines  out  String(index)  Contains the SAS list output lines retrieved by this call. When this returned array is shorter than requested size, all current list output has been flushed.  

Example

Dim ls as SAS.LanguageService
Dim cc() as SAS.LanguageServiceCarriageControl
Dim lt() as SAS.LanguageServiceLineType
Dim listLines() as String
ls.FlushListLines 32, cc, lt, listLines

See Also


Method ResetLogLineNumbers

Set the next log line number back to 1.

Description

This method resets log line numbering back to 1.

Usage

Parameters: None

Example

Dim ls as SAS.LanguageService
ls.ResetLogLineNumbers

See Also


Method Continue

Restarts execution of a suspended LanguageService object.

Description

The Continue method operates in tandem with the SuspendOnError property. The method is used to continue asynchronous (background) execution of the LanguageService's current execution frame when it is suspended by an error condition. This situation can occur if the SuspendOnError property is true.

If SuspendOnError is false, then calling this method has no effect, since the LanguageService has not been suspended.

Usage

Parameters: None

Example

Dim ls as SAS.LanguageService
ls.Continue

See Also


Method Reset

Resets the LanguageService to an initial state.

Description

This method resets the LanguageService to an initial state with respect to token scanning. Use it to extricate the LanguageService from an error state associated with the execution of invalid syntax or incomplete program source.

Usage

Parameters: None

Example

Dim ls as SAS.LanguageService
ls.Reset

See Also


Method Cancel

Interrupts the current program execution frame.

Description

This method cancels the current program execution frame. A program execution frame is the SAS language source that is submitted in one method call. The cancellation might be delayed until execution reaches a subsequent step boundary. The LanguageService state is also reset (see Reset).

Usage

Parameters: None

Example

Dim ls as SAS.LanguageService
ls.Cancel

See Also


Event ProcStart

Signifies that a procedure has started.

Description

The procedure identified by the "procname" parameter has begun execution.

Usage

Parameters

Name Direction Type Description
procname  in  String  The name of the procedure that has begun execution.  

Example

Option Explicit
Private WithEvents ls as SAS.LanguageService
Private Sub ls_ProcStart(ByVal Procname As String)
   Debug.Print "ProcStart" + Procname
End Sub

See Also


Event SubmitComplete

SAS language program execution completion event

Description

The current program execution frame has completed.

Usage

Parameters

Name Direction Type Description
sasrc  in  Long  SAS return code when the submitted code completes.  

Example

Option Explicit
Private WithEvents ls as SAS.LanguageService
Private Sub ls_SubmitComplete(ByVal Sasrc As Long)
   Debug.Print "SubmitComplete" + Format(Sasrc)
End Sub

See Also


Event ProcComplete

SAS language procedure completion event

Description

The procedure identified by the "procname" parameter has completed execution.

Usage

Parameters

Name Direction Type Description
procname  in  String  The name of the procedure that has completed execution.  

Example

Option Explicit
Private WithEvents ls as SAS.LanguageService
Private Sub ls_ProcComplete(ByVal Procname As String)
   Debug.Print "ProcComplete" + Procname
End Sub

See Also


Event DatastepStart

SAS language DATA step start event

Description

A DATA step has begun execution.

Usage

Parameters: None

Example

Option Explicit
Private WithEvents ls as SAS.LanguageService
Private Sub ls_DatastepStart()
   Debug.Print "DatastepStart"
End Sub

See Also


Event DatastepComplete

SAS language DATA step complete event

Description

A DATA step has completed execution.

Usage

Parameters: None

Example

Option Explicit
Private WithEvents ls as SAS.LanguageService
Private Sub ls_DatastepComplete()
   Debug.Print "DatastepComplete"
End Sub

See Also


Event StepError

SAS language step error event

Description

An error occurred for a step in the current program execution frame.

Usage

Parameters: None

Example

Option Explicit
Private WithEvents ls as SAS.LanguageService
Private Sub ls_StepError()
   Debug.Print "StepError"
End Sub

See Also


Enum LineType

Indicates the line type for each line.

Description

For FlushLogLines and FlushListLines, an output array contains values that indicate the line type for each line that is returned.

Usage

Member Description
LineTypeNormal  The line is a normal or data line.  
LineTypeHilighted  The line is a header or hilighted line.  
LineTypeSource  The line is a source code line.  
LineTypeTitle  The line is a title line.  
LineTypeByline  The line is a byline.  
LineTypeFootnote  The line is a footnote line.  
LineTypeError  The line is an error message line.  
LineTypeWarning  The line is a warning message line.  
LineTypeNote  The line is a note line.  
LineTypeMessage  The line is an informatory message line.  


Enum CarriageControl

Indicates carriage control for each line.

Description

For FlushLogLines and FlushListLines, an output array contains values that indicate the carriage control for the corresponding line.

The carriage control indicator that is returned for a line reflects the carriage control preceding that line. For example, the line which is indicated as having a formfeed is the first line of a new page (not the final line of the previous page). Also, OverPrint indicates that the corresponding line overprints the previous line.

Usage

Member Description
CarriageControlNormal  This line follows the preceding line in the normal way.  
CarriageControlNewPage  This line is at the beginning of a new page.  
CarriageControlOverPrint  This line overprints the preceding line.  
CarriageControlSkipLine  One additional empty line should be added before this line.  
CarriageControlSkipTwoLines  Two additional empty lines should be added before this line.  

Contents Developing Windows Clients