Created On:  01 July 2010
Problem:
The documentation for function 8 of the CBL_GET_PROGRAM_INFO routine is unclear. It does not specify what the RETURN-BUF parameter is supposed to look like.  If it is not set correctly then the call will result in a status-code of 1009 being returned which is an invalid parameter error.
Resolution:
When calling function 8 of CBL_GET_PROGRAM_INFO the RETURN-BUF parameter must be defined as follows:
01 RETURN-BUF.
05 gpiai-size pic x(4) comp-5 value zeroes.
05 gpiai-argc pic x(4) comp-5 value zeroes.
05 gpiai-reserved1 pointer value null.
05 gpiai-reserved2 pointer value null.
where:
gpiai-size must be set to either 16 for 32-bit system or 24 on 64-bit systems.
gpiai-argc will contain the number of parameters passed upon return.
id division.
program-id. testproginfo.
working-storage section.
                                                              
01 FNCTION PIC X(04) COMP-5 VALUE 0.
01 PARAM-BLOCK.
10 CBLTE-GPI-SIZE PIC X(04) COMP-5 VALUE 20.
10 CBLTE-GPI-FLAGS PIC X(04) COMP-5 VALUE 1.
10 CBLTE-GPI-HANDLE POINTER VALUE NULL.
10 CBLTE-GPI-PROG-ID POINTER VALUE NULL.
10 CBLTE-GPI-ATTRS PIC X(04) COMP-5 VALUE 0.
01 RETURN-BUF.
10 CBLTE-GPIAI-SIZE PIC X(04) COMP-5 VALUE 0.
10 CBLTE-GPIAI-ARGC PIC X(04) COMP-5 VALUE 0.
10 CBLTE-GPIAI-RESERVED1 POINTER VALUE NULL.
10 CBLTE-GPIAI-RESERVED2 POINTER VALUE NULL.
01 RETURN-BUF-LEN PIC X(04) COMP-5 VALUE 0.
01 STATUS-CODE PIC X(02) COMP-5 VALUE 0.
linkage section.
01 FIELD-1 PIC X.
procedure division using field-1.
move 0 to fnction
move 1 to cblte-gpi-flags
move length of param-block to cblte-gpi-size
move length of return-buf to return-buf-len
call "CBL_GET_PROGRAM_INFO" using by value fnction
by reference param-block
by reference return-buf
by reference return-buf-len
returning status-code.
move 8 to fnction
move 0 to CBLTE-GPI-FLAGS
move length of return-buf to gpiai-size
call "CBL_GET_PROGRAM_INFO" using by value fnction
by reference param-block
by reference return-buf
by reference return-buf-len
returning status-code.
goback.
                                                              
01 RETURN-BUF.
05 gpiai-size pic x(4) comp-5 value zeroes.
05 gpiai-argc pic x(4) comp-5 value zeroes.
05 gpiai-reserved1 pointer value null.
05 gpiai-reserved2 pointer value null.
where:
gpiai-size must be set to either 16 for 32-bit system or 24 on 64-bit systems.
gpiai-argc will contain the number of parameters passed upon return.
id division.
program-id. testproginfo.
working-storage section.
01 FNCTION PIC X(04) COMP-5 VALUE 0.
01 PARAM-BLOCK.
10 CBLTE-GPI-SIZE PIC X(04) COMP-5 VALUE 20.
10 CBLTE-GPI-FLAGS PIC X(04) COMP-5 VALUE 1.
10 CBLTE-GPI-HANDLE POINTER VALUE NULL.
10 CBLTE-GPI-PROG-ID POINTER VALUE NULL.
10 CBLTE-GPI-ATTRS PIC X(04) COMP-5 VALUE 0.
01 RETURN-BUF.
10 CBLTE-GPIAI-SIZE PIC X(04) COMP-5 VALUE 0.
10 CBLTE-GPIAI-ARGC PIC X(04) COMP-5 VALUE 0.
10 CBLTE-GPIAI-RESERVED1 POINTER VALUE NULL.
10 CBLTE-GPIAI-RESERVED2 POINTER VALUE NULL.
01 RETURN-BUF-LEN PIC X(04) COMP-5 VALUE 0.
01 STATUS-CODE PIC X(02) COMP-5 VALUE 0.
linkage section.
01 FIELD-1 PIC X.
procedure division using field-1.
move 0 to fnction
move 1 to cblte-gpi-flags
move length of param-block to cblte-gpi-size
move length of return-buf to return-buf-len
call "CBL_GET_PROGRAM_INFO" using by value fnction
by reference param-block
by reference return-buf
by reference return-buf-len
returning status-code.
move 8 to fnction
move 0 to CBLTE-GPI-FLAGS
move length of return-buf to gpiai-size
call "CBL_GET_PROGRAM_INFO" using by value fnction
by reference param-block
by reference return-buf
by reference return-buf-len
returning status-code.
goback.
Incident #2462093
Old KB# 31350
#EnterpriseServer
#Enterprise
#netexpress
#Server
#COBOL
#StudioEnterpriseEdition

