SQL Programming Manual for Pascal
NonStop SQL Version Issues
HP NonStop SQL Programming Manual for Pascal—528614-001
D-14
Using the Single-Code Thread Design
Advantages of this technique are:
°
Dynamic SQL is not necessary.
°
Program logic is simpler than in the single-code thread design.
•
Maintain a single-code thread by using IF/THEN/ELSE statements in the source 
program; the statements test for the appropriate SQL version and choose between 
two code branches at run time. This technique contrasts with the two-code thread 
technique by performing version checking at run time instead of at compile time; 
the use of the single-code thread technique precludes the use of the two-code 
thread technique.
Typically, the single-code thread technique uses dynamic SQL and can require 
extensive code to handle versions. The resulting single object file, however, needs 
only a single build and release cycle to install the program on nodes of different 
versions.
•
If you have a choice, use static SQL rather than dynamic SQL. Static SQL has 
better performance than dynamic SQL because the SQL statements do not require 
compilation at run time. Many generic release programs, however, require dynamic 
SQL for other reasons.
•
Include the SQLGETSYSTEMVERSION procedure in program code to test for 
system version. Then determine which code to execute depending on the version.
Using the Single-Code Thread Design
If your program is to run on both NonStop SQL C10 and C30 systems and uses 
Version 2 features, the program probably uses dynamic SQL and not just static SQL. 
The following guidelines apply to developing these generic release programs:
•
Pascal compile and bind the program on a C30 system and include the SQL 
RELEASE1 directive in the source program. The RELEASE1 option is required 
because the RELEASE1 format (C10) object code generated by the Pascal 
compiler is upward compatible with the C30 SQL compiler, but RELEASE2 format 
object code is not compatible with the C10 SQL compiler. The SQL RELEASE1 
option instructs the Pascal compiler to generate RELEASE1 format SQLDAs and 
produces output that is acceptable to a C10 SQL compiler as well as to a C30 SQL 
compiler.
•
Do not use any Version 2 features in static SQL statements because these 
statements will be processed by both the C10 and C30 SQL compilers as 
described in the last item of the list.
•
Do not reference any Version 2 objects in static SQL statements, because these 
objects will cause C10 SQL compilation errors.
•
Use Version 2 features and reference Version 2 objects only in dynamic SQL 
statements because only the host variables that contain the SQL statements to be 
executed are processed by the Pascal compiler. In dynamic SQL, SQL statements 










