+ Reply to Thread
Results 1 to 4 of 4

Thread: Retrieving commands from an ILE RPG PGM

  1. #1
    Guest.Visitor Guest

    Default Retrieving commands from an ILE RPG PGM

    Hi every body,

    I try to implement a command line at the bottom of a display very much like the one you can have using UIM (see PDM ?). My problem is that I can not use UIM because the programs all ready exist and that the old method that I used just doesn't work.

    This strange problem may be related to my misunderstanding of how message queues works with ILE actually our program are mostly written in ILE RPG. To try to retrieve the command I use a CL program to receive the message for the *EXT program queue. The CL program is :

    /* Extract previous command from PGMQ*/

    PGM PARM(&TYPE &KEYVAR &MSGTXT &REL &PGMQ) DCL VAR(&TYPE) TYPE(*CHAR) LEN(6) DCL VAR(&KEYVAR) TYPE(*CHAR) LEN(4) DCL VAR(&MSGTXT) TYPE(*CHAR) LEN(160) DCL VAR(&REL) TYPE(*CHAR) LEN(5) DCL VAR(&PGMQ) TYPE(*CHAR) LEN(10) DCL VAR(&RTNTYP) TYPE(*CHAR) LEN(2)

    IF COND(&KEYVAR *EQ ' ') THEN(DO) IF COND(&REL *EQ '*EXT ') THEN(DO) RCVMSG PGMQ(&REL) MSGTYPE(*LAST) RMV(*NO) KEYVAR(&KEYVAR) MSG(&MSGTXT) RTNTYPE(&RTNTYP) ENDDO ELSE CMD(DO) RCVMSG PGMQ(&REL &PGMQ) MSGTYPE(*LAST) RMV(*NO) KEYVAR(&KEYVAR) MSG(&MSGTXT) RTNTYPE(&RTNTYP) ENDDO ENDDO

    RCV: IF COND(&RTNTYP *NE '08' *AND &RTNTYP *NE '10') THEN(DO) IF COND(&REL *EQ '*EXT') THEN(DO) RCVMSG PGMQ(&REL) MSGTYPE(*PRV) MSGKEY(&KEYVAR) RMV(*NO) KEYVAR(&KEYVAR) MSG(&MSGTXT) + RTNTYPE(&RTNTYP) MONMSG MSGID(CPF0000) ENDDO ELSE CMD(DO) RCVMSG PGMQ(&REL &PGMQ) MSGTYPE(*PRV) MSGKEY(&KEYVAR) RMV(*NO) KEYVAR(&KEYVAR) + MSG(&MSGTXT) RTNTYPE(&RTNTYP) MONMSG MSGID(CPF0000) ENDDO

    IF COND(&KEYVAR *EQ ' ') THEN(GOTO CMDLBL(EXIT))

    GOTO CMDLBL(RCV)

    ENDDO

    EXIT:

    ENDPGM

    Which run just fine with a OPM program but not with my RPG ILE version. I will really appreciate any help or idea thanks. ;-)


  2. #2
    Guest.Visitor Guest

    Default Retrieving commands from an ILE RPG PGM

    On Monday, July 12, 1999, 04:47 AM, Bruno Couleau wrote: Hi every body, I try to implement a command line at the bottom of a display very much like the one you can have using UIM (see PDM ?). My problem is that I can not use UIM because the programs all ready exist and that the old method that I used just doesn't work. This strange problem may be related to my misunderstanding of how message queues works with ILE actually our program are mostly written in ILE RPG. To try to retrieve the command I use a CL program to receive the message for the *EXT program queue. The CL program is :
     /* Extract previous command from PGMQ*/ PGM PARM(&TYPE &KEYVAR &MSGTXT &REL &PGMQ) DCL VAR(&TYPE) TYPE(*CHAR) LEN(6) DCL VAR(&KEYVAR) TYPE(*CHAR) LEN(4) DCL VAR(&MSGTXT) TYPE(*CHAR) LEN(160) DCL VAR(&REL) TYPE(*CHAR) LEN(5) DCL VAR(&PGMQ) TYPE(*CHAR) LEN(10) DCL VAR(&RTNTYP) TYPE(*CHAR) LEN(2) IF COND(&KEYVAR *EQ ' ') THEN(DO) IF COND(&REL *EQ '*EXT ') THEN(DO) RCVMSG PGMQ(&REL) MSGTYPE(*LAST) RMV(*NO) KEYVAR(&KEYVAR) MSG(&MSGTXT) RTNTYPE(&RTNTYP) ENDDO ELSE CMD(DO) RCVMSG PGMQ(&REL &PGMQ) MSGTYPE(*LAST) RMV(*NO) KEYVAR(&KEYVAR) MSG(&MSGTXT) RTNTYPE(&RTNTYP) ENDDO ENDDO RCV: IF COND(&RTNTYP *NE '08' *AND &RTNTYP *NE '10') THEN(DO) IF COND(&REL *EQ '*EXT') THEN(DO) RCVMSG PGMQ(&REL) MSGTYPE(*PRV) MSGKEY(&KEYVAR) RMV(*NO) KEYVAR(&KEYVAR) MSG(&MSGTXT) RTNTYPE(&RTNTYP) MONMSG MSGID(CPF0000) ENDDO ELSE CMD(DO) RCVMSG PGMQ(&REL &PGMQ) MSGTYPE(*PRV) MSGKEY(&KEYVAR) RMV(*NO) KEYVAR(&KEYVAR) MSG(&MSGTXT) RTNTYPE(&RTNTYP) MONMSG MSGID(CPF0000) ENDDO IF COND(&KEYVAR *EQ ' ') THEN(GOTO CMDLBL(EXIT)) GOTO CMDLBL(RCV) ENDDO EXIT: ENDPGM 
    Which run just fine with a OPM program but not with my RPG ILE version. I will really appreciate any help or idea thanks. ;-)

    When you receive a request message from PGMQ(*EXT), two things happen: the message reference key changes; and, the message moves from PGMQ(*EXT) to the call message queue of the program or procedure that specified the RCVMSG command. Therefore, you cannot recieve it from PGMQ(*EXT) again. If you want to retrieve the request message again, try using the Retrieve Request Message (QMHRTVRQ) API.

  3. #3
    Guest.Visitor Guest

    Default Retrieving commands from an ILE RPG PGM

    On Saturday, July 10, 1999, 01:44 AM, David Bye wrote: How can I dymaically call a procedure within ILE COBOL ? I was looking at the CALL procedure-pointer . But it seems I still have to perform a SET procedure-pointer TO ENTRY LINKAGE TYPE IS PROCEDURE literal What we want to be able to achieve is have the procedure name determined at runtime via a parameter. Thanks David. I have had disucssions with IBM AS/400 developers about this subject. Why are procedure calls literal only? Why can't we have a variable? The developers told me that if you want to set a procedure pointer of a procedure that is exported from a service program, call QleGetExp. If the service program was not loaded when the program started, you must load it with a call to QleActBndPgm. I made a note of these API's but have never used them so I don't have any examples. The develpers told me, that ILE service programs are similar to DLLs on a PC but have important differences. They wanted to create a function like DLLs on the AS/400, however they did not want to have run time aborts due to load errors at run time. On a PC a program may be executing normal then it calls a procedure in a DLL. The DLL can't load or be found for some reason and the program aborts with a message about swap file error or invalid pointer. The developers said they did not want strange errors like that occuring at run time on the AS/400. So they decided to have all service programs load when the main program loads. If program A calls a procedure in service program S1 then service program S1 is loaded when program A is loaded. The call to the service program may not be executed every time program A is loaded, but service program S1 will always be loaded. This allows the system to verify that all components are in place and loaded before the program executes. Because ILE works this way, you have to be carefull in how you organize service programs. Program A may call a procedure in service program S1 but no calls to procedures in service program S2. However service program S2 will always be loaded when S1 is loaded because S1 contains a call to S2. When we started with ILE we were not aware of this and created a situation in which we had many unused ILE service programs getting loaded. We had to re-organize our service programs. JHicks@SUZ.com

  4. #4
    Guest.Visitor Guest

    Default Retrieving commands from an ILE RPG PGM

    Thank you so much Gene, that was the solution. As soon as possible I will post a little function written as a complement of the MSGAPI tool box written by R. Morris. I think it will be very convenient for others... Any way thank you again.

+ Reply to Thread

Similar Threads

  1. Want Help with Your Commands?
    By AVROHOM in forum CL
    Replies: 1
    Last Post: 07-27-2006, 12:47 AM
  2. Using CL commands in RPG
    By Guest.Visitor in forum RPG
    Replies: 7
    Last Post: 12-02-2005, 07:22 AM
  3. PTF COMMANDS
    By David Abramowitz in forum General
    Replies: 3
    Last Post: 07-14-2005, 02:50 AM
  4. PJL Commands
    By Guest.Visitor in forum Document Management
    Replies: 2
    Last Post: 01-24-2005, 10:20 AM
  5. PC Commands from the AS/400
    By Guest.Visitor in forum General
    Replies: 1
    Last Post: 09-03-2002, 01:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts