Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How the null indicator is defined in DCLGEN

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
manjunathkv

New User


Joined: 23 May 2006
Posts: 9

PostPosted: Tue Sep 16, 2008 11:48 am    Post subject: How the null indicator is defined in DCLGEN
Reply with quote

Can any one please tell me how the null indicator is defined in the DCLGEN
Back to top
View user's profile Send private message

Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Tue Sep 16, 2008 12:31 pm    Post subject:
Reply with quote

Code:
 EXEC SQL DECLARE DEMO.ITEMS TABLE
  ( ORD_NO    INTEGER   NOT NULL
  ,ITEM_NO    SMALLINT  NOT NULL
  ,PROD_ID    CHAR(4)
  ,QTY_ORDERED   SMALLINT  NOT NULL WITH DEFAULT   
  ,QTY_SHIPPED   SMALLINT  NOT NULL WITH DEFAULT   
  ,AMT_EACH    DECIMAL(7, 2) NOT NULL WITH DEFAULT   
  ,DATE_ENTERED   TIMESTAMP  NOT NULL WITH DEFAULT
  ,DATE_SHIPPED   DATE
  ,ITEM_NOTES   VARCHAR(560)
  ) END-EXEC.


The COBOL DECLARATION part of copybook file would look something like this:

************************************************************
* COBOL DECLARATION FOR TABLE DEMO.ITEMS     
************************************************************
 01 DCLITEMS.
  10 ITEMS-ORD-NO           PIC S9(09) COMP.
  10 ITEMS-ITEM-NO          PIC S9(04) COMP.
  10 ITEMS-PROD-ID          PIC X(4).
  10 ITEMS-QTY-ORDERED      PIC S9(04) COMP.
  10 ITEMS-QTY-SHIPPED      PIC S9(04) COMP.
  10 ITEMS-AMT-EACH         PIC S9(05)v9(02) COMP-3.
  10 ITEMS-DATE-ENTERED     PIC X(26).
  10 ITEMS-DATE-SHIPPED     PIC X(10).
  10 ITEMS-ITEM-NOTES.
   49 ITEMS-ITEM-NOTES-LEN  PIC S9(04) COMP.
   49 ITEMS-ITEM-NOTES-TEXT PIC X(560).
************************************************************
* COBOL INDICATOR VARIABLES FOR TABLE     
************************************************************
 01 DCLITEMS-NULL.
  10 ITEMS-PROD-ID-NULL      PIC S9(04) COMP.
  10 ITEMS-DATE-SHIPPED-NULL PIC S9(04) COMP.
  10 ITEMS-ITEM-NOTES-NULL   PIC S9(04)COMP.
************************************************************
* THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS 9 
************************************************************

Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Tue Sep 16, 2008 12:32 pm    Post subject:
Reply with quote

A little search can provide you with a lot of informations icon_wink.gif
Back to top
View user's profile Send private message
manjunathkv

New User


Joined: 23 May 2006
Posts: 9

PostPosted: Tue Sep 16, 2008 12:35 pm    Post subject: Reply to: How the null indicator is defined in DCLGEN
Reply with quote

Thanks Bharath
Back to top
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Thu Oct 21, 2010 6:21 pm    Post subject:
Reply with quote

Hello All,
I have a question related to the DCLGEN utility (as provided with DB2).

DCLGEN will not create specifically, NULL indicators for NULL able column of the table. It creates an array of S9(4) comp. something like below
Code:
****************************************************************
 * INDICATOR VARIABLE STRUCTURE                                 
 ****************************************************************
  01  ITGOVSEQUENCENR.                                           
      10 INDSTRUC           PIC S9(4) USAGE COMP OCCURS 8 TIMES.
 ****************************************************************


However in the above post by Bharat, NULL indiacators for each nullable column are specified.

Code:
************************************************************
* COBOL INDICATOR VARIABLES FOR TABLE     
************************************************************
 01 DCLITEMS-NULL.
  10 ITEMS-PROD-ID-NULL      PIC S9(04) COMP.
  10 ITEMS-DATE-SHIPPED-NULL PIC S9(04) COMP.
  10 ITEMS-ITEM-NOTES-NULL   PIC S9(04)COMP.
************************************************************
* THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS 9 
************************************************************
my question is how this can be achieved by DCLGEN, ?
Does some extra utility ( or rexx etc) has to used along with DCLGEN,
or
there is some extra parameter to be used in DCLGEN invoke.

regards



I referenced the below DB2 manual
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.comref/db2z_cmd_dsn.htm

supplied below to TSO
Code:
 DSN SYSTEM(DD)                                       
    DCLGEN TABLE (CA.TABNAME) -               
    LIBRARY ('USERID.PDS.DCL(TEST2)')  -         
    LANGUAGE (IBMCOB) -                               
    ACTION (REPLACE) -                                 
    NAMES (XXXX-) -                                 
    COLSUFFIX (YES) -                                 
    LABEL (NO) -                                       
    INDVAR (YES) -                                     
    APOST   
          END                                                 
               
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts Getting list of tables defined under ... kishpra DB2 2 Wed Aug 24, 2016 10:36 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us