Using the SQL Edit session
To start an SQL Edit session, use the SQL primary command. The Edit session contains the SQL statement that FM/Db2 is using to retrieve data from Db2®.
You can use the SQL Edit session to change the row selection criteria (WHERE clause), before retrieving data from Db2.
If you use the SQL primary command from within an editor session, FM/Db2 displays a panel such as that shown in Figure 1.
Figure 1. SQL Edit session: SQL command issued from within an editor session
Process Options Utilities Help
────────────────────────────────────────────────────────────────────────────────
EDIT SYS02203.T120510.RA000.FMNUSER.R0113662 Columns 00001 00072
****** ***************************** Top of Data ******************************
=NOTE= All changes made during this Edit session will be discarded at the end
=NOTE= of the Edit session.
=NOTE= Use the CREATE or REPLACE commands to take a copy of the SQL.
000001 SELECT "EMPNO", "FIRSTNME", "MIDINIT", "LASTNAME", "WORKDEPT",
000002 "PHONENO", "HIREDATE", "JOB", "EDLEVEL", "SEX", "BIRTHDATE",
000003 "SALARY", "BONUS", "COMM"
000004 FROM "DSN8810"."EMP"
000005 WHERE "WORKDEPT" = 'A00' AND "LASTNAME" BETWEEN 'A' AND 'M'
000006 WITH UR
000007 FOR FETCH ONLY
****** **************************** Bottom of Data ****************************
Command ===> _____________________________________________________ Scroll PAGE
F1=Help F2=Split F3=Exit F5=Rfind F6=Rchange F7=Up
F8=Down F9=Swap F10=Left F11=Right F12=Cancel
If you are editing a template (before displaying data)
and you use the SQL primary command (or press the
SQL function key (F4)),
FM/Db2 displays a panel such as that
shown in Figure 2.
Figure 2. SQL Edit session: SQL command issued when editing a template
File Edit Edit_Settings Menu Utilities Compilers Test Help
────────────────────────────────────────────────────────────────────────────────
EDIT SYS02248.T145911.RA000.FMNUSER.R0103542 Columns 00001 00072
****** ***************************** Top of Data ******************************
=NOTE= Only changes to the WHERE clause will be recognized at the end of the
=NOTE= Edit session. All other changes will be ignored.
=NOTE= Use the CREATE or REPLACE commands to take a copy of the SQL.
=NOTE=
=NOTE= Columns for "DSN8810"."EMP"
=NOTE= Cl# Column name Data type(length) Null
=NOTE= 1 EMPNO CHARACTER(6)
=NOTE= 2 FIRSTNME VARCHAR(12)
=NOTE= 3 MIDINIT CHARACTER(1)
=NOTE= 4 LASTNAME VARCHAR(15)
=NOTE= 5 WORKDEPT CHARACTER(3) Y
=NOTE= 6 PHONENO CHARACTER(4) Y
=NOTE= 7 HIREDATE DATE Y
=NOTE= 8 JOB CHARACTER(8) Y
=NOTE= 9 EDLEVEL SMALLINT Y
=NOTE= 10 SEX CHARACTER(1) Y
=NOTE= 11 BIRTHDATE DATE Y
Command ===> ________________________________________________ Scroll ===> PAGE
F1=Help F2=Split F3=Exit F5=Rfind F6=Rchange F7=Up
F8=Down F9=Swap F10=Left F11=Right F12=Cancel
You can use the ISPF editor commands CREATE and REPLACE to take a copy of the SQL statement into another, permanent, data set.
Column details for the Db2 object might be shown as note lines (=NOTE=) at the top of the ISPF edit session. These are only displayed if the WHERE clause can be changed.
Related references