Published on System iNetwork (http://systeminetwork.com)
Executing SQL Statements from CL Programs
By tzura
Created Aug 8 2002 - 04:00

Q: Is it possible to execute SQL statements from within a CL program? If so, how do I do it?

A: Yes, you can run SQL statements from a CL program. To do so, you place your SQL statements in a source file member and then use command RunSQLStm (Run SQL Statements) to execute the statements in the member.

For example, suppose you wish to set field ProcFlag to value Y in all records found in file YourLib/YourFile. The following SQL statement accomplishes this:

Update YourLib/YourFile
  Set ProcFlag = 'Y'

Simply create a source member with the above SQL statement and then in your CL program issue the following command:

  RunSQLStm  SrcFile( YourLib/YourSrcF ) SrcMbr( YourMbr )
Copyright © Penton Media

Source URL: http://systeminetwork.com/node/60713