Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Passing Multiple Occurrence Data Structure to a CL

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

  • Passing Multiple Occurrence Data Structure to a CL

    I am trying to pass a Data Structure to a CL from a RPG.

    But, the &DIV field doesn't look right on the CL program.

    Basically, I have these lines on the RPG and CL.

    // RPG

    d DIVDataStr ds Occurs(10)
    d Divxx 3a

    d Report pr extpgm('OPNSCKRLPC')
    d PRDIVPTR *
    d PRCTR 15p 5
    .
    .
    .
    .

    Clear DIVDataStr;
    xxDIVPTR = %Addr(DIVDataStr);

    for wNdx = 1 to SFLSIZ;
    chain wNDx SUBCOLLS1;
    if SFSEL = 1;
    xxCTR = xxCTR + 1;
    xxOccur = xxCTR;
    %OCCUR(DIVDataStr) = xxOccur;
    Divxx = SFDIV ;
    endif;
    endfor;

    Report( xxDIVPTR : xxCTR );
    .
    .
    .
    .

    /* CL */

    PGM PARM(&DIVPTR &CTR )

    DCL VAR(&DIVPTR) TYPE(*PTR)
    DCL VAR(&CTR) TYPE(*DEC) LEN(15 5)
    DCL VAR(&XXOCCUR) TYPE(*INT)

    DCL VAR(&DIV) TYPE(*CHAR) LEN(2) stg(*based) basptr(&DIVPTR)
    DCL VAR(&LoopCTR) TYPE(*INT)

    CHGVAR VAR(&XXOCCUR) VALUE(&CTR)

    DoFor &LoopCtr from(0) to(&XXOCCUR - 1)
    chgvar var(%offset(&DIVPTR)) value(%offset(&DIVPTR) + ( &LoopCtr * 2) )
    Enddo

Working...
X