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 1vT4em-00CKnC-1g for pgsql-general@arkaria.postgresql.org; Tue, 09 Dec 2025 20:50: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 1vT4ek-006shr-0F for pgsql-general@arkaria.postgresql.org; Tue, 09 Dec 2025 20:49: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 1vT4ej-006shj-1r for pgsql-general@lists.postgresql.org; Tue, 09 Dec 2025 20:49:58 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vT4eh-003zeN-2A for pgsql-general@lists.postgresql.org; Tue, 09 Dec 2025 20:49:56 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-b7370698a8eso837191466b.0 for ; Tue, 09 Dec 2025 12:49:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765313394; x=1765918194; 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=RpvdZDIsKY0epw+x9iS4vRMqaskmAQ3a52rou2ekeE4=; b=MEUQ5+ngR3h0v3kk5TGtNoKhMit3spokBStk8wKTyQNo8gKk+hIWYXpyHE/eiuWEHf 04b/01Rfpx3iVl8A7G0NvOrIfmaXZPkYDUXRmqGo/krRta28fgfb96Nj8NY4/Z55+U65 +t2mwXPTy9HB4jaaMmxh2scgs+ZRQhcjyS+STsL4moXmb5PZctmD3+6WmfNbdt9o83j3 Vk5OsuVRZETmZk0D3vQu3DCu8D/SK2EcQQujzoBFXN9gCZH/u8BKeS5a7zyp/oJIErOM E7ZvJRoo4MXg1kNWPlwZznVHQd6Ha7e4lGhcUEHVzbwl0r2HvnkjgGmm99tJphiUwOYU GKow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765313394; x=1765918194; 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=RpvdZDIsKY0epw+x9iS4vRMqaskmAQ3a52rou2ekeE4=; b=ZJ6IRpCpsQ3C3GUl51jeXczcAIhtrVIU0EKT5Iy5hqXXuCg6kgiPL2Yg/lVJgxdIaD xdm6zW6tajn6NVKfq1917iFIhmCCX+hvysnMDZ1JkVh5y0v953HZPkGqs6QHgGzLHeNa PZX0MoaIQ/oyDBz4P11U52s3Toxy+xSn3i3Z5LoDrBN3ZLzpJfIfj/vIwe2z17yzA13B Yvd3PrCwUeFBmTplPBsDF0qFQ609aa6H+7uqdPgwENh3JaN4pR7PAB+3UIw9HfQ9tV0L 1aFCppDW8fHicfBvHHWJs+R/Xwzo+SFgxwULTRaDY1bi7D+srJn1Y3CTdxwbWnKGmA0f Z4JQ== X-Gm-Message-State: AOJu0YzIuoExNLTGsqmjgYU74UUUINVuL3yXKjtrV6qsITSoeRcJgqpp n7zFVMdu21dgG19m+Hpk2Ne8xQwwyc5o0JC1kww1rXJOHD/2He9yAeJNFfYs9CiUKbRwA+GTF7o YanpfOSFn69KL8F6E7eWeUeT3n/FlERyy2Xc= X-Gm-Gg: ASbGncvTPRvss0CmTUBdJLwiEsls9HvGfNMXwCRuvn3Xy33luvC3O1Sk4mmGPLzJpdB NFiKQcEiSl1jJ0BIVGIhEmblo8c1ETkv+SVT2w49xJAPECQzX9fjYqGv6WJBKcrD4wv23ncQIhR sUQPC/+JB/ovcGjFPz2xDoxTVlg/JE5oNWMl3mr9JXuMw0Kxm68qIF3C3GbWBZA2wfCTMsT4tHC oV294PZ9yIffhpoUuAZYW80h1YJHszyZTywpotwP2TvG8bdMWRLbofgHld6dt0IScQ= X-Google-Smtp-Source: AGHT+IFu2Rn6M0sf2fTM42bEg1DX8+6MJkeaHDSx35UKml4qY0wFPLnfKDRshPzjwiVuDoz0W69h64ITkK9RsUVT2jU= X-Received: by 2002:a17:907:3d86:b0:b7a:368:8776 with SMTP id a640c23a62f3a-b7a2430472cmr1272314566b.25.1765313393989; Tue, 09 Dec 2025 12:49:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Juan Rodrigo Alejandro Burgos Mella Date: Tue, 9 Dec 2025 15:49:43 -0500 X-Gm-Features: AQt7F2rty9TO4R22M50TjLMgsaLjW2kx-Rz7LyXCxQJ6mdJz0SqUBfyKoFOV4Z8 Message-ID: Subject: Re: Ecpg fetch issue To: Tzuriel Kahlon Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000c41bc606458b0d9a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c41bc606458b0d9a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable The issue is that there's no direct ECPG for COBOL; ECPG is a C preprocessor and can only be used as an external function. Alternatively, you can use libpq as a wrapper, but you'll still need to compile the C code= . Atte JRBM El mar, 9 dic 2025 a las 15:30, Tzuriel Kahlon () escribi=C3=B3: > Hey thank you for the answer , the solution you suggest is modified the > code in the application side i want to open the ecpg like procob in oracl= e > and set it there without any intervention. On the code itself . > > > > > *=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 > > On Tue, Dec 9, 2025, 22:27 Juan Rodrigo Alejandro Burgos Mella < > rodrigoburgosmella@gmail.com> wrote: > >> 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 returne= d >> >> 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= are >>> not set correctly and provide one row each time he approach to db and t= his >>> decrease the performance significantly if twvle have 100000 rows it tak= e it >>> one by one each run . >>> In procob which is the precompiler of Oracle there are option to set th= e >>> prefetch to take in each time it approach the db x number of rows you w= ant >>> 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 ecp= g >>> 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 >>> >> --000000000000c41bc606458b0d9a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The issue is that there's no direct ECPG for COBO= L; ECPG is a C preprocessor and can only be used as an external function. A= lternatively, you can use libpq as a wrapper, but you'll still need to = compile the C code.

Atte
JRBM

El mar, 9 dic 2025 a las 15:30, Tzuriel Kahlon (<tzuriel1986@gmail.com>) escribi= =C3=B3:
Hey thank you for the answer , the solution you suggest is m= odified the code in the application side i want to open the ecpg like proco= b in oracle and set it there without any intervention. On the code itself .=




=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
<= div>0523851143

On Tue, Dec 9, 2025, 22:27 Juan Rodrigo Ale= jandro Burgos Mella <rodrigoburgosmella@gmail.com> wrote:
Hi
When using ECPG, if you have a simple FETCH, it will do it row by row; t= he 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 reco= rds at once, I use the following model:

I define a= data array:

EXEC SQL BEGIN DECLARE SECTION;
st= ruct _resultData {
int =C2=A0int_data1;
char chr_data2[11];
} re= sultData[100];
EXEC SQL END DECLARE SECTION;

and then = in the fetch:

EXEC SQL
FETCH FORWARD 100 cCur= sor
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 (<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 corr= ectly and provide one row each time he approach to db and this decrease the= performance significantly if twvle have 100000 rows it take it one by one = each run .
In procob which is the precompiler of Ora= cle there are option to set the prefetch to take in each time it approach t= he db x number of rows you want and this ease the db retrieved and enhance = the performance .
I know that there is a way to chan= ge the setting in the application code, but I want to eliminate touch any c= ode 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=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
--000000000000c41bc606458b0d9a--