Вы находитесь на странице: 1из 3

TCSQLERROR ()

Get the last error produced in SQL sentences

This function gets the messages of error in the inverse order, therefore the user can make
multiple calls to this function in order to get all the errors in the case that these are multiple.
Normally is convenient to get them, by this the message queue does not grow indefinitely.

Syntax
TCSQLERROR ( ) cRet

Return
Return a string with the last error produced in the execution of sentence SQL or a null
string in case that is no errors.

Example
nRet = TCSQLEXEC("INSERT INTO SALES/CUSTOMER(NAME) VALUES('JOHN
DOE')")
If nRet == 0
? "Insertion executed"
Else
? "Insertion Error (s) : "
?
cRet = TCSQLERROR()
Do While !Empty(cRet)
? cRet
EndDo
EndIf
TCLINK ()
Connect to a given environment

This TOPConnect function issues the connection to a given environment and sets it as the
default for the next file openings. Since TOPConnect for Clipper allows the connection to up to
five different environments this functions provides a simple connection mechanism.

Syntax
TCLINK(<cEnvironment>,<cServer>[,<cUserName>, <cPassword>])  nConn

Arguments
<cEnvironment> Is a string containing a valid environment name. This can be the name of a Server Library or
Library /Library-List on the AS/400 or DBType/DSN on the WinNT.
<cServer> Is a string of characters containing a valid server name or IP address.
(default: By the last connection, function TCSETSRV or environment variable
DFT_TOPSRV)
<cUserName>: String of characters that contains the user name. Can be
JOBNAME/USER>PORT.
< cPassword >: String of characters that contains the user password.

Returns
This function returns a negative integer containing an Error Code or a positive one if the
connection was successful (the Connection number).

TCMAXMAP( )
Sets the minimum fields a table must have to accept a TCSRVMAP.

Syntax
TCMAXMAP(<nNewMax>)

Arguments
< nNewMax > The number of fields above which the TCSRVMAP is
accepted.

TCPGMEXE( )
Run an AS/400 program from CA-Clipper

It is the TOPConnect for Clipper function that allows running a Host program from a Clipper
application. Given that CA-Clipper does not manage structures it is only possible to transfer a
parameter of type character to the invoked program. But the invoked program can decompose
the
parameter to obtain the values of other data types. In case that the invoked program returns
some value, this must be a character type, and must be returned in the same parameter buffer,
therefore the string must have an adequate size to receive the data.

Syntax
TCPGMEXE( <cProgram> , <cLibrary> , <cParam> )  cRetString
Arguments
<cProgram> A string with the name of the program to be invoked.
<cLibrary> A string of characters with the name of the Library were the program is
located (NIL implies *LIBL).
<cParam> String of characters with the parameters that the program receive,
maximum 8000 characters.
Returns
A string with the return values of the called program, or “”in the case that the call was
unsuccessful.

Example
The next example calls the TOPConnect program TOPDLTPF.

File := "MYFILE "


Libr := "MYLIB "
Phy := "1"
Errr := "CPF0000"

Param := File + Libr + Phy + Err

cRet = TCPGMEXE( "TOPDLTPF", "TOPCONNECT" , Param )

If cRet = ""
? "An Error : " + SubStr( cRet, 22 , 7 ) + “ occurred.”
EndIf

TCQUIT()
Perform a quick disconnection

This function separates the disconnection from the AS/400 from the closing of the files, which
can be performed automatically by the server. This means that the closing of the connection is
practically automatic. Precautions must be taken, however, to perform a COMMIT operation on
all work-areas that have pending operations.

Syntax
TCQUIT( ) NIL

Returns
This function always returns NIL.

Example
REQUEST TOPCONN
USE CUSTOMER VIA “TOPCONN” NEW
USE INVOICE VIA “TOPCONN” NEW
.
.
If Finish
COMMIT
TCQUIT()
QUIT
EndIf
RETURN

Вам также может понравиться