× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: Remote Command from Access?
  • From: Bob Cozzi <web5028f@xxxxxxxxxx>
  • Date: Fri, 6 Jun 1997 09:42:01 -0500
  • Organization: RPG Developer Network

David,

Here is the "RUNCMD" method out of my AS/400 CL Command Line Window. If you 
download my HOST SOURCE TRANSFER from my web site WWW.RPGDEV.NET it allows 
you to run a CL command. This code is the code behind the dialog box's "Run 
Command" button.



void CCmdLine::OnRunCommand()
{

    char  lpszMsgID[9];
    char  szSysName[64];

    char  szMsgText[1025];
    UINT  wMsgLen = sizeof(szMsgText)-1;
    UINT  wSevCode = 0;

    WORD  wRtnCode = 0;

    UpdateData(TRUE);   // Retrieve the command to run.


    clear(szMsgText);
    clear(szSysName);
    clear(lpszMsgID);

    memset(m_szCmdBuffer,'\0',CMDBUFFER);
    memset(m_szCPFMsgBuffer,'\0',CPFMSGBUFFER);

    strcpy(szSysName, (LPCSTR) m_szSysName);

    if  (m_szCmdLine.IsEmpty())
         return;

    m_Messages.ResetContent();
    strcpy(m_szCmdBuffer,(LPCSTR) m_szCmdLine);

    if (IsValid(GetApp()->m_pfnSubmitCommand)) {
        wRtnCode = GetApp()->m_pfnSubmitCommand(GetSafeHwnd(),
                            (LPSTR) szSysName,        /* System name 
                   */
                            (LPSTR) m_szCmdBuffer,    /* Command Entry Line 
buffer      */
                            (LPSTR) m_szCPFMsgBuffer,    /* Return CPF 
message text buffer */
                            (WORD)  CPFMSGBUFFER,       /* Length of the 
message buffer   */
                                    NULL);            /* Pointer to 
CALLBACK function   */
    }

    if  (wRtnCode >= EHNSR_SEVEREERROR) {
        sprintf(m_szMsg,">>SbmRmtCmd() Error.  Return code x\'%X\'.",(UINT) 
wRtnCode);
        GetApp()->WriteJoblog(m_szMsg);
        m_Messages.InsertString(0,m_szMsg);
    }
    else    {
                    // Store the command for later retrieval
        m_PriorCmd.InsertString(0,m_szCmdLine);
        m_PriorCmd.SetCurSel(0);
        GetApp()->m_szPriorCmds.AddHead(m_szCmdLine);
    }


    GetApp()->WriteJoblog("---- Recording result messages in joblog.");

    GetApp()->WriteJoblog("MSGID   Sev Message Text");

    if (IsValid(GetApp()->m_pfnGetMessage)) {
        do {
            clear(szMsgText);

            //    ::EHNSR_GetMessage(GetSafeHwnd(),
            wRtnCode = GetApp()->m_pfnGetMessage(GetSafeHwnd(),
                                    (LPSTR)  szSysName,              // 
System name
                                    (LPWORD) &wSevCode,
                                    (LPSTR)  lpszMsgID,
                                    (LPSTR)  szMsgText,
                                    (WORD)   wMsgLen,
                                    (LPSTR)  m_szCPFMsgBuffer,
                                    (WORD)   CPFMSGBUFFER);

            if ((wRtnCode == EHNSR_OK) && strlen(szMsgText)>0) {
                sprintf(m_szMsg,"%s (%02d) %s",lpszMsgID, wSevCode, 
szMsgText);
                GetApp()->WriteJoblog(m_szMsg);
                m_Messages.AddString(m_szMsg);
            }

        } while (strlen(szMsgText)>0);
    }
    m_CmdLine.SetFocus();
}
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the Midrange System Mailing List!  To submit a new message,   *
* send your mail to "MIDRANGE-L@midrange.com".  To unsubscribe from     *
* this list send email to MAJORDOMO@midrange.com and specify            *
* 'unsubscribe MIDRANGE-L' in the body of your message.  Questions      *
* should be directed to the list owner / operator: david@midrange.com   *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2024 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 on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.