Re: sys$synch iosb returning status as SS$_ENDOFFILE (527 Views)
Reply
Frequent Advisor
allin-in-one
Posts: 57
Registered: ‎10-21-2012
Message 1 of 10 (593 Views)

sys$synch iosb returning status as SS$_ENDOFFILE

[ Edited ]

we have an application which is reading from the socket writing to disk using sys$qio. Using sys$synch to check the completion of operation.In sys$synch iosb returning status as SS$_ENDOFFILE. Please advise under what conditions this can occur.

Honored Contributor
Duncan Morris
Posts: 666
Registered: ‎08-07-2003
Message 2 of 10 (586 Views)

Re: sys$synch iosb returning status as SS$_ENDOFFILE

Welcome to the forum!

 

Some more information would be useful:

 

VAX/Alpha/Itanium, OS versions?

 

Example of your code?

 

If you are truly using $QIOW then $SYNCH is superfluous.

 

" The synchronous services such as $QIOW execute code that checks for the true completion status in the same way that $SYNCH does"

 

 

Duncan

Frequent Advisor
allin-in-one
Posts: 57
Registered: ‎10-21-2012
Message 3 of 10 (571 Views)

Re: sys$synch iosb returning status as SS$_ENDOFFILE

Thanks you. Sorry, it is a typo the service I am using is sys$qio  NOT sysqiow. the system is  IA64 OpenVMS V8.3.

Honored Contributor
Duncan Morris
Posts: 666
Registered: ‎08-07-2003
Message 4 of 10 (555 Views)

Re: sys$synch iosb returning status as SS$_ENDOFFILE

.. and your code sample, so that we can see exactly what your QIO command looks like, and the corresponding SYNCH operation?

 

 

Frequent Advisor
allin-in-one
Posts: 57
Registered: ‎10-21-2012
Message 5 of 10 (553 Views)

Re: sys$synch iosb returning status as SS$_ENDOFFILE

The code for sys$qio and sys$synch are as below .

 

stat = sys$qio(0, chan, IO$_WRITEVBLK | IO$M_NOVCACHE,  iosb,0, 0,    buf,  len,  blkn, 0, 0, 0);

 

int   stat = sys$synch(EFN$C_EFN, (short unsigned int *)iosb);

Honored Contributor
Duncan Morris
Posts: 666
Registered: ‎08-07-2003
Message 6 of 10 (537 Views)

Re: sys$synch iosb returning status as SS$_ENDOFFILE

From the $SYNCH service description:

 

"The Synchronize service checks the completion status of a system service that completes asynchronously. The service whose completion status is to be checked must have been called with the efn and iosb arguments specified, because the $SYNCH service uses the event flag and I/O status block of the service to be checked."

 

see: http://h71000.www7.hp.com/doc/84final/4527/4527pro_116.html#jun_584

 

Your code for the $QIO did not specify an efn, and you then used a completely different efn for the $SYNCH call!

 

You must specificy a non-zero efn in the $QIO call, and then use the same efn and the same iosb for the $SYNCH call.

 

Duncan 

Frequent Advisor
allin-in-one
Posts: 57
Registered: ‎10-21-2012
Message 7 of 10 (530 Views)

Re: sys$synch iosb returning status as SS$_ENDOFFILE

[ Edited ]

Thank for the reply.

 

actually the code is

int

stat = sys$synch(EFN$C_EFN, (int*)iosb);

 if (stat == SS$_ILLEFC)

sys$synch(0, (int*)iosb);

 

As per the document http://h71000.www7.hp.com/doc/82final/5841/5841pro_020.html we can specify efn as EFN$C_ENF for ZERO  event flag EFN$C_EFN (128) is not supported (in VAX  and early ALPHA). Please correct me.

 

Actually this code is working in almost all scenarios. But I have seen a problem recently in which iosb is returning SS$_ENDOFFILE in some cases. I would like to know under what circumstances iosb status will be SS$_ENDOFFILE. From the manuals I couldn't find the circumstances for this scenario.

 

Once again thanks for your help.

Honored Contributor
Hein van den Heuvel
Posts: 6,588
Registered: ‎05-19-2003
Message 8 of 10 (527 Views)

Re: sys$synch iosb returning status as SS$_ENDOFFILE

Like any good engineer, I like to see code and learn about versions and so one, but folks this is an EASY self-inflicted error.

 

QIO  IO$_WRITEVBLK returning   ENDOFFILE means... drum roll.... the END OF FILE was reached. No kiddding.

 

It appears the folks writing the application were just smart enough to be dangerous as suggested by the QIO + SYNC usage and the little known IO$M_NOVCACHE modifier.

But if you use QIO to write to a file, then the program needs to pre-allocate or extent the file as needed.

 

Sample below.

Good luck,

Hein

 

$create QIO_EOF.c
#include        <rms>           /* defines for rabs and fabs    */
#include        <stdio>         /* defins printf...             */
#include        <string>
#include        <iodef>
main(int argc,char *argv[])
{
char            buf[64*512];
struct FAB      outfab, *fab;   /* Allocate fabs and a pointer to fab */
int             s, i=0, len=512, blkn=1, sys$create(), sys$qiow();
unsigned short  iosb[4];

outfab = cc$rms_fab;                    /* Make this a real FAB (bid and bln) */
outfab.fab$b_fac = FAB$M_PUT;           /* record write access                */
outfab.fab$l_fop = FAB$M_UFO;
outfab.fab$l_fna = (argc > 1) ? argv[1] : "TMP.TMP";
outfab.fab$b_fns = strlen(outfab.fab$l_fna);
outfab.fab$l_alq = 10;


s = sys$create ( &outfab );     /* Try to open target file          */
if (s & 1) {
   s = sys$qiow(0, outfab.fab$l_stv, IO$_WRITEVBLK | IO$M_NOVCACHE,  iosb,0, 0,    buf,  len,  blkn, 0, 0, 0);
   printf ("qio %d. vbn = %d, status = 0x%0X, iosb = 0x%0X\n", ++i, blkn, s, iosb[0]);
   blkn = 10000;
   s = sys$qiow(0, outfab.fab$l_stv, IO$_WRITEVBLK | IO$M_NOVCACHE,  iosb,0, 0,    buf,  len,  blkn, 0, 0, 0);
   printf ("qio %d. vbn = %d, status = 0x%0X, iosb = 0x%0X\n", ++i, blkn, s, iosb[0]);
   if (s&1) s =  iosb[0];
   return s;
   }
}

$ cc QIO_EOF
$ link QIO_EOF
$ run QIO_EOF
qio 1. vbn = 1, status = 0x1, iosb = 0x1
qio 2. vbn = 10000, status = 0x1, iosb = 0x870
%SYSTEM-W-ENDOFFILE, end of file

 

 

 

Honored Contributor
Hein van den Heuvel
Posts: 6,588
Registered: ‎05-19-2003
Message 9 of 10 (525 Views)

Re: sys$synch iosb returning status as SS$_ENDOFFILE

$ help /messa/fac=SYS ENDOFFILE

 ENDOFFILE,  end of file

  Facility:     SYSTEM, System Services

  Explanation:  This message was received because of one or more of the
                following conditions:

 
                o The file system ACP encountered the end of the allocated
                  space for a virtual I/O operation or an attempted
                  truncation.


  User Action:  If necessary, modify the source program to detect and respond to the condition.

 

Frequent Advisor
allin-in-one
Posts: 57
Registered: ‎10-21-2012
Message 10 of 10 (513 Views)

Re: sys$synch iosb returning status as SS$_ENDOFFILE

Once  again thanks for the help .

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.