ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Problem with RCVJRNE looping forever on same journal entry

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with RCVJRNE looping forever on same journal entry

    I'm trying to use RCVJRNE. I wrote a simple RPG exit program to test it out. It prints a line each time it's called. My journal receiver has 85 entries. Parameter 2 (which is 3A), receives "1Y1". The sequence number is 1. The second time the program is called, it gets the exact same thing (still sequence number 1), and so on, forever. I added a counter, so it would automatically exit after 100 times. I don't understand why the program does not receive all of the journal entries, instead of looping forever on the first one. Help? I'm on V7R1.

    C/L program:

    PGM
    RCVJRNE JRN(*CURLIB/JRN_CUST) EXITPGM(*CURLIB/REX0017) RCVRNG(*CURLIB/RCV001) ENTFMT(*TYPE1)
    ENDPGM

    RPG exit program:

    H BNDDIR('REXBNDDIR') DFTACTGRP(*NO) OPTION(*SRCSTMT)
    *
    * Process journal entries via RCVJRNE (*TYPE1)
    *
    FQPRINT O F 132 PRINTER

    D REX0017 PI
    D JrnEntry LIKEDS(T_Entry)
    D Control LIKEDS(T_Parm2)

    D Count S 5P 0 INZ(0)
    D PrtLine S 132A

    D T_Entry E DS TEMPLATE QUALIFIED EXTNAME('QSYS/QADSPJRN')

    D T_Parm2 DS TEMPLATE QUALIFIED
    D Action 1 1A
    D Additional 2 2A
    D NameCorrect 3 3A

    C*================================================ =====================
    C* M A I N
    C*================================================ =====================
    /FREE

    Count += 1;

    PrtLine =
    'Control' + Control
    + ' Seq=' + %CHAR(JrnEntry.joseqn)
    + ' Code=' + JrnEntry.jocode
    + ' Type=' + JrnEntry.joentt
    + ' Count=' + %CHAR(count) ;
    except prtdata;

    if (Control.Action <> '1') or (Count >= 100);
    Control.Action = '9';
    *INLR = *ON;
    endif;

    /END-FREE

    OQPRINT E PRTDATA
    O PrtLine +0

    Output when program runs:

    Control 1Y1 Seq=1 Code=J Type=PR Count=1
    Control 1Y1 Seq=1 Code=J Type=PR Count=2
    Control 1Y1 Seq=1 Code=J Type=PR Count=3
    Control 1Y1 Seq=1 Code=J Type=PR Count=4
    Control 1Y1 Seq=1 Code=J Type=PR Count=5
    Control 1Y1 Seq=1 Code=J Type=PR Count=6
    Control 1Y1 Seq=1 Code=J Type=PR Count=7
    Control 1Y1 Seq=1 Code=J Type=PR Count=8
    Control 1Y1 Seq=1 Code=J Type=PR Count=9
    Control 1Y1 Seq=1 Code=J Type=PR Count=10
    ...
    Control 1Y1 Seq=1 Code=J Type=PR Count=90
    Control 1Y1 Seq=1 Code=J Type=PR Count=91
    Control 1Y1 Seq=1 Code=J Type=PR Count=92
    Control 1Y1 Seq=1 Code=J Type=PR Count=93
    Control 1Y1 Seq=1 Code=J Type=PR Count=94
    Control 1Y1 Seq=1 Code=J Type=PR Count=95
    Control 1Y1 Seq=1 Code=J Type=PR Count=96
    Control 1Y1 Seq=1 Code=J Type=PR Count=97
    Control 1Y1 Seq=1 Code=J Type=PR Count=98
    Control 1Y1 Seq=1 Code=J Type=PR Count=99
    Control 1Y1 Seq=1 Code=J Type=PR Count=100

  • #2
    Your program is just called once, it prints a line then returns to the rpg cycle management which does not return to RCVJRNE because *inlr and *inrt are both *off, and when *inlr is *on then action is '9'
    Set *inrt to *on or use return op-code and your pgm will act as you expect
    Nicolas

    Comment


    • #3
      I added RETURN, and it works correctly now. Thanks.

      Comment

      Working...
      X