Menu

Looking for GnuCobol alternatives for Realia functions

2020-08-12
2021-04-01
  • ABHIJEET CHAVAN

    ABHIJEET CHAVAN - 2020-08-12

    Hi,

    I am looking for alternative functions for the below list of Realia functions. Can you please help?

    REALIA_GET_PARM_COUNT - Get number of parameters passed
    REALIA_FINDFIRST - Find first file
    REALIA_FINDNEXT - Find next file
    REALIA_FINDCLOSE - Close the find handle
    REALIA_GET_COMMAND_NAME - Return the name of the current program


    REALIA_EXEC_PROGRAM - Execute a program
    01 PROCESS-HANDLE PIC S9(9) BINARY.
    01 PROG-NAME PIC X(260).
    01 COMMAND-LINE PIC X(1024).
    01 STATUS-CODE PIC S9(9) BINARY.
    ...
    CALL ‘REALIA_EXEC_PROGRAM’
    USING PROCESS-HANDLE PROG-NAME COMMAND-LINE
    GIVING STATUS-CODE
    or

    This routine loads and executes the program specified by the file-name given as
    an ASCIIZ string in PROG-NAME.


    REALIA_EXEC_WAIT - Wait for a process to terminate

    01 PROCESS-HANDLE PIC S9(9) BINARY.
    01 WAIT-RETURN-CODE PIC S9(9) BINARY.
    01 STATUS-CODE PIC S9(9) BINARY.

    CALL ‘REALIA_EXEC_WAIT’
    USING PROCESS-HANDLE WAIT-RETURN-CODE
    GIVING STATUS-CODE
    This routine is used after a call to the REALIA_EXEC_PROGRAM or
    REALIA_EXEC_COMMAND routine to wait for completion of a child process.


    REALIA_EXEC_DETACH - Detach a child process
    01 PROCESS-HANDLE PIC S9(9) BINARY.
    01 STATUS-CODE PIC S9(9) BINARY.

    CALL ‘REALIA_EXEC_DETACH’ USING PROCESS-HANDLE
    GIVING STATUS-CODE.
    This routine is used to close a handle.
    The return value from the REALIA_EXEC_DETACH function indicates the status
    of the close. If the value of STATUS-CODE is zero, then the handle was closed
    successfully.


    REALIA_EXEC_COMMAND - Execute Command Interpreter
    01 PROCESS-HANDLE PIC S9(9) BINARY.
    01 DOS-COMMAND PIC X(1024).
    01 STATUS-CODE PIC S9(9) BINARY.
    ...
    CALL ‘REALIA_EXEC_COMMAND’
    USING PROCESS-HANDLE DOS-COMMAND
    GIVING STATUS-CODE

    This routine loads and executes the command interpreter. The file name and
    location of the command interpreter is determined using the COMSPEC
    environment variable.

    Regards,
    Abhijeet

     
  • Simon Sobisch

    Simon Sobisch - 2021-03-31

    CALL 'SYSTEM' for executing any executable.
    CALL 'CBL_GC_WAITPID' to wait for a process.

    All stock library functions don't use a sub-handle, those that exist use the PID.

    It totally should be possible to create either C functions or COBOL programs (calling "C" native functions like the ones hinted at by Ralph) with the same name as the Realia functions. This way you can leave the programs using those unchanged.
    If someone writes those functions I'd be happy to have those published in the contrib area (even if those are always win32 specific, at least until someone else creates a more portable version), allowing others porting from Realia to get further more quick.

     

Anonymous
Anonymous

Add attachments
Cancel