Mike

The problem occurs on a client system running V5R4 and it is intermittent.
The message does not specify the record in error just that it encountered a
problem. I have come across this in the past, basically I am writing 528
byte records to the save file, after 32K the OS goes out and does a CRC
check against the data just written, if it is incorrect then it signals the
CPF5175 error but does not let the _Rwrite function know about it through
the fdbk structure (the writes have already been made!) It does however
cause the program to end abnormally and it was leaving the file open, but I
have managed to fix that. All I want to do is be able to capture the
message and react to it, so I am hoping a #pragma exception Handler will be
the best option? The TCP/IP issues keep piling up on the V5R4 boxes yet it
all works fine on my V6R1 boxes and others?? I am hoping this has nothing
to do with the rebuilding of the programs when copied to V5R4 as I am
building them on a V6R1 system back level'd to V5R4???

Chris...

Chris Hird
Director
Shield Advanced Solutions Ltd
http://www.shield.on.ca
1(519) 940-1192
____________________________________________________________________________
_______
Please consider the environment before printing this email.

This message, including any attached documents, is intended for the
addressees only. It may contain information that is confidential, privileged
and/or exempt from disclosure. No rights to privilege or confidentiality
have been waived. Any unauthorized use or disclosure is prohibited. If you
have received this message in error, please reply to the sender by e-mail
and delete or destroy all copies of this message.
______________________________________________________
Avant d'imprimer ce courriel, pensez à l'environnement.

Ce message, incluant tous les documents joints, est à l'intention des
destinataires visés seulement. Il peut contenir des renseignements
confidentiels, protégés et/ou ne pouvant pas être divulgués. Aucune
renonciation n'est faite quant à sa nature confidentielle et privilégiée.
Par conséquent, toute diffusion ou utilisation non autorisée est strictement
interdite. Si vous avez reçu ce message par erreur, veuillez en aviser
immédiatement l'expéditeur par retour de courriel et en détruire toutes les
copies existantes.


-----Original Message-----
From: c400-l-bounces+chrish=shieldadvanced.ca@xxxxxxxxxxxx
[mailto:c400-l-bounces+chrish=shieldadvanced.ca@xxxxxxxxxxxx] On Behalf Of
Mike Amos
Sent: Monday, November 01, 2010 9:04 AM
To: c400-l@xxxxxxxxxxxx
Subject: Re: [C400-L] CPF5175 from _Rwrite to Save File

Chris,

1. Would you please post the complete text of the posted CPF5175.
Specifically, we need to see the condition code.

2. Do you know if the failure occurs at the same record each time? Can you
do a binary write of the failing record on a successful and failing run for
comparison?

Mike


On 11/01/2010 08:40 AM, Chris Hird wrote:
Hi



I have a problem where I am writing to a save file after receiving the
records from a remote system. Every so often I am getting a failure
where the save file is written. A message CPF5175 is sent after a
write to the file, but the fdbk area is still showing the record was
correctly added. I think this is to do with the caching of the writes
until 32K has been written? It appears IBM checks the CRC of the last
32K as it adds it to the file, when this CRC is incorrect it will fail
with the CPF 5175 error.



Here is a bit of the code to show what is happening, I have even added
a check every 60 records to make sure the write has been performed
correctly!



for(i = 0,j = 0; i< Request.Records; i++,j++) {

rc = recv(accept_sd, Savf_Buf,528,0);

if(rc< 0) {

sprintf(msg_dta," recv() failed %s",strerror(errno));

snd_msg("GEN0001",msg_dta,strlen(msg_dta));

close(accept_sd);

return -1;

}

if(rc == 528) {

fdbk = _Rwrite(fp,Savf_Buf,528);<<< this is where the CPF5175
message says it originates.

if(fdbk->num_bytes != 528) {

sprintf(msg_dta,"Error on write %s",strerror(errno));

close(accept_sd);

return -1;

}

}

else {

offset = 0;

total_bytes += rc;

do {

offset += rc;

rc = recv(accept_sd,&Savf_Buf[offset],528 - offset,0);

if(rc< 0) {

sprintf(msg_dta," recv() failed %s",strerror(errno));

snd_msg("GEN0001",msg_dta,strlen(msg_dta));

close(accept_sd);

return -1;

}

total_bytes += rc;

}while(total_bytes< 528);

fdbk = _Rwrite(fp,Savf_Buf,528);

if(fdbk->num_bytes != 528) {

sprintf(msg_dta,"Error on write %s",strerror(errno));

close(accept_sd);

return -1;

}

}

if(j == 60) {

rc = send(accept_sd,"OK",2,0);

j = 0;

}

}

_Rclose(fp);



This is the code that sends the request.



for(i = 0, j = 0; i< details->Records; i++,j++) {

fdbk = _Rreadn(fp,Cpy_Buf,528,__DFT);

if(fdbk->num_bytes == 528) {

len = send(sockfd, Cpy_Buf,528, 0);

total_bytes += len;

if(len != 528) {

sprintf(msg_dta," send() Cpy_Buf failed %s bytes sent
%l",

strerror(errno),total_bytes);

snd_msg("GEN0001",msg_dta,strlen(msg_dta));

close(sockfd);

Add_to_Failed(RepDta,msg_dta);

QUSDLTUS(Sav_Spc_Name,

&Error_Code);

if(Error_Code.EC.Bytes_Available> 0) {

snd_error_msg(Error_Code);

}

return -1;

}

}

else {

sprintf(msg_dta,"Failed to read record - bytes read %d",

fdbk->num_bytes);

snd_msg("GEN0001",msg_dta,strlen(msg_dta));

_Rclose(fp);

close(sockfd);

Add_to_Failed(RepDta,msg_dta);

QUSDLTUS(Sav_Spc_Name,

&Error_Code);

if(Error_Code.EC.Bytes_Available> 0) {

snd_error_msg(Error_Code);

}

return -1;

}

/* check at 32k limit for processing */

if(j == 60) {

len = recv(sockfd, recv_buf, 2, 0);

if(memcmp(recv_buf,"OK",2) == 0) {

j = 0;

}

else {

/* error in record count! */

sprintf(msg_dta," recv() count check failed");

snd_msg("GEN0001",msg_dta,strlen(msg_dta));

close(sockfd);

Add_to_Failed(RepDta,msg_dta);

QUSDLTUS(Sav_Spc_Name,

&Error_Code);

if(Error_Code.EC.Bytes_Available> 0) {

snd_error_msg(Error_Code);

}

return -1;

}

}



The error is always shown as coming from the line marked, but the
program is continuing because fdbk->num_bytes is set to 528. The
problem is the program is ending but leaving the save file open so
subsequent requests to this function cannot access the save file!!! I
THINK the data is corrupted in the transfer and IBM is not picking it
up? I have seen in other articles that IBM I is very bad on TCP/IP error
capture???



I would like to capture the CPF5175 error somehow and clean up so
other requests will not fail. I can log a retry on the source for the
object so it will be recoverable. What is the best way to do this?
Should I just add a signal capture and respond to it using

#pragma exception handler around the _Rwrite? Why isn?t this error
reported back through the fdbk structure? I added the 60 record check
and did a debug to see what records were causing the problem but it was
always different.
What I can say is this only occurs when the comms is heavily loaded?



Hope someone has some ideas? I will keep looking for Comms PTF?s as my
V6R1 system does not exhibit the same behavior just the customers
system running V5R4..



Chris Hird





Chris Hird

Director

Shield Advanced Solutions Ltd

http://www.shield.on.ca

1(519) 940-1192

______________________________________________________________________
______
_______

Please consider the environment before printing this email.



This message, including any attached documents, is intended for the
addressees only. It may contain information that is confidential,
privileged and/or exempt from disclosure. No rights to privilege or
confidentiality have been waived. Any unauthorized use or disclosure
is prohibited. If you have received this message in error, please
reply to the sender by e-mail and delete or destroy all copies of this
message.

______________________________________________________

Avant d'imprimer ce courriel, pensez à l'environnement.



Ce message, incluant tous les documents joints, est à l'intention des
destinataires visés seulement. Il peut contenir des renseignements
confidentiels, protégés et/ou ne pouvant pas être divulgués. Aucune
renonciation n'est faite quant à sa nature confidentielle et privilégiée.
Par conséquent, toute diffusion ou utilisation non autorisée est
strictement interdite. Si vous avez reçu ce message par erreur,
veuillez en aviser immédiatement l'expéditeur par retour de courriel
et en détruire toutes les copies existantes.




--
This is the C programming iSeries / AS400 (C400-L) mailing list To post a
message email: C400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/c400-l.


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact [javascript protected email address].