Posts

Showing posts from May, 2014

DB2 SQL PL - Features For ZO/S Mainframe

Image
We can compile DB2 PL/SQL either in: DB2 command line processor (CLP) DB2 CLPPlus IBM® Data Studio client The procedure which are written purely in SQL PL are called native SQL procedures. The procedures which are written in other than SQL/PL are called external stored procedures Cobol,PL/I,REXX,Java,C,C++,Assembler. The calling procedure interacts with WLM SAMPLE PROCEDURE DB2 ZO/S: OUT P_SUMSAL DECIMAL(11,2),OUT P_SQLCODE INTEGER)PACKAGE OWNER XYZ  QUALIFIER ABCDRESULT SETS 0  LANGUAGE SQL CREATE PROCEDURE SPA81(OUT P_CNT1 SMALLINT, VERSION V1 ISOLATION LEVEL CS  VALIDATE BIND P1: BEGIN DECLARE SQLCODE INEGER DEFAULT 0; SELECT COUNT(*), SUM(SALARY) INTO P_CNT1,P_SUMSAL FROM EMP; SET P_SQLCODE = SQLCODE END P1

DB2 SQL PL Statement

Image
The following are the key statements we use in SQL PL of DB2: Variable related statements DECLARE <variable> DECLARE <condition> SET statement (assignment statement) Conditional statements IF CASE expression Looping statements FOR WHILE Transfer of control statements GOTO ITERATE LEAVE RETURN Error management statements SIGNAL GET DIAGNOSTICS Detailed discussion I will give in the next sessions. Keep reading.