ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

how to display 2+ subfiles in one page

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

  • how to display 2+ subfiles in one page

    hello, everybody, i am back again,
    it is a good forum to ask questions......

    ok,my problem is:

    i defined 2 subfile and their control in diplay file, but in RPGLE program i don't know how to write/exfmt them so the user could see both subfile at the same time.

    this is not urgent, i just wrote a test program and try to learn more....

  • #2
    Re: how to display 2+ subfiles in one page

    you must use exfmt on one of them and read/write on the other.
    An execute format does both a write and a read (but waits for human interaction from the screen) where you can read and write all day long from within your rpg program.

    If someone has an example please post --otherwise-- I can get you one next week.

    here is one I found from here



    DDS ==>
    Code:
          *
          *  To compile:
          *
          *             CRTDSPF FILE(XXX/MULTSFL1DF) SRCFILE(XXX/QDDSSRC)
          *
          *================================================
         A                                      DSPSIZ(24 80 *DS3)
         A                                      CA03
         A                                      CA12
         A*
         A          R HEADER
         A*
         A                                      OVERLAY
         A                                  1 26'Multiple Subfiles - Over/Under'
         A                                      DSPATR(HI)
         A                                  1  3'MULTSFL1'
         A                                  1 71DATE
         A                                      EDTCDE(Y)
         A                                  2 71TIME
         A*
         A          R SFL1                      SFL
         A*
         A            DBFNAM        20   O  4  5
         A            DBMINI         1   O  4 31
         A            DBLNAM        20   O  4 37
         A*
         A*
         A          R SF1CTL                    SFLCTL(SFL1)
         A                                      SFLSIZ(0050)
         A                                      SFLPAG(0007)
         A                                      OVERLAY
         A  32                                  SFLDSP
         A                                      SFLDSPCTL
         A  31                                  SFLCLR
         A  90                                  SFLEND(*MORE)
         A            CURSOR         1   I  3  2DSPATR(ND)
         A                                  3  5'First Name'
         A                                      DSPATR(HI)
         A                                  3 30'MI'
         A                                      DSPATR(HI)
         A                                  3 37'Last Name'
         A                                      DSPATR(HI)
         A            RRN1           4S 0H      SFLRCDNBR
         A*
         A          R SFL2                      SFL
         A*

    RPG ==>

    Code:
          *
          *  To compile:
          *
          *             CRTRPGPGM PGM(XXX/SFL015RG) SRCFILE(XXX/QRPGLESRC)
          *
          *=======================================================================
         Fmultsfl1dfcf   e             workstn sfile(sfl1:rrn1)
         F                                     sfile(sfl2:rrn2)
         F                                     infds(info)
         Fsfl001lf  if   e           k disk
           
         Dinfo             ds
         D cfkey                 369    369
         D sflrrn                378    379B 0
           
         Dexit             C                   const(X'33')
         Dcancel           C                   const(X'3C')
         Denter            C                   const(X'F1')
          
         C                   exsr      sflbld
          
         c                   dou       (cfkey = exit) or (cfkey = cancel)
          
         C                   write     header
         C                   write     footer
         C                   write     sf2ctl
         C                   write     sf1ctl
         C                   read      sf2ctl
         C                   read      sf1ctl
          
         C                   select
          
         C                   when      (cfkey = exit) or (cfkey = cancel)
         C                   eval      *inlr = *on
          
         C                   endsl
          
         C                   enddo
          
          ****************************************************************
         C     sflbld        begsr
          ***************************************************************
          *
          * Load-all subfile.  Clear both subfiles before loading.
          *
         C                   eval      *in31 = *on
         C                   eval      *in41 = *on
         C                   write     sf1ctl
         C                   write     sf2ctl
         C                   eval      *in31 = *off
         C                   eval      *in41 = *off
         C                   z-add     0             rrn1
         C                   z-add     0             rrn2
          *
          * Read the records from file and load both subfiles.
          *
         C     *loval        setll     sfl001lf
         C                   read      sfl001lf
         C                   dow       not %eof
         C                   eval      rrn1 = rrn1 + 1
         C                   eval      rrn2 = rrn2 + 1
         C                   write     sfl1
         C                   write     sfl2
         C                   read      sfl001lf
         C                   enddo
          *
          * Since we are reading from the same file,
          * just check rrn1 to determine empty subfiles.
          *
         C                   if        rrn1 > 0
         C                   eval      *in32 = *on
         C                   eval      *in42 = *on
         C                   eval      rrn1  = 1
         C                   eval      rrn2  = 1
         C                   endif
          *
          * SFLEND indicator
          *
         C                   eval      *in90 = *on
          *
         C                   endsr


    Take care
    Have a great weekend
    Jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: how to display 2+ subfiles in one page

      yes, it was the exact mistake i made. yesterday i found the same sample with the one you post, it works when i ftp it to the server. but thank you all the same. :P

      Comment

      Working...
      X