Rocket U2 | UniVerse & UniData

 View Only
Expand all | Collapse all

Triggers Universe - DOS Command Execute

  • 1.  Triggers Universe - DOS Command Execute

    Posted 04-15-2021 11:28
    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 04-15-2021 11:44

    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 04-15-2021 12:06
    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 04-15-2021 12:40

    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 04-15-2021 12:48
    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 04-15-2021 13:01

    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 04-16-2021 03:49
    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 04-19-2021 10:10
    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 04-19-2021 10:31
    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 04-19-2021 15:36

    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 04-15-2021 13:13

    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 04-16-2021 04:03
    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 04-16-2021 04:09
    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 04-16-2021 04:21
    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 04-16-2021 04:38
    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 04-16-2021 04:55
    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 04-16-2021 12:10
    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
    ------------------------------



  • 18.  RE: Triggers Universe - DOS Command Execute

    PARTNER
    Posted 29 days ago

    hello Henri,

    I read your company develop GCI library that links libcurl . 

    Are you authorized to share your experience ? Please write me on private.

    with kind regards.



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