Rocket U2 | UniVerse & UniData

Expand all | Collapse all

Triggers Universe - DOS Command Execute

  • 1.  Triggers Universe - DOS Command Execute

    Posted 29 days ago
    Hi there,

    I've been looking for a long time, how to execute the 'DOS' command in a trigger in Universe.
    I have seen in some forum, that they indicated to add an 'H' in attribute 4, in the VOC DOS of the UV account.
    I have tried this and it does not work, since when firing the trigger and executing the DOS command in the subroutine, I get this message:

    Program "ED": pc = 744C, Verb "DOS" illegal when a transaction is active.
    Program "ED": pc = 744C, Error performing trigger for "XXXXXXXX".
    Failed to file "20451390" in file "XXXXXXXX". STATUS = 2

    Has anyone had the same problem of being able to run Verb on triggers?

    Thanks and best regards

    ------------------------------
    Miguel Esteban Rodriguez Gonzalez
    DataDealer Software España
    ------------------------------


  • 2.  RE: Triggers Universe - DOS Command Execute

    PARTNER
    Posted 29 days ago

    Hi Miguel,

    As you have seen, UniVerse does not permit you to invoke the operating system shell from within a UniVerse trigger, which is what executing "DOS" will do. I can think of a lot of reasons why that is the case, including what would happen to the transaction if the command being invoked crashes or otherwise aborts.

    What are you trying to do in the trigger that cannot be done in BASIC?

    Henry



    ------------------------------
    Henry Unger
    President
    Pulsiam
    Encino CA United States
    ------------------------------



  • 3.  RE: Triggers Universe - DOS Command Execute

    Posted 29 days ago
    Hi Henry,

    I am trying is to execute a request to send a json to a WebService.

    With the DOS command, I invoke the cURL to make the request, from a .bat.

    This works correctly from a subroutine that is not associated with a triggers, but I no longer have the process running in a single instance and I would have to link it to each affected screen of the application, so I would have to be replicating the code.

    I was convinced that the transactions in the triggers or in certain commands could be deactivated by modifying attribute 4 of the VOC in the UV account, but I see that it cannot.

    Miguel.


    ------------------------------
    Miguel Esteban Rodriguez Gonzalez
    DataDealer Software España
    ------------------------------



  • 4.  RE: Triggers Universe - DOS Command Execute

    Posted 29 days ago

    I have found the best practice with triggers is to write out your commands to a tickler file.  Then phantom process can go through the tickler file and execute the commands.

     

     

    David A. Green

    DAG Consulting

     

     






  • 5.  RE: Triggers Universe - DOS Command Execute

    Posted 29 days ago
    Hi David,

    A tickler file?
    You mean one of the bat type?
    I honestly don't know what the tickler files are.



    ------------------------------
    Miguel Esteban Rodriguez Gonzalez
    DataDealer Software España
    ------------------------------



  • 6.  RE: Triggers Universe - DOS Command Execute

    Posted 29 days ago

    A tickler file is just a UV file.  One that holds your commands.  The id is usually code.date.time so that this file can be used by many processes.  Then your phantom would select the file based on code sorted by date and time in order to execute your commands in the same order in which they were written to the UV file.

     






  • 7.  RE: Triggers Universe - DOS Command Execute

    Posted 29 days ago
    Hi David,

    I had not thought about it, but it is a great idea, since although the request has to be done in real time, I can leave the phantom scheduled to run in short intervals of time.

    Thanks David for clarifying a lot for me an alternative solution to the problem that triggers represent in UV.


    ------------------------------
    Miguel Esteban Rodriguez Gonzalez
    DataDealer Software España
    ------------------------------



  • 8.  RE: Triggers Universe - DOS Command Execute

    Posted 25 days ago
    Does UV have PAUSE/WAKE like UD?   We use tickler files often.  For those needing immediate action, the phantom process stores its pid in a file for other processes to access.  It uses PAUSE instead of SLEEP between iterations of the file it is watching.  The requesting process stores the item in the tickler file, then uses WAKE to signal the phantom it has something to do.  This allows longer sleep times for the phantom and it isn't constantly scanning the tickler file.

    ------------------------------
    DEAN ARMBRUSTER
    Ferguson Enterprises, LLC
    ------------------------------



  • 9.  RE: Triggers Universe - DOS Command Execute

    Posted 25 days ago
    Hi Dean,

    I don't think those instructions are for UV.

    Anyway, after testing the fast triggers through the indexed subroutine, it works perfectly for what I was looking for.

    Thanks for the info.


    Best Regards.

    ------------------------------
    Miguel Esteban Rodriguez Gonzalez
    INTERNATIONAL CONSULTANTS AND ASSOC
    ------------------------------



  • 10.  RE: Triggers Universe - DOS Command Execute

    Posted 25 days ago

    Dean, that's genius!

     

    I will have to add that to my list of tools!  I did use PAUSE/WAKE once because I had to wait for phantom process to finish before I could continue.  So I share my PID with the phantom and put myself into PAUSE mode.  Then the phantom wakes me when it has finished processing.

     

    David Green

     






  • 11.  RE: Triggers Universe - DOS Command Execute

    PARTNER
    Posted 29 days ago

    Hi Miguel,

    Have you considered using submitRequest to send the JSON to a web service? I haven't tried it from a trigger but we do use submitRequest to send JSONs all the time.

    Henry



    ------------------------------
    Henry Unger
    President
    Pulsiam
    Encino CA United States
    ------------------------------



  • 12.  RE: Triggers Universe - DOS Command Execute

    Posted 29 days ago
    Hi Henry,

    The problem is that submitrequest in UV does not communicate correctly with many of the webservices that I have to invoke.

    In many of them, the communication returns in 3 or in other cases, it does not return the response from the webservice.

    For this reason, it has been more than two years since we have changed the communication engine in our application by invoking the cURL, with satisfactory results in 100% of the cases.

    It is a pending task for Rocket Software to improve the behavior of triggers, since they offer a high potential for the execution of processes that affect specific files.

    Thanks anyway for your comment.


    ------------------------------
    Miguel Esteban Rodriguez Gonzalez
    DataDealer Software España
    ------------------------------



  • 13.  RE: Triggers Universe - DOS Command Execute

    ROCKETEER
    Posted 29 days ago
    Miguel,

    Have you tried using an indexed subroutine (aka fast triggers) to do this ?

    You can create an index on the file with the NO.NULLS option and then use the indexed subroutine to run your code and then set the index value to null which means no index update actually takes place but the code in the indexed subroutine is run.

    If you need more details on the indexed subroutines let us know.

    Thanks,
    Jonathan

    ------------------------------
    Jonathan Smith
    UniData ATS and Principal Engineer
    Rocket Software
    ------------------------------



  • 14.  RE: Triggers Universe - DOS Command Execute

    Posted 29 days ago
    Hi Jonathan,

    The truth is that I did not know about the existence of these indexed subroutines or aka fast triggers.

    If you can give me more information to know its functionality, I would be very grateful.

    Kind Regards,


    ------------------------------
    Miguel Esteban Rodriguez Gonzalez
    DataDealer Software España
    ------------------------------



  • 15.  RE: Triggers Universe - DOS Command Execute

    ROCKETEER
    Posted 29 days ago
    Miguel,

    The subject of index-based subroutines is covered in the UniVerse System Description manual under the chapter for File Triggers for your reference.

    The principal for you would be this

    ....

    Create a dictionary on your file as below


    MIG.TEST
    0001 I
    0002 SUBR("MIG.INDEX.SUB")
    0003
    0004
    0005 10L
    0006 S


    >CREATE.INDEX MIG.FILE MIG.TEST NO.NULLS

    The MIG.INDEX.SUB will look like this

    SUBROUTINE MIG.INDEX.SUB(RTN.VAL)
    COMMON /MIG.SIB/ MIG.INIT, ...
    RTN.VAL = ""
    IF NOT(MIG.INIT) THEN
    *** Open Files to be used and stored in named common
    ....
    MIG.INIT = 1
    END
    *** Your Code
    ....
    RETURN
    END

    Regards,
    Jonathan

    ------------------------------
    Jonathan Smith
    UniData ATS and Principal Engineer
    Rocket Software
    ------------------------------



  • 16.  RE: Triggers Universe - DOS Command Execute

    Posted 29 days ago
    Thank you very much Jonathan.

    I had read the manual a thousand times and had not paid any attention to this point.

    This solution is great for me to do what I have in mind, since David's solution is very good too, but I have to have a phantom to launch the process every so often.


    Kind regards,


    ------------------------------
    Miguel Esteban Rodriguez Gonzalez
    DataDealer Software España
    ------------------------------



  • 17.  RE: Triggers Universe - DOS Command Execute

    PARTNER
    Posted 28 days ago
    Hi Miguel,

    The UniVerse fast trigger is a great solution.

    It is too bad that submitRequest did not work for you.

    Regarding cURL, there are things it can do that submitRequest cannot, so we developed a GCI library that links in libcurl so that all of its functionality is available to our applications.

    Henry

    ------------------------------
    Henry Unger
    President
    Pulsiam
    Encino CA United States
    ------------------------------