ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Any such thing as subfiles for dummies?

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

  • Any such thing as subfiles for dummies?

    I frequently have issues with subfiles. I start off copying existing code (which may have been written 10+ years ago) and then try to get it to do what the users want. I have an article from RPGPGM.COM that has an example subfile program (by Simon Hutchinson). It seems straightforward enough, but when I try to mix in the logic I need to present the screen for entry, I get all turned around on the indicators. I know my problem has something to do with SFLDSP and SFLDSPCTL, but I'm not quite sure what.

    So, code parts --> this is supposed to load the sub file
    PHP Code:
                 //SflDspCtl = *off;
              
    *IN91 = *Off;   //I switched to the indicator because I was afraid I didn't have INDDS set up correctly
              //SflDsp = *Off;
              
    *IN92 = *Off;
              
    Write Ctlv01   ;
              
    //SflDspCtl = *On;
                
    *IN91 = *On  ;

             
    Wk@EOF = *Off;        

            
    DOU Wk@EOF = *On;
              
    EXSR $065_READ;

              If 
    WK@eof = *On;
                
    Leave;
              ENDIF;

              
    Write SUBV01;
               
    ENDDO;          

              IF 
    REC001 1;
                
    //SFLDSP = *ON; 
                
    *IN92 = *ON;
              ENDIF; 
    Immediately after that, it goes back here:
    PHP Code:
      dow (1);
               
    Write FOOTER1;
               
    ExFmt CTLV01;

              If Exit;
                
    Leave;
              elseif (
    F6);
               
    EXSR ReadSubFile;
                
    iter;
              elseif  (
               
    S1Plant  <> SAVs1Plt     or
               
    S1LDDte  <> SAVs1LDte    or
               
    S1UPDLOAD  <> SAVs1OFSLd);
                
    Exsr KeyChange;
                
    Exsr loadsubfile;
                
    iter;
              ENDIF;

            
    //If SFLDSP = *ON;
            //  EXSR ReadSubFile;
            // ENDIF;
              
    ENDDO;

            *
    inlr = *on

    It's dying on the EXFMT with my best frenemy - RNX1255

    My wonderful company won't pay for training. I try to find answers by Google - and asking the guy beside me who has more experience. I don't know why I have a mental block when it comes to these subfiles, but I struggle with it every time.

    Plus, there are too many options.... for now, I need a method to follow every time until I get the hang of it!

    Sorry; there was some venting in there. Any help with SFLDSP and SFLDSPCTL (or a "Dummies" book recommendation) will be greatly appreciated.

  • #2
    There is a book called "Subfiles in Free-Format RPG" by Kevin Vandever that maybe will help you.

    Comment


    • #3
      First rule of subfiles, always check that the F Spec for the display file has the SFile key word coded correctly and make sure you increment the subfile RRN when writing the Subfile record. I don't see you doing incrementing that on your write.

      Comment


      • #4
        Thank you. I appreciate the push in the right direction. I think some of our old programs do things in a more complicated manner than necessary!
        I hope everyone has a wonderful weekend.

        Comment

        Working...
        X