Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to create a table using embedded sql?



How to create a table using embedded sql?..

Answer / harsh

JCL USED TO SUBMIT THE JOB:

//ITQCT1J1 JOB
SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//STEP01 EXEC PGM=IKJEFT01
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM (DSN)
RUN PROG (ITQCT1C1)
END
//

COBOL PROGRAM:

IDENTIFICATION DIVISION.
PROGRAM-ID. ITQCT1C1.
AUTHOR. SIMOTIME ENTERPRISES.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.


************************************************************
*****
DATA DIVISION.
FILE SECTION.

WORKING-STORAGE SECTION.

************************************************************
*****
* Data-structure for Title and Copyright...
* -------------------------------------------------
-----------
01 SIM-TITLE.
05 T1 pic X(11) value '* ITQCT1C1 '.
05 T2 pic X(34) value 'Create a Table and an
Index '.
05 T3 pic X(10) value ' v04.12.01'.
05 T4 pic X(24) value '
http://www.simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* ITQCT1C1 '.
05 C2 pic X(20) value 'Copyright 1987-2006 '.
05 C3 pic X(28) value ' SimoTime Enterprises,
LLC '.
05 C4 pic X(20) value ' All Rights Reserved'.

01 SIM-THANKS-01.
05 C1 pic X(11) value '* ITQCT1C1 '.
05 C2 pic X(32) value 'Thank you for using this
sample '.
05 C3 pic X(32) value 'by SimoTime Enterprises,
LLC '.
05 C4 pic X(04) value ' '.

01 SIM-THANKS-02.
05 C1 pic X(11) value '* ITQCT1C1 '.
05 C2 pic X(32) value 'Please send comments or
suggesti'.
05 C3 pic X(32) value 'ons to
helpdesk@simotime.com '.
05 C4 pic X(04) value ' '.


************************************************************
*****
* Buffer used for posting messages to the console.
* -------------------------------------------------
-----------
01 MESSAGE-BUFFER.
05 MESSAGE-HEADER pic X(11) value '*
ITQCT1C1 '.
05 MESSAGE-TEXT pic X(68).

EXEC SQL
INCLUDE SQLCA
END-EXEC.


************************************************************
*****
PROCEDURE DIVISION.

perform Z-POST-COPYRIGHT

perform ITEMRDB1-CREATE-TABLE

perform ITEMRDB1-CREATE-INDEX

perform Z-THANK-YOU.

GOBACK.


************************************************************
*****
ITEMRDB1-CREATE-TABLE.
EXEC SQL
CREATE TABLE ITEMRDB1
(
ITQ1_NUMBER CHAR (12) NOT
NULL

PRIMARY KEY,
ITQ1_DESCRIPTION CHAR (48) NOT
NULL,
ITQ1_QTY_ONHAND INTEGER NOT
NULL
WITH
DEFAULT,
ITQ1_QTY_ALLOCATED INTEGER NOT
NULL
WITH
DEFAULT,
ITQ1_UNIT_MEASURE CHAR (16) NOT
NULL
WITH
DEFAULT,
ITQ1_COST DECIMAL (9, 2) NOT
NULL
WITH
DEFAULT,
ITQ1_PRICE DECIMAL (9, 2) NOT
NULL
WITH
DEFAULT,
ITQ1_LADATE CHAR (8) NOT
NULL
WITH
DEFAULT,
ITQ1_LATIME CHAR (8) NOT
NULL
WITH
DEFAULT,
ITQ1_TOKEN CHAR (8) NOT
NULL
WITH
DEFAULT,
ITQ1_D_CODE_1 CHAR (1) NOT
NULL
WITH
DEFAULT,
ITQ1_D_PERCENT_1 CHAR (7) NOT
NULL
WITH
DEFAULT
)
END-EXEC

if SQLCODE = 0
display 'Finished CREATE of ITEMRDB1 '
else
display 'ABENDING CREATE of ITEMRDB1 '
'SQLCODE = ' SQLCODE
add 16 to ZERO giving RETURN-CODE
end-if
exit.


************************************************************
*****
ITEMRDB1-CREATE-INDEX.
EXEC SQL
CREATE UNIQUE INDEX IDX1RDB1
ON ITEMRDB1(ITQ1_NUMBER ASC)
END-EXEC

if SQLCODE = 0
display 'Finished CREATE INDEX for ITEMRDB1 '
else
display 'ABENDING CREATE INDEX for ITEMRDB1 '
'SQLCODE = ' SQLCODE
add 16 to ZERO giving RETURN-CODE
end-if
exit.


************************************************************
*****
* The following Z-Routines perform administrative
tasks *
* for this
program. *

************************************************************
*****
Z-POST-COPYRIGHT.
display SIM-TITLE upon console
display SIM-COPYRIGHT upon console
exit.


************************************************************
*****
Z-POST-MESSAGE.
display MESSAGE-BUFFER upon console
move SPACES to MESSAGE-TEXT
exit.


************************************************************
*****
Z-THANK-YOU.
display SIM-THANKS-01 upon console
display SIM-THANKS-02 upon console
exit.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB2 Interview Questions

How to execute stored procedure in db2 command editor?

0 Answers  


What is runstats db2?

0 Answers  


What is the difference between Where and Having Clause

7 Answers   IBM, iFlex,


can we view the access paths created by dbrm ? how ? thx

2 Answers   IBM,


What is RUNSTATS?

3 Answers  


What error I will get if my select query gives multiple row while executing a Cobol-DB2 program.How can I solve it without using a cursor.

4 Answers   Cap Gemini, Verizon,


How could one combine a set of incremental image copies into a single copy?

1 Answers  


what's the equivalent Cobol Data type for Decimal(x,y) in DB2? what does the current SQLID register contain?

3 Answers   Cap Gemini, Tech Mahindra,


Explain about rct in db2?

0 Answers  


How do we specify index to include or not during bind process.

0 Answers   Satyam,


In an sql table that is embedded, what is the procedure to retrieve rows that are part of a db2 table?

0 Answers  


Outputs of explain are with matchcols = 0. What does this signify?

0 Answers  


Categories