Page 1 of 1

why include can't be used in procedure division?

Posted: Thu Mar 09, 2006 8:02 pm
by arrbee
Hi,

Why the include can't be used in procedure division of a DB2-COBOL program?

Can a copybook having DCLGEN of a table be given with COPY command in a DB2-COBOL program?

Thanks.

Posted: Mon Mar 13, 2006 4:06 pm
by Guest
Hi arrbee,

Why the include can't be used in procedure division of a DB2-COBOL program?

You can use INCLUDE in procedure division of a DB2-COBOL program.
But the expansion of INCLUDE should not contain any DECLARATION STATEMENTS or TABLE DECLARATION GENARATIONS...

INCLUDE expands in Pre Compilation stage where as COPY expands in Compilation stage.

So normally we don't use INCLUDE statements in PROCDEURE DIVISION.

****

Can a copybook having DCLGEN of a table be given with COPY command in a DB2-COBOL program?

You cannot use DCLGEN of a table with COPY statement if u are using DCLGEN fields in SQL commands in the program, why because COPY expands in Compilation stage and not in Pre Compilation stage.

You will get undefined variable error for COBOL correspondent table fields that are used in SQL commnads in the program

Thanks
Kalicharan.

Posted: Mon Mar 13, 2006 4:18 pm
by Kalicharan
Hi arrbee,

Why the include can't be used in procedure division of a DB2-COBOL program?

You can use INCLUDE in procedure division of a DB2-COBOL program.
But the expansion of INCLUDE should not contain any DECLARATION STATEMENTS or TABLE DECLARATION GENARATIONS...

INCLUDE expands in Pre Compilation stage where as COPY expands in Compilation stage.

So normally we don't use INCLUDE statements in PROCDEURE DIVISION.

****

Can a copybook having DCLGEN of a table be given with COPY command in a DB2-COBOL program?

You cannot use DCLGEN of a table with COPY statement if u are using DCLGEN fields in SQL commands in the program, why because COPY expands in Compilation stage and not in Pre Compilation stage.

You will get undefined variable error for COBOL correspondent table fields that are used in SQL commnads in the program

Thanks
Kalicharan.

Posted: Tue Mar 14, 2006 5:33 pm
by Guest
Thanks Kalicharan.

- RB.

Topic deleted by Admin

Posted: Wed Feb 03, 2016 11:08 pm
by academyindia4
<< Content deleted By Admin >>