ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Gone Wrong somewhere....

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

  • Gone Wrong somewhere....

    Hey guys,

    I have this little program that I need to load a subfile for. If the subfile is empty then it blows up. Now I know that you just turn off the subfile display to fix that, but that does't even work. This is the error.....

    Session or device error occurred in file SLS340DF (C G D F).

    here is the code

    PHP Code:
         H
          
    *******************************************************************
          *
    Program NameSLS330R.SQLRPGLE                                   *
          *                                                                 *
          *
    Purpose:  Order Follow Up Inquiry/Report program.                *
          *                                                                 *
          *                                                                 *
          *
    Written by:  Bryce Martin       5/16/2007     Project#:          *
          
    *                                                                 *
          *************************
    MAINTENANCE LIST**************************
          * 
    99/99/99  -  FML      PROJECT#:                                 *
          
    *     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX                *
          *******************************************************************
          *******************************************************************


         
    FSLS340DF  CF   E             WORKSTN SFILE(SFL1:MRRRN)
         
    FSLS340PF  UF A E           K DISK
         FRDSL02    
    IF   E           K DISK
         FSSML02    
    IF   E           K DISK
         F
         F
         F
         D fkeys           DS            99
         D  
    EXIT                   3      3N
         D  
    RETURN                12     12N
         D
         D  SFLDSP                31     31N
         D  SFLDSPCTL             32     32N
         D  SFLCLR                33     33N
         D  SFLEND                34     34N
         D  ERRACTION             40     40N
         D  PCACTION              41     41N
         D  ERRCOMP               42     42N
         D  PCCOMP                43     43N
         D  ERRORD                44     44N
         D  PCORD                 45     45N
         D  ERRREP                46     46N
         D  PCREP                 47     47N
         D  ERRALLOC              48     48N
         D  PCALLOC               49     49N
         D
         D
         D
         D
         D SAVERRN         S              5S 0
         D ID              S              1A   INZ
    ('R')
         
    D COMP1           S              2S 0 INZ(1)
         
    D PREFIX          S              2A


         C
         C     RDSKEY        KLIST
         C                   KFLD                    ID
         C                   KFLD                    COMP1
         C                   KFLD                    PREFIX
         C
         C
         C
          
    ****************************************************************
          * 
    LOADSCR1 ROUTINE --------------------------------------------*
          * 
    This routine will call the subroutines to clearload and    *
          * 
    display the subfile for screen 2                             *
          ****************************************************************
         
    C                   EXSR      CLRSFL
         C                   EXSR      LOADSFL
         C                   
    IF        MRRRN <> *HIVAL
         C                   EXSR      DSPSCREEN
         C                   
    ENDIF
         
    C
         C                   
    EVAL      *INLR = *ON


          
    ****************************************************************
          * 
    CLRSFL ROUTINE ----------------------------------------------*
          * 
    This routine will clear the subfile for processing           *
          ****************************************************************
         
    C     CLRSFL        BEGSR
         C                   MOVE      
    *OFF          SFLDSP
         C                   MOVE      
    *OFF          SFLDSPCTL
         C                   MOVE      
    *ON           SFLCLR
         C                   WRITE     CTL1
         C                   MOVE      
    *OFF          SFLEND
         C                   
    EVAL      MRRRN 0
         C                   
    EVAL      RRN 1
         C                   
    EVAL      SAVERRN 0
         C                   MOVE      
    *ON           SFLDSPCTL
         C                   MOVE      
    *OFF          SFLCLR
         C                   ENDSR
         C
          
    ****************************************************************
          * 
    LOADSFL ROUTINE ---------------------------------------------*
          * 
    This will load the subfile for display                       *
          ****************************************************************
         
    C     LOADSFL       BEGSR
         C
         C     
    *HIVAL        SETLL     SLS340PF
         C                   READ      SLS340PF
         C
         C                   DOW       NOT 
    %EOF(SLS340PF)
         
    C
         C                   MOVE      SPCOMP        COMPANYSF
         C                   
    EVAL      ORDERSF SPORD
         C                   
    EVAL      REPSF SPREP
         C                   
    EVAL      ALLOCSF SPALLOC
         C                   
    EVAL      ENTDATE SPEDTE
         C                   
    EVAL      ENTTIME SPETIME
         C                   
    EVAL      ENTUSER SPEUSER
         C
         C                   
    IF        MRRRN 9999
         C                   
    EVAL      MRRRN MRRRN  1
         C                   WRITE     SFL1
         C                   
    ELSE
         
    C                   EVAL      MSGTXT 'OVER 9999 RECORDS SELECTED, +
         C                             PLEASE SELECT A SMALLER RANGE'
         
    C                   MOVE      *HIVAL        MRRRN
         C                   
    ENDIF
         
    C
         C                   READE     SLS340PF
         C
         C                   ENDDO
         C
         C
         C                   
    EVAL      SFLEND = *ON
         C
         C
         C                   
    IF        MRRRN AND MRRRN <> *HIVAL
         C                   MOVE      
    *ON           SFLDSP
         C                   
    EVAL      SAVERRN MRRRN
         C                   
    EVAL      MRRRN 1
         C                   
    ENDIF
         
    C
         C                   ENDSR
         C
          
    ****************************************************************
          * 
    DSPSCREEN ROUTINE -------------------------------------------*
          * 
    This will display the screen                                 *
          ****************************************************************
         
    C     DSPSCREEN     BEGSR
         C
         C                   MOVE      
    *BLANKS       MSGTXT
         C
         C                   DOW       NOT 
    EXIT
         
    C
         C                   
    IF        CURSPOS OR CURSPOS SAVERRN
         C                   
    EVAL      CURSPOS 1
         C                   MOVE      CURSPOS       RRN
         C                   
    ENDIF
         
    C
         C                   WRITE     FOOTER
         C                   EXFMT     CTL1
         C                   MOVE      
    *BLANKS       MSGTXT
         C
         C                   
    IF        EXIT
         
    C                   LEAVE
         C                   
    ENDIF
         
    C
         C
         C                   
    IF        ACTION <> *ZEROS
         C
         C                   SELECT
          
    *CREATE A NEW ENTRY
         C                   WHEN      ACTION 
    1
         C
         C                   
    IF        ORD = *ZEROS
         C                   MOVE      
    *ON           PCORD
         C                   MOVE      
    *ON           ERRORD
         C                   
    EVAL      MSGTXT 'You must enter an Order Number'
         
    C                   ENDIF
         
    C
         C                   
    IF        ORD <> *ZEROS AND MSGTXT = *BLANKS
         C     ORD           CHAIN     SLS340PF
         C                   
    IF        %FOUND(SLS340PF)
         
    C                   MOVE      *ON           PCORD
         C                   MOVE      
    *ON           ERRORD
         C                   
    EVAL      MSGTXT 'Invalid Entry.  Order Already -
         C                             Exists'
         
    C                   ELSEIF    NOT %FOUND(SLS340PF)
         
    C
         C                   
    IF        COMP = *BLANKS AND MSGTXT = *BLANKS
         C                   MOVE      
    *ON           PCCOMP
         C                   MOVE      
    *ON           ERRCOMP
         C                   
    EVAL      MSGTXT 'You must enter a company code.'
         
    C
         C                   
    ELSEIF    COMP <> *BLANKS AND MSGTXT = *BLANKS
         C                   MOVE      COMP          PREFIX
         C     RDSKEY        CHAIN     RDSL02
         C                   
    IF        NOT %FOUND(RDSL02)
         
    C                   MOVE      *ON           PCCOMP
         C                   MOVE      
    *ON           ERRCOMP
         C                   
    EVAL      MSGTXT 'Invalid Company Code.  Please try -
         C                             agian.'
         
    C                   ENDIF
         
    C                   ENDIF
         
    C
         C                   
    IF        REP = *ZEROS AND MSGTXT = *BLANKS
         C                   MOVE      
    *ON           PCREP
         C                   MOVE      
    *ON           ERRREP
         C                   
    EVAL      MSGTXT 'You must enter a Rep #.'
         
    C                   ELSEIF    REP <> *ZEROS AND MSGTXT = *BLANKS
         C     REP           CHAIN     SSML02
         C                   
    IF        NOT %FOUND(SSML02)
         
    C                   MOVE      *ON           PCREP
         C                   MOVE      
    *ON           ERRREP
         C                   
    EVAL      MSGTXT 'Invalid Rep. Please Try Again.'
         
    C                   ENDIF
         
    C                   ENDIF
         
    C
         C                   
    IF        ALLOC = *ZEROS AND MSGTXT = *BLANKS
         C                   MOVE      
    *ON           PCALLOC
         C                   MOVE      
    *ON           ERRALLOC
         C                   
    EVAL      MSGTXT 'You must enter an Allocation %.'
         
    C                   ENDIF
         
    C
         C
         C                   
    ENDIF
         
    C                   ENDIF
         
    C
         C
    *                  IF        MSGTXT = *BLANKS
         C
    *    COMP          CHAIN
         C
          
    *REVISE AN EXISTING ENTRY
         C                   WHEN      ACTION 
    2
         C                   EXSR      CHKORD
         C
          
    *DELETE AN EXISTING ENTRY
         C                   WHEN      ACTION 
    4
         C                   EXSR      CHKORD
         C
          
    *DISPLAY ALL ENTRY DETAILS
         C                   WHEN      ACTION 
    5
         C                   EXSR      CHKORD
         C
          
    *POSITION TO ENTRY IN SUBFILE
         C                   WHEN      ACTION 
    8
         C                   EXSR      CHKORD
         C
         C                   OTHER
          
    *INVALID ACTION CODE
         C                   ENDSL
         C                   
    ENDIF
         
    C
         C
         C
    *                  MOVE      CURSPOS       MRRRN
         C
    *    1             DO        SAVERRN       X
         C
    *                  MOVE      *BLANKS       MSGTXT
         C
    *                  MOVE      *OFF          BADSEL
         C
    *    X             CHAIN     SFL1
         C
         C                   ENDDO
         C                   ENDSR
         C
         C
         C
         C
          
    ****************************************************************
          * 
    CHKORD ROUTINE ----------------------------------------------*
          * 
    This will check to see if an order already exists in the file*
          ****************************************************************
         
    C     CHKORD        BEGSR
         C     ORD           CHAIN     SLS340PF
         C                   
    IF        NOT %FOUND(SLS340PF)
         
    C                   MOVE      *ON           PCORD
         C                   MOVE      
    *ON           ERRORD
         C                   
    EVAL      MSGTXT 'Invalid Order'
         
    C                   ENDIF
         
    C                   ENDSR
         C 



    PHP Code:
         A*%%TS  DD  20070824  092147  bmartin     REL-V5.0.1  WDSc
         A
    *%%FD SpecRep Allocation
         A
    *%%EC
         A                                      DSPSIZ
    (24 80 *DS3)
         
    A                                      PRINT(*LIBL/QSYSPRT)
         
    A                                      INDARA
         A          R FOOTER
         A
    *%%TS  DD  20070824  092147  bmartin     REL-V5.0.1  WDSc
         A            MSGTXT        70A  O 23  1DSPATR
    (HI)
         
    A                                 24  1'F3=Exit  F12=Cancel'
         
    A                                      COLOR(BLU)
         
    A          R SFL1
         A
    *%%TS  DD  20070824  092147  bmartin     REL-V5.0.1  WDSc
         A                                      SFL
         A            ACTIONSF       1Y 0B  9  3EDTCDE
    (3)
         
    A            COMPANYSF      2A  B  9  8
         A            ORDERSF        6Y 0B  9 13EDTCDE
    (3)
         
    A            REPSF          6Y 0B  9 21EDTCDE(3)
         
    A            ALLOCSF        3Y 0B  9 29EDTCDE(3)
         
    A            ENTDATE        8Y 0O  9 35EDTCDE(3)
         
    A            ENTTIME        6Y 0O  9 44EDTCDE(3)
         
    A            ENTUSER        8A  O  9 51
         A
    *%%GP UNTITLED   02
         A          R CTL1
         A
    *%%TS  DD  20070824  092147  bmartin     REL-V5.0.1  WDSc
         A                                      SFLCTL
    (SFL1)
         
    A                                      SFLSIZ(12)
         
    A                                      SFLPAG(11)
         
    A                                      CA03(03 'F3=EXIT')
         
    A                                      OVERLAY
         A  31                                  SFLDSP
         A  32                                  SFLDSPCTL
         A  33                                  SFLCLR
         A  34                                  SFLEND
    (*MORE)
         
    A                                      SFLCSRRRN(&CURSPOS)
         
    A                                  1 73DATE
         A                                      EDTCDE
    (Y)
         
    A                                  1  2'SLS340R -01'
         
    A                                      COLOR(BLU)
         
    A            MSGFLD0001    38A  O  1 18MSGID(L01 9301 SSAZ03)
         
    A                                      DSPATR(HI)
         
    A            WORKSN        10A  O  1 62
         A                                  2  2SYSNAME
         A                                  2 26
    'Spec. Rep Allocation'
         
    A                                      COLOR(BLU)
         
    A                                  2 62USER
         A                                  2 73TIME
         A                                  4  2
    'Select action and press Enter.  1=-
         A                                      Create  2=Revise  4=Delete '
         
    A                                      COLOR(BLU)
         
    A                                  5  2'5=Display  8=Position To'
         
    A                                      COLOR(BLU)
         
    A                                  7  2'Act  Comp  Order    Rep   Alloc  E-
         A                                      .Date  E.Time  E.User'
         
    A                                      COLOR(WHT)
         
    A            ACTION         1Y 0B  8  3EDTCDE(3)
         
    A  40                                  DSPATR(RI)
         
    A  41                                  DSPATR(PC)
         
    A            COMP           2A  B  8  8
         A  42                                  DSPATR
    (RI)
         
    A  43                                  DSPATR(PC)
         
    A            ORD            6Y 0B  8 13EDTCDE(3)
         
    A  44                                  DSPATR(RI)
         
    A  45                                  DSPATR(PC)
         
    A            REP            6Y 0B  8 21EDTCDE(3)
         
    A  46                                  DSPATR(RI)
         
    A  47                                  DSPATR(PC)
         
    A            ALLOC          3Y 0B  8 29EDTCDE(3)
         
    A  48                                  DSPATR(RI)
         
    A  49                                  DSPATR(PC)
         
    A
         A
         A            CURSPOS        5S 0H
         A            MRRRN          4S 0H
         A            RRN            4S 0H      SFLRCDNBR
    (CURSOR)
         
    A*%%GP UNTITLED   03
         A          R DISPLAY
         A
    *%%TS  DD  20070824  092147  bmartin     REL-V5.0.1  WDSc
         A                                  1 73DATE
         A                                      EDTCDE
    (Y)
         
    A                                  1  2'SLS340R -02'
         
    A                                      COLOR(BLU)
         
    A            MSGFLD0001    38A  O  1 18MSGID(L01 9301 SSAZ03)
         
    A                                      DSPATR(HI)
         
    A            WORKSN        10A  O  1 62
         A                                  2  2SYSNAME
         A                                  2 26
    'Spec. Rep Allocation'
         
    A                                      COLOR(BLU)
         
    A                                  2 62USER
         A                                  2 73TIME
         A                                  5  2
    'Company'
         
    A                                  6  2'Order'
         
    A                                  7  2'Rep'
         
    A                                  8  2'Allocation %'
         
    A                                  9  2'Entry Date'
         
    A                                 10  2'Entry Time'
         
    A                                 11  2'Entry User'
         
    A                                 12  2'Maint. Date'
         
    A                                 13  2'Maint. Time'
         
    A                                 14  2'Maint. User'
         
    A            DSPCOMP        2A  O  5 19
         A            DSPORD         6Y 0O  6 19EDTCDE
    (3)
         
    A            DSPREP         6Y 0O  7 19EDTCDE(3)
         
    A            DSPALLOC       3Y 0O  8 19EDTCDE(3)
         
    A            DSPEDATE       8Y 0O  9 19EDTCDE(3)
         
    A            DSPETIME       6Y 0O 10 19EDTCDE(3)
         
    A            DSPEUSER       8A  O 11 19
         A            DSPMDATE       8Y 0O 12 19EDTCDE
    (3)
         
    A            DSPMTIME       6Y 0O 13 19EDTCDE(3)
         
    A            DSPMUSER       8A  O 14 19
         A                                 24  2
    'F3=Exit  F12=Cancel'
         
    A                                      COLOR(BLU)
         
    A*%%GP UNTITLED   04 

    I have other programs structured the same way and they don't blow up when the subfile is empty. I think I'm missing something but I have no idea what I'm missing...

    Thanks in advance.
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

  • #2
    Re: Gone Wrong somewhere....

    Never mind. I figured it out....

    Don't forget to declare your indicator data structure in the FSpecs
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

    Comment


    • #3
      Re: Gone Wrong somewhere....

      Can you take F10 on the error message and post that...which would help to sovle the problem quickly.
      Cheers,
      Salvi

      Comment


      • #4
        Re: Gone Wrong somewhere....

        Hi,

        Do you have some data in you physical file SLS340PF or not.

        You have to look into your load Subfile routine.

        Comment


        • #5
          Re: Gone Wrong somewhere....

          My SLS340F file was empty. which will be the first case when the program goes into production. I just forgot to put my INDDS(fkeys) in the F specs. After I put that it worked fine. just a dumb over site.
          Your future President
          Bryce

          ---------------------------------------------
          http://www.bravobryce.com

          Comment


          • #6
            Re: Gone Wrong somewhere....

            Originally posted by bryce4president View Post
            My SLS340F file was empty. which will be the first case when the program goes into production. I just forgot to put my INDDS(fkeys) in the F specs. After I put that it worked fine. just a dumb over site.
            I dont think is very nice you calling this a dumb site! But I guess everyone is
            entitled to their opinions.....and mine of you sir is that you are a baboon!
            I'm here to chew bubble gum and kick @#%@#%@#%.....and I'm all outta bubble gum !
            Yes I'm talking to you squirrel nuts.

            Comment


            • #7
              Re: Gone Wrong somewhere....

              I think the only dumb site is the one that you keep picking up those sticky fingered Kremlin girls from. It takes someone with the intelligence of a baboon to keep going back, either that, or an addiction. hmmm.....
              Your future President
              Bryce

              ---------------------------------------------
              http://www.bravobryce.com

              Comment

              Working...
              X