Skip to main content
New Participant
Jun 26, 2024 12:58 PM UTC

Ways to detect console message during UO calls

Good day,

I am using Unidata 8.2 and building a web frontend to a Unidata application. What I'm trying to figure out is a good method for detecting console message such as Unassigned variables or Unopened file variables during the process. Yes, the messages are being displayed in the COMO, however so is a lot of other information, and I don't want to parse the COMO for console messages. I do want to report the messages back up to the user. Is there an EASY way to detect/trap those console messages? Some SYSTEM variable I can check? 

Thank you for your time,

Dan Duffek 



------------------------------
Daniel Duffek
Software Engineer
Rocket Forum Shared Account
------------------------------

    5 replies

    Jonathan Smith
    Rocketeer
    Jun 27, 2024 4:30 AM UTC

    Good day,

    I am using Unidata 8.2 and building a web frontend to a Unidata application. What I'm trying to figure out is a good method for detecting console message such as Unassigned variables or Unopened file variables during the process. Yes, the messages are being displayed in the COMO, however so is a lot of other information, and I don't want to parse the COMO for console messages. I do want to report the messages back up to the user. Is there an EASY way to detect/trap those console messages? Some SYSTEM variable I can check? 

    Thank you for your time,

    Dan Duffek 



    ------------------------------
    Daniel Duffek
    Software Engineer
    Rocket Forum Shared Account
    ------------------------------

    @Daniel Duffek

    You can check the LastServerError to get the error messages you mentioned. Here is an example of how I have used it in some of the utiltity programs we supply for UV and UD.

    RepMonUoSub = MachineASession.CreateUniSubroutine("REPMON.UO", 2)
    RepMonUoSub.SetArg(0, "11")
    SubCall2Okay = True

    Try
       RepMonUoSub.Call()
    Catch ex As UniSubroutineException
       MsgBox("Subroutine REPMON.UO Call Failed (UniSubroutine Exception)" + vbCrLf + "Error Number : " + ex.ErrorCode.ToString + vbCrLf + "Error Message : " + ex.Message, MsgBoxStyle.Critical)
       SubCall2Okay = False
    Catch ex As Exception
       MsgBox("Subroutine REPMON.UO Call Failed : " + ex.Message, MsgBoxStyle.Critical)
       SubCall2Okay = False
    End Try
    If MachineASession.LastServerError <> "" Then
       MsgBox("LastServerError Message was " + MachineASession.LastServerError, MsgBoxStyle.Information)
    End If



    ------------------------------
    Jonathan Smith
    UniData ATS
    Rocket Support
    ------------------------------
    Rocket Software - Senior Principal Technical Support Engineer - UniData ATS
    New Participant
    Jun 27, 2024 10:37 AM UTC

    @Daniel Duffek

    You can check the LastServerError to get the error messages you mentioned. Here is an example of how I have used it in some of the utiltity programs we supply for UV and UD.

    RepMonUoSub = MachineASession.CreateUniSubroutine("REPMON.UO", 2)
    RepMonUoSub.SetArg(0, "11")
    SubCall2Okay = True

    Try
       RepMonUoSub.Call()
    Catch ex As UniSubroutineException
       MsgBox("Subroutine REPMON.UO Call Failed (UniSubroutine Exception)" + vbCrLf + "Error Number : " + ex.ErrorCode.ToString + vbCrLf + "Error Message : " + ex.Message, MsgBoxStyle.Critical)
       SubCall2Okay = False
    Catch ex As Exception
       MsgBox("Subroutine REPMON.UO Call Failed : " + ex.Message, MsgBoxStyle.Critical)
       SubCall2Okay = False
    End Try
    If MachineASession.LastServerError <> "" Then
       MsgBox("LastServerError Message was " + MachineASession.LastServerError, MsgBoxStyle.Information)
    End If



    ------------------------------
    Jonathan Smith
    UniData ATS
    Rocket Support
    ------------------------------

    Thank you, I'll look into that. 

    I also have phantoms that are spawning and running as a result of the UO call. I don't think the LastServerError will pick those console messages up. Any ideas of how to catch those as well? 



    ------------------------------
    Daniel Duffek
    Software Engineer
    Rocket Forum Shared Account
    ------------------------------
    Jonathan Smith
    Rocketeer
    Jun 27, 2024 10:50 AM UTC

    Thank you, I'll look into that. 

    I also have phantoms that are spawning and running as a result of the UO call. I don't think the LastServerError will pick those console messages up. Any ideas of how to catch those as well? 



    ------------------------------
    Daniel Duffek
    Software Engineer
    Rocket Forum Shared Account
    ------------------------------

    @Daniel Duffek

    Given that you stated you do not want to parse a COMO output I don't expect you want to parse a _PH_ file output ,which would be the only way to get at those messages. However even if you wanted to do this, it brings up a lot of other questions, such as what provision (if any) have you made in your UO code to check that any spawned phantoms have completed, so that their output can be parsed.

    In short there is no simple answer to what you are looking to do with the phantom output.



    ------------------------------
    Jonathan Smith
    UniData ATS
    Rocket Support
    ------------------------------
    Rocket Software - Senior Principal Technical Support Engineer - UniData ATS
    New Participant
    Jun 27, 2024 10:52 AM UTC

    @Daniel Duffek

    Given that you stated you do not want to parse a COMO output I don't expect you want to parse a _PH_ file output ,which would be the only way to get at those messages. However even if you wanted to do this, it brings up a lot of other questions, such as what provision (if any) have you made in your UO code to check that any spawned phantoms have completed, so that their output can be parsed.

    In short there is no simple answer to what you are looking to do with the phantom output.



    ------------------------------
    Jonathan Smith
    UniData ATS
    Rocket Support
    ------------------------------

    That was the conclusion I came to as well, but wanted to check the community at large to see if I was missing something. Thank you for the sanity check. 



    ------------------------------
    Daniel Duffek
    Software Engineer
    Rocket Forum Shared Account
    ------------------------------
    Manu Fernandes
    Inspiring
    Jun 27, 2024 12:36 PM UTC

    Good day,

    I am using Unidata 8.2 and building a web frontend to a Unidata application. What I'm trying to figure out is a good method for detecting console message such as Unassigned variables or Unopened file variables during the process. Yes, the messages are being displayed in the COMO, however so is a lot of other information, and I don't want to parse the COMO for console messages. I do want to report the messages back up to the user. Is there an EASY way to detect/trap those console messages? Some SYSTEM variable I can check? 

    Thank you for your time,

    Dan Duffek 



    ------------------------------
    Daniel Duffek
    Software Engineer
    Rocket Forum Shared Account
    ------------------------------

    Hi Daniel

    We do it with UV errlog, which capture all errors from all sessions in a Loop TexxtFile 

    Line 1 is the 'Last error line entry' 

    The line know the time stamp/ port /user where the error occurs. 

    It's a Light text file, you can parse it quickly. 

    Read file

    read line 1,

    L= line 1 value

    Loop

    check time stamp, port user.<L>

    If port is the one to check... Return <L>

    L-= 1

    Repeat until time stamp less timeref

    It's a quick way to test if a trouble occurs on a session. 

    If Yes, you can read _PH_ to enrichi the errors. (echo, crt,...)

    You can write a subr to do it. 

    Have a look to udt.errlog (cf msglevelconfig). As I remember it's l'équivalent.

    I hope this help. 

    Manu



    ------------------------------
    Manu Fernandes
    ------------------------------