Page 1 of 1

COPYBOOK use in SQL FETCH statement

PostPosted: Mon Jun 05, 2017 5:43 pm
by kuldeep kularia
I have one doubt for using of copybook local variables in EXEC FETCH command .
like
DECLARE SECTION
05 D-CTR-ACCT-NUM OCCURS 500 TIMES PIC X 16
05 D-CTR-ACCT-BRANCH OCCURS 500 TIMES PIC X 5

------------
PROCEDURE
EXEC SQL FOR D-ROW-NUM
FETCH CURSOR_NAME
INTO D-CTR-ACCT-NUM,
D-CTR-ACCT-BRANCH,
D-CTR-DECI-OFFICER,

in above example of PCO program can we use copybook variable like
COPY UT9920CA IN LIBRYXXX. As I have tables copybook which I have to use for fetch into command variables .

Re: COPYBOOK use in SQL FETCH statement

PostPosted: Mon Jun 05, 2017 8:51 pm
by Robert Sample
Have you read the Enterprise COBOL Programming Guide at (version 6.1) http://publibfp.boulder.ibm.com/epubs/pdf/igy6pg10.pdf for your version of COBOL? If not, you need to -- start with Chapter 21 entitled Programming for a DB2 environment which discusses some of the differences in the way COPY statements are handled with the stand-alone DB2 preprocessor and the integrated DB2 coprocessor. The answer to your questions will depend upon which way you are compiling your code.

Re: COPYBOOK use in SQL FETCH statement

PostPosted: Tue Jun 06, 2017 11:29 am
by kuldeep kularia
Dear Robert ,


Thanks for the reference with below statement from your linked document prove that my requirement is not achievable . Thanks a lot.

The library search order for SQL INCLUDE statements is the same SYSLIB
concatenation as the compiler uses to resolve COBOL COPY statements that do not
specify a library-name