When the DCLGEN variable are used?

All sort of Mainframes Interview Questions.
Previous topicNext topic

Topic Author
Meera Longe
New Member
Posts: 5
Joined: Tue Jan 19, 2016 10:32 am

When the DCLGEN variable are used?

Post by Meera Longe » Tue Sep 06, 2016 3:24 pm

Hi,

Another interview question is this with whcih I need help.

When we write a COBOL DB2 program, we use DCLGNE in the program. When we include the DCLGEN in the program then are the variable taken into consideration at the time of pre-compilation or compilation?

I do not know answer. But I think it shouldbe at compilation time but do we have some place explaining it or someone can help me with an answer please.




Chandan Yadav
Website Team
Website Team
Posts: 69
Joined: Wed Jul 31, 2013 10:19 pm
Zodiac: Libra

Re: When the DCLGEN variable are used?

Post by Chandan Yadav » Wed Sep 07, 2016 5:03 pm

All the copy books mentioned with INCLUDE taken into consideration during per-compilation and all the copy books mentioned with COPY are taken into consideration during compilation




Imran Lamba
Registered Member
Posts: 13
Joined: Tue Jan 19, 2016 11:49 am

Re: When the DCLGEN variable are used?

Post by Imran Lamba » Thu Sep 08, 2016 12:52 am

Chandan Yadav wrote: All the copy books mentioned with INCLUDE taken into consideration during per-compilation and all the copy books mentioned with COPY are taken into consideration during compilation
But DCLGEN has Cobol variables, if INCLUDE is used on precompile time...what is the use of DCLGEN in precompile ?




nicc
Global Moderator
Global Moderator
Posts: 580
Joined: Wed Apr 23, 2014 8:45 pm

Re: When the DCLGEN variable are used?

Post by nicc » Thu Sep 08, 2016 2:09 am

Have you ever looked at the output from the precompiler? If not then I suggest that you do and then, perhaps, it will become clear to you.


Regards
Nic


Imran Lamba
Registered Member
Posts: 13
Joined: Tue Jan 19, 2016 11:49 am

Re: When the DCLGEN variable are used?

Post by Imran Lamba » Thu Sep 08, 2016 12:33 pm

I have seen the output of precompiler. But waht I wanted to say is, we use DCLGEN for COBOL equivialent variables of a Table. But precompiler will not check the COBOL declaration, so does precompile check for table-definition in DCLGEN?




Topic Author
Meera Longe
New Member
Posts: 5
Joined: Tue Jan 19, 2016 10:32 am

Re: When the DCLGEN variable are used?

Post by Meera Longe » Thu Sep 08, 2016 2:03 pm

i also looked at DCLGEN.

Code: Select all

***** DCLGEN TABLE(DSN8A10.VPHONE)                                 ***
  *****        LIBRARY(SYSADM.TEMP.COBOL(VPHONEC))                   ***
  *****        QUOTE                                                 ***
  ***** ... IS THE DCLGEN COMMAND THAT MADE THE FOLLOWING STATEMENTS ***
           EXEC SQL DECLARE DSN8A10.VPHONE TABLE
           ( LASTNAME                       VARCHAR(15) NOT NULL,
             FIRSTNAME                      VARCHAR(12) NOT NULL,
             MIDDLEINITIAL                  CHAR(1) NOT NULL,
             PHONENUMBER                    VARCHAR(4) NOT NULL,
             EMPLOYEENUMBER                 CHAR(6) NOT NULL,
             DEPTNUMBER                     CHAR(3) NOT NULL,
             DEPTNAME                       VARCHAR(36) NOT NULL
           ) END-EXEC.
  ***** COBOL DECLARATION FOR TABLE DSN8A10.VPHONE                ******
       01  DCLVPHONE.
           10 LASTNAME.
              49 LASTNAME-LEN      PIC S9(4) USAGE COMP.
              49 LASTNAME-TEXT     PIC X(15).
           10 FIRSTNAME.
              49 FIRSTNAME-LEN     PIC S9(4) USAGE COMP.
              49 FIRSTNAME-TEXT    PIC X(12).
           10 MIDDLEINITIAL        PIC X(1).
           10 PHONENUMBER.
              49 PHONENUMBER-LEN   PIC S9(4) USAGE COMP.
              49 PHONENUMBER-TEXT  PIC X(4).
           10 EMPLOYEENUMBER       PIC X(6).
           10 DEPTNUMBER           PIC X(3).
           10 DEPTNAME.
              49 DEPTNAME-LEN      PIC S9(4) USAGE COMP.
              49 DEPTNAME-TEXT     PIC X(36).
  ***** THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS 7  ******
So basically precompiler will check all this from above definition:

Code: Select all

EXEC SQL DECLARE DSN8A10.VPHONE TABLE
           ( LASTNAME                       VARCHAR(15) NOT NULL,
             FIRSTNAME                      VARCHAR(12) NOT NULL,
             MIDDLEINITIAL                  CHAR(1) NOT NULL,
             PHONENUMBER                    VARCHAR(4) NOT NULL,
             EMPLOYEENUMBER                 CHAR(6) NOT NULL,
             DEPTNUMBER                     CHAR(3) NOT NULL,
             DEPTNAME                       VARCHAR(36) NOT NULL
           ) END-EXEC.

Is that correct?



Previous topicNext topic

Return to “Interview Questions.”