Example

This example configures an SQL query and performs the transfer to the screen display. The screen display shows the Last and Payrate fields from the Payroll file. Records are displayed in descending order based on the PAYRATE field.

Sub TransferToScreen()

With Session

.SetSQLStatement rcAS400Select, "LAST, PAYRATE"

.SetSQLStatement rcAS400OrderBy, "PAYRATE DESC"

.Xfr400OutputDest = rcAS400Display

.Xfr400RemoteFile = "mylib/payroll(payroll)"

.PCSReceiveFile "", True

End With

End Sub

This example uses AppendSQLStatement to append text to the Where query. Use this feature if you want to create long query strings.

Sub SQLDemo ()

With Session

'Set the Select option

.SetSQLStatement rcAS400Select, "Name"

 

'Set the Where option using AppendSQLStatment to add to it

.SetSQLStatement rcAS400Where, " Age >= 40 "

.AppendSQLStatement rcAS400Where, " AND Weight < 200 "

 

'Display the complete Where option

MsgBox .GetSQLStatement(rcAS400Where)

End With

End Sub