RCVF commad problem - IBM AS400

This is a discussion on RCVF commad problem - IBM AS400 ; Hi. I've just written simple CL which looks like this: PGM DCLF FILE(MYLIB/DGSTS) ALWGRAPHIC(*YES) LOOP: DLYJOB DLY(5) DLTF MYLIB/DGSTS MIMIX/WRKDG DGDFN(LIMSP) STATUS(*NO) OUTPUT(*OUTFILE) + OUTFILE(MYLIB/DGSTS) MONMSG MSGID(LVE3019) EXEC(GOTO CMDLBL(LOOP)) RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDPGM)) IF COND(&DBAPYBKLG *EQ 0) THEN(GOTO LOOP) ...

+ Reply to Thread
Results 1 to 11 of 11

Thread: RCVF commad problem

  1. RCVF commad problem

    Hi.

    I've just written simple CL which looks like this:

    PGM

    DCLF FILE(MYLIB/DGSTS) ALWGRAPHIC(*YES)
    LOOP: DLYJOB DLY(5)
    DLTF MYLIB/DGSTS
    MIMIX/WRKDG DGDFN(LIMSP) STATUS(*NO) OUTPUT(*OUTFILE) +
    OUTFILE(MYLIB/DGSTS)
    MONMSG MSGID(LVE3019) EXEC(GOTO CMDLBL(LOOP))
    RCVF
    MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDPGM))
    IF COND(&DBAPYBKLG *EQ 0) THEN(GOTO LOOP)
    CRTLIB LIB(xxx)
    GOTO CMDLBL(LOOP)
    GOTO CMDLBL(ENDPGM)
    ENDPGM: ENDPGM

    problem is that program runs once, so command MIMIX/WRKDG creates
    table MYLIB/DGSTS
    then check if one of fields value is equal 0 and tries to run again
    but it can't perform DLTF command
    because DGSTS table is locked, also second run of MIMIX/WRKDG goes
    wrong because of that lock.

    Can I release my DGSTS file after I check if '&DBAPYBKLG *EQ 0' to be
    able to run LOOP again ?


    Tomasz

  2. Re: RCVF commad problem

    one more thing, lock looks like:

    Member Job User Number Type Lock
    Status Scope Thread
    DGSTS QPADEV000F CWTOST 132889 DATA *SHRRD
    HELD *JOB

    so I've added DLCOBJ OBJ((MYLIB/DGSTS *FILE *SHRRD))

    unfortunatelly it didn't remove lock so I can't delete that file


    Tomasz



    On 15 Kwi, 08:57, tomasz wrote:
    > Hi.
    >
    > I've just written simple CL which looks like this:
    >
    > PGM
    >
    > DCLF FILE(MYLIB/DGSTS) ALWGRAPHIC(*YES)
    > LOOP: DLYJOB DLY(5)
    > DLTF MYLIB/DGSTS
    > MIMIX/WRKDG DGDFN(LIMSP) STATUS(*NO) OUTPUT(*OUTFILE) +
    > OUTFILE(MYLIB/DGSTS)
    > MONMSG MSGID(LVE3019) EXEC(GOTO CMDLBL(LOOP))
    > RCVF
    > MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDPGM))
    > IF COND(&DBAPYBKLG *EQ 0) THEN(GOTO LOOP)
    > CRTLIB LIB(xxx)
    > GOTO CMDLBL(LOOP)
    > GOTO CMDLBL(ENDPGM)
    > ENDPGM: ENDPGM
    >
    > problem is that program runs once, so command MIMIX/WRKDG creates
    > table MYLIB/DGSTS
    > then check if one of fields value is equal 0 and tries to run again
    > but it can't perform DLTF command
    > because DGSTS table is locked, also second run of MIMIX/WRKDG goes
    > wrong because of that lock.
    >
    > Can I release my DGSTS file after I check if '&DBAPYBKLG *EQ 0' to be
    > able to run LOOP again ?
    >
    > Tomasz






  3. Re: RCVF commad problem

    A quick web search suggests that CLOF won't release the lock either
    (though you are probably going to need this anyway if you intend to
    regenerate and reread the same file again and again), and you should
    to split your program in two: PGM1 calls PGM2 which does the RCVF then
    ends passing back a parm to PGM1, PGM1 checks the parm returned from
    PGM2 and runs the DLTF if required.

    If that seems a bit convoluted, why not use *REPLACE as the OUTFILE
    option, and just overwrite the file each time?

  4. Re: RCVF commad problem


    Hi.

    WRKDG command has *ADD or *REPLACE option.
    Both of them doesn't work with table locked.

    So I'll try with PGM1 and PGM2 combination.

    Tomasz


    On 15 Kwi, 11:11, "walker.l2" wrote:
    > A quick web search suggests that CLOF won't release the lock either
    > (though you are probably going to need this anyway if you intend to
    > regenerate and reread the same file again and again), and you should
    > to split your program in two: PGM1 calls PGM2 which does the RCVF then
    > ends passing back a parm to PGM1, PGM1 checks the parm returned from
    > PGM2 and runs the DLTF if required.
    >
    > If that seems a bit convoluted, why not use *REPLACE as the OUTFILE
    > option, and just overwrite the file each time?






  5. Re: RCVF commad problem

    You need to create your work file in QTEMP so that the Mimix Object
    Replicator doesn't interfere with your work file
    "tomasz" wrote in message
    news:dd3a6a2b-7241-46b4-b27e-f085f1bbec0e@d45g2000hsc.googlegroups.com...
    > Hi.
    >
    > I've just written simple CL which looks like this:
    >
    > PGM
    >
    > DCLF FILE(MYLIB/DGSTS) ALWGRAPHIC(*YES)
    > LOOP: DLYJOB DLY(5)
    > DLTF MYLIB/DGSTS
    > MIMIX/WRKDG DGDFN(LIMSP) STATUS(*NO) OUTPUT(*OUTFILE) +
    > OUTFILE(MYLIB/DGSTS)
    > MONMSG MSGID(LVE3019) EXEC(GOTO CMDLBL(LOOP))
    > RCVF
    > MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDPGM))
    > IF COND(&DBAPYBKLG *EQ 0) THEN(GOTO LOOP)
    > CRTLIB LIB(xxx)
    > GOTO CMDLBL(LOOP)
    > GOTO CMDLBL(ENDPGM)
    > ENDPGM: ENDPGM
    >
    > problem is that program runs once, so command MIMIX/WRKDG creates
    > table MYLIB/DGSTS
    > then check if one of fields value is equal 0 and tries to run again
    > but it can't perform DLTF command
    > because DGSTS table is locked, also second run of MIMIX/WRKDG goes
    > wrong because of that lock.
    >
    > Can I release my DGSTS file after I check if '&DBAPYBKLG *EQ 0' to be
    > able to run LOOP again ?
    >
    >
    > Tomasz




  6. Re: RCVF commad problem

    That won't solve the OP's problem. The lock is not caused by MIMIX,
    but by his own CL program. You can't code DCLF .. RCVF ... DLTF in the
    same CL program (DLTF fails because RCVF leaves the file open).

  7. Re: RCVF commad problem

    On Apr 17, 9:51*am, "walker.l2" wrote:
    > That won't solve the OP's problem. The lock is not caused by MIMIX,
    > but by his own CL program. You can't code DCLF .. RCVF ... DLTF in the
    > same CL program (DLTF fails because RCVF leaves the file open).


    'Just' put a RCLRSC *CALLER in your program, either after or in place
    of the CLOF. This may wel break the rest of the application though.

    Jonathan.

  8. Re: RCVF commad problem

    You are correct i didn't notice the the DLTF was included in the loop.

    Which makes the whole discussion moot. This program design is inherently
    bad. The OP should use Mimix's RTVDGSTS command instead.

    "walker.l2" wrote in message
    news:59e07fc1-068a-4ea9-b633-cea6ee29dc7d@s50g2000hsb.googlegroups.com...
    > That won't solve the OP's problem. The lock is not caused by MIMIX,
    > but by his own CL program. You can't code DCLF .. RCVF ... DLTF in the
    > same CL program (DLTF fails because RCVF leaves the file open).




  9. Re: RCVF commad problem

    Hi.

    I was thinking about RTVDGSTS command but all I need is to get vaule
    of 'unprocessed entry count' of one of my DG.

    I didn't find it in any of RTVDGSTS variables but WRKDG to *outfile
    gives me that value.

    That's why I decided to use WRKDG and then RCVF to check if value I need
    to monitor is 0 or something else.

    Perhaps you know which variable in RTV... gives me what I need.

    I's working fine now with WRKDG.

    Tomasz



    Tim M pisze:
    > You are correct i didn't notice the the DLTF was included in the loop.
    >
    > Which makes the whole discussion moot. This program design is inherently
    > bad. The OP should use Mimix's RTVDGSTS command instead.
    >
    > "walker.l2" wrote in message
    > news:59e07fc1-068a-4ea9-b633-cea6ee29dc7d@s50g2000hsb.googlegroups.com...
    >> That won't solve the OP's problem. The lock is not caused by MIMIX,
    >> but by his own CL program. You can't code DCLF .. RCVF ... DLTF in the
    >> same CL program (DLTF fails because RCVF leaves the file open).

    >
    >


  10. Re: RCVF commad problem

    You should use RTVAPYSTS to determine your backlogs, and RTVDGSTS to
    determine if the data group is running

    "tomasz" wrote in message
    news:fu9jbi$clm$1@atlantis.news.neostrada.pl...
    > Hi.
    >
    > I was thinking about RTVDGSTS command but all I need is to get vaule
    > of 'unprocessed entry count' of one of my DG.
    >
    > I didn't find it in any of RTVDGSTS variables but WRKDG to *outfile
    > gives me that value.
    >
    > That's why I decided to use WRKDG and then RCVF to check if value I
    > need to monitor is 0 or something else.
    >
    > Perhaps you know which variable in RTV... gives me what I need.
    >
    > I's working fine now with WRKDG.
    >
    > Tomasz
    >
    >
    >
    > Tim M pisze:
    >> You are correct i didn't notice the the DLTF was included in the
    >> loop.
    >>
    >> Which makes the whole discussion moot. This program design is
    >> inherently bad. The OP should use Mimix's RTVDGSTS command instead.
    >>
    >> "walker.l2" wrote in message
    >> news:59e07fc1-068a-4ea9-b633-cea6ee29dc7d@s50g2000hsb.googlegroups.com...
    >>> That won't solve the OP's problem. The lock is not caused by MIMIX,
    >>> but by his own CL program. You can't code DCLF .. RCVF ... DLTF in
    >>> the
    >>> same CL program (DLTF fails because RCVF leaves the file open).

    >>



  11. Re: RCVF commad problem

    tomasz wrote:
    > Hi.
    >
    > I was thinking about RTVDGSTS command but all I need is to get vaule
    > of 'unprocessed entry count' of one of my DG.
    >
    > I didn't find it in any of RTVDGSTS variables but WRKDG to *outfile
    > gives me that value.
    >
    > That's why I decided to use WRKDG and then RCVF to check if value I need
    > to monitor is 0 or something else.
    >
    > Perhaps you know which variable in RTV... gives me what I need.


    If you want to use the RTV* commands, you may need to do it using two
    commands in a loop. The return variable DBAPYPRC - number of apply
    processes - is returned by RTVDGSTS. Then, for each active apply
    process for the group, you can return the variable BACKLOG using the
    RTVAPYSTS that tells how many entries behind each apply process is.


    >
    > I's working fine now with WRKDG.
    >
    > Tomasz
    >
    >
    >
    > Tim M pisze:
    >> You are correct i didn't notice the the DLTF was included in the loop.
    >>
    >> Which makes the whole discussion moot. This program design is
    >> inherently bad. The OP should use Mimix's RTVDGSTS command instead.
    >>
    >> "walker.l2" wrote in message
    >> news:59e07fc1-068a-4ea9-b633-cea6ee29dc7d@s50g2000hsb.googlegroups.com...
    >>> That won't solve the OP's problem. The lock is not caused by MIMIX,
    >>> but by his own CL program. You can't code DCLF .. RCVF ... DLTF in the
    >>> same CL program (DLTF fails because RCVF leaves the file open).

    >>
    >>


+ Reply to Thread