ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Accessing the indicator data structure in a file passed as a parameter

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

  • Accessing the indicator data structure in a file passed as a parameter

    Continuing my quixotic quest to eliminate global data from my RPG programs . . .

    When passing a file from one subprocedure to another, how does the called subprocedure reference the indicator data structure defined in the caller? (See the commented-out lines at the bottom.)

    Code:
    ctl-opt main(RAP0133R)
    ​
    dcl-f DisplayFile_t workstn qualified  extdesc('RAP0133D') extfile(*extdesc) template;
    
    dcl-s SalesOrder_t packed(5) template;
    
    
    dcl-proc RAP0133R;
    
    dcl-f Display likefile(DisplayFile_t) indds(Indic) usropn;
    
    dcl-ds Indic len(99) qualified;
    
       Exit ind pos( 3 );
    
    end-ds Indic;
    
    dcl-s OrderNumber like(SalesOrder_t);
    
    open Display;
    
    PromptForOrder (Display: OrderNumber);
    
    [snip]
    
    dcl-proc PromptForOrder;
    
    dcl-pi *n;
    
       ioDspf LikeFile(DisplayFile_t);
    
       ouOrder like(SalesOrder_t);
    
    end-pi;
    
    dcl-ds S1Rec LikeRec(DisplayFile_t.S1: *all) inz;
    
    exfmt ioDspf.S1 S1Rec;
    
    
    // if not F3;
    
    ouOrder = S1Rec.OrdNo;
    
    // endif
Working...
X