SQL_QFO_FUNCTION_ATTRIBUTES short Sql_Qfo_Close(short quasi_file_number)
{
    CliGlobals *cliGlobals;
    if (QfoRevealSegs(cliGlobals) != 0)
        return 0;
    cliGlobals->setLogEmsEvents(FALSE);
    jmp_buf jmpBuf;
    cliGlobals->setJmpBufPtr(&jmpBuf);
    Int32 jmpRc = setjmp(jmpBuf);
    if (jmpRc)
    {
        cliGlobals->setLogEmsEvents(TRUE);
        QfoHideSegs(cliGlobals);
        return 0;
    }
    QuasiFileManager *quasiFileManager = cliGlobals->getQuasiFileManager();
    quasiFileManager->closeQuasiFile(quasi_file_number);
    cliGlobals->setLogEmsEvents(TRUE);
    QfoHideSegs(cliGlobals);
    return 0;
}
SQL_QFO_FUNCTION_ATTRIBUTES short Sql_Qfo_IOComp(short quasi_file_number /*in*/,
        Lng32 *tag /*out*/,
        unsigned short *waitmask /*out*/,
        short userstop /*in*/)
{
    short retVal, feError = FEOK;
    RETCODE retcode;
    QuasiFileManager *quasiFileManager;
    *waitmask = LDONE;
    CliGlobals *cliGlobals;
    if (QfoRevealSegs(cliGlobals) != 0)
        return FEBADPARMVALUE;
    jmp_buf jmpBuf;
    short oldStop;
    oldStop = SETSTOP(1);
    cliGlobals->setJmpBufPtr(&jmpBuf);
    Int32 jmpRc = setjmp(jmpBuf);
    if (jmpRc)
    {
        QfoHideSegs(cliGlobals);
        SETSTOP(oldStop);
        return FEBADPARMVALUE; // longjmp not associated with statement
    }
    quasiFileManager = cliGlobals->getQuasiFileManager();
    if (quasiFileManager->getPendingNowaitOps() > 0)
        retcode = quasiFileManager->awaitIox(quasi_file_number, tag, &feError);
    else
    {
        QfoHideSegs(cliGlobals);
        SETSTOP(oldStop);
        return FENONEOUT;
    }
    if (feError != FEOK)
        retVal = feError; // May be FEBADPARMVALUE, or FENONEOUT
    else
    {
        if (1) // Not used but is compiled on NT
            retVal = FEQFOEVENTCONSUMED;
        else
            switch (retcode)
            {
            case SUCCESS:
                retVal = FEOK;
                break;
            case ERROR:
                retVal = FESQLERR;
                break;
            case SQL_EOF:
            case WARNING:
                retVal = FESQLWARN;
                break;
            case NOT_FINISHED:
                retVal = FEQFONOTCOMPLETE;
                break;
            default:
                retVal = FEBADPARMVALUE;
            }
    }
    QfoHideSegs(cliGlobals);
    SETSTOP(oldStop);
    return retVal;
}