Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vT4JU-00CCxh-0h for pgsql-general@arkaria.postgresql.org; Tue, 09 Dec 2025 20:28:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vT4JS-006k4U-1K for pgsql-general@arkaria.postgresql.org; Tue, 09 Dec 2025 20:27:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vT4JS-006k4K-0F for pgsql-general@lists.postgresql.org; Tue, 09 Dec 2025 20:27:58 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vT4JQ-003zVK-2H for pgsql-general@lists.postgresql.org; Tue, 09 Dec 2025 20:27:57 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-b736d883ac4so1057102266b.2 for ; Tue, 09 Dec 2025 12:27:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765312074; x=1765916874; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=OwwKypdXiq4EhjihYWvOKXOJh0Ul6cS9mWu8lCiJGjk=; b=eKvTitUk1hY+y/u9JR6QhBkk/lep7oRuwPUx88oh4fISIzZA/QiGNt75QtDNfYlH6u CdqbFYIZFTFrevDa+pn7s4xiSVbeOxKYkz5AJ3SOP9pAqEMToQYisb8bo8JSbCilWgzW 73wPoceXAXxCJ7a6iXQFklzmM5+D2Uv5cwcyU9/2/RuqQNRiBeW4eAkphtdkaJtOgbOh 7F35KG2mN72nM9Tcn8rrpMAqTe7pwx6ElMdgc1tOy9SnoY90a1surylRm5M682NBWm52 7o8FQt4GQ7zlJ+DW7oLx7dHsa/voVoyGVbqCByeZ9ppr8ogfKn+uQrhYuxJHguMQX3qw WkIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765312074; x=1765916874; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OwwKypdXiq4EhjihYWvOKXOJh0Ul6cS9mWu8lCiJGjk=; b=qhv4kies3dq6Nq52A/hcmNC35JEnQxjQl0R86XcLOx5O/6J/7Gku0bcYDYmVwAhE3R Fz/18SJswfrEEoElH/IQlJx2cR6dtuaZT7QbbarlaSWWQ9DtDUaRXUfXtY6nHixFb4lD R8O1om9KfZzWQR5vtszl0N1KF3yYOEMXPloMl2eI2Lmfi9/aFzwWIYlxuDK5vA9Ap6Vd z3I78oJaGBTgRL8aSyjAfNjjfviLsKLW5NFYO44vxsCJGclhyc6DtpoVfrZztrZ0rdGd vZRsnVL90lUiX3eSJxZu5fkeW+inar/QXNNS/ERCEzcZNxGQvKZ4zN3y6SENj4srfiVO 8l+Q== X-Gm-Message-State: AOJu0Yy7fjqkhjD4RntQopIlIi1qiMkv0gJ+0rdF18TOuvqdCaNrIZXE 69p/jr+PO8HzRt3zCvcFz/lV81tAY6gDknpsGL0qtBp1hmWMfjefxZW99RuqUHVy8hs1e34BhDv DRzmE20mAf9s/Yz3oXewgnYvPl0nVJQ== X-Gm-Gg: ASbGncsbfgk3uaEuvsDA0nD6jIhMmIEt+E76UT4hT/6hd3qo64K3QDP4HsV8sBXVeS2 9VJUDlpC5l1ty7707rq0EwXOJpJi6VwN2+CXk69eQvmYvjkhV6cm6ikN8jTk3RvpurKUoPX9xL3 /mdsqsmf92pOXvK0pt4WFnpf6rQeUaE+3v6xKXl2P7Ad6ni1bozbTJUPHOJOGMMhnn7fVYbHbj/ E18Zwv2pdP2nwfW7nrsKuVrDQRKYoFgQ3legjmYuAkR6W9F1ZDkVSRGpIGdSFZLcOc= X-Google-Smtp-Source: AGHT+IFUSx8KNAu/5lHZzwHMD24cPG4MXVIJQhV18aKGAlS8HxW4rR8W51qRXtH5ZC4p15nWWz1JThEvdTY+hT1E5A4= X-Received: by 2002:a17:907:98a:b0:b79:e99d:913b with SMTP id a640c23a62f3a-b7a247f96acmr1430488266b.54.1765312073347; Tue, 09 Dec 2025 12:27:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Juan Rodrigo Alejandro Burgos Mella Date: Tue, 9 Dec 2025 15:27:41 -0500 X-Gm-Features: AQt7F2piVGPwZ0g5gn-lJKfoTKwsv_tpbEOlvUj2o2kySrcypkriIuD14cvAmXY Message-ID: Subject: Re: Ecpg fetch issue To: Tzuriel Kahlon Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000000cb5d406458abfee" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000000cb5d406458abfee Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi When using ECPG, if you have a simple FETCH, it will do it row by row; the way to download more than one row at a time is by using data arrays. In my case, when I want to extract, for example, 100 records at once, I use the following model: I define a data array: EXEC SQL BEGIN DECLARE SECTION; struct _resultData { int int_data1; char chr_data2[11]; } resultData[100]; EXEC SQL END DECLARE SECTION; and then in the fetch: EXEC SQL FETCH FORWARD 100 cCursor INTO :resultData; and the variable sqlca.sqlerrd[2] controls the number of records returned I hope it helps you Atte JRBM El mar, 9 dic 2025 a las 14:53, Tzuriel Kahlon () escribi=C3=B3: > Hey all , > We are using IBM for cobol and connextint postgres db with ecpg the > precompiler , problem is when we running cursor against db the prefetch a= re > not set correctly and provide one row each time he approach to db and thi= s > decrease the performance significantly if twvle have 100000 rows it take = it > one by one each run . > In procob which is the precompiler of Oracle there are option to set the > prefetch to take in each time it approach the db x number of rows you wan= t > and this ease the db retrieved and enhance the performance . > I know that there is a way to change the setting in the application code, > but I want to eliminate touch any code and configure only the ecpg which = is > the middle between cobol and db. > There is anyone from you which encountered same issue? > > > > > > *=D7=91=D7=91=D7=A8=D7=9B=D7=94 * > *=D7=A6=D7=95=D7=A8=D7=99=D7=90=D7=9C =D7=9B=D7=97=D7=9C=D7=95=D7=9F * > 0523851143 > --0000000000000cb5d406458abfee Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi
When using ECPG, if you have a simple FE= TCH, it will do it row by row; the way to download more than one row at a t= ime is by using data arrays.
In my case, when I want t= o extract, for example, 100 records at once, I use the following model:

I define a data array:

EXEC = SQL BEGIN DECLARE SECTION;
struct _resultData {
int =C2=A0int_data1;=
char chr_data2[11];
} resultData[100];
EXEC SQL END DECLARE SECT= ION;

and then in the fetch:

EXE= C SQL
FETCH FORWARD 100 cCursor
INTO :resultData;

and the variable sqlca.sqlerrd[2] controls the number of records returned<= /div>

I hope it helps you

Atte<= /div>
JRBM


El mar, 9 dic 2025= a las 14:53, Tzuriel Kahlon (<= tzuriel1986@gmail.com>) escribi=C3=B3:
Hey all ,
We are using IBM for cobol and connextint postgres db with ecpg = the precompiler , problem is when we running cursor against db the prefetch= are not set correctly and provide one row each time he approach to db and = this decrease the performance significantly if twvle have 100000 rows it ta= ke it one by one each run .
In procob which is the p= recompiler of Oracle there are option to set the prefetch to take in each t= ime it approach the db x number of rows you want and this ease the db retri= eved and enhance the performance .
I know that there= is a way to change the setting in the application code, but I want to elim= inate touch any code and configure only the ecpg which is the middle betwee= n cobol and db.
There is anyone from you which encou= ntered same issue?





=D7=91=D7=91=D7=A8= =D7=9B=D7=94=C2=A0
=D7=A6=D7=95=D7=A8=D7=99=D7=90=D7=9C = =D7=9B=D7=97=D7=9C=D7=95=D7=9F=C2=A0
0523851143
--0000000000000cb5d406458abfee--