midrange.com code scratchpad
Name:
SQLCursorSubfile
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
10/11/2007 04:39:38 pm
IP:
Logged
Description:
SQL Cursor loaded subfile
Code:
  1.      /*                                                                       */                     
  2.      /* Out:  2/21/06 15:06 Ver:  1.  0 Level40 CHRISTEN, DUANE J. - IT&S     */                     
  3.      /* Ref: ANIN040601 ANI Inventory/MSAG Update Process Redesign            */                     
  4.      /* DJC: Initial Program Creation                                         */                     
  5.                                                                                                      
  6.      /*   Copyright McLeod, Inc., as an unpublished work created in                                  
  7.      /*   2005.  This program is CONFIDENTIAL, unpublished work of                                   
  8.      /*   authorship.  IT IS A TRADE SECRET which is the property of                                 
  9.      /*   McLeod, Inc.  All use, disclosure, and/or reproduction not                                 
  10.      /*   specifically authorized by McLeod, Inc., is prohibited.                                    
  11.      /*   This program may also be protected under the copyright                                     
  12.      /*   and/or trade secret laws of non-U.S. countries.  All rights                                
  13.      /*   reserved.                                                                                  
  14.                                                                                                      
  15.      /*============================================================================================= 
  16.      /*   Notes                                                                                      
  17.      /*============================================================================================= 
  18.                                                                                                      
  19.      /* Compile with ACTGRP(PDR4305)                                                                 
  20.                                                                                                      
  21.      /*============================================================================================= 
  22.      /*   Control Specifications                                                                     
  23.      /*============================================================================================= 
  24.                                                                                                      
  25.      H Option(*NODEBUGIO)                                                                            
  26.                                                                                                      
  27.      /*============================================================================================= 
  28.      /*   File Specifications                                                                        
  29.      /*============================================================================================= 
  30.                                                                                                      
  31.      FMGD101000 CF   E             WorkStn IndDs(displayInd)                                         
  32.      F                                     SFile(SFMSAG1 : sflRRN1)                                  
  33.      F                                     SFile(SFMSAG2 : sflRRN1)                                  
  34.                                                                                                      
  35.      FUTPSTDINF IF   E             Disk    Rename(UTPSTDINF : UTFSTDINF)                             
  36.                                                                                                      
  37.      /*============================================================================================= 
  38.      /*   Prototype Specifications                                                                   
  39.      /*============================================================================================= 
  40.                                                                                                      
  41.       /Include QRPGCBSRC,MGR1010                                                                     
  42.       /Include QRPGCBSRC,MGR1011                                                                     
  43.                                                                                                      
  44.      D maintainMSAGData...                                                      Maintain MSAG Data   
  45.      D                 PR                                                                            
  46.      D                                7A   Value                                Action/Mode          
  47.                                                                                                      
  48.      D UTR1000         PR                  ExtPgm('UTR1000')                                         
  49.      D                               10A   Const                                                     
  50.      D                               10A   Const                                                     
  51.      D  placeHolder                        LikeDs(security)                                          
  52.                                                                                                      
  53.      D UTR1001         PR                  ExtPgm('UTR1001')                                         
  54.      D  placeHolder                        LikeDs(security)                                          
  55.      D                               10A   Const                                                     
  56.                                                                                                      
  57.       /Include QRPGCBSRC,PVS9999                                                                     
  58.       /Include QRPGCBSRC,PVS9998                                                                     
  59.       /Include QRPGCBSRC,MGS0800                                                                     
  60.                                                                                                      
  61.      /*============================================================================================= 
  62.      /*   Data Specifications                                                                        
  63.      /*============================================================================================= 
  64.                                                                                                      
  65.      /*--------------------------------------------------------------------------------------------- 
  66.      /*   Data Structure Specifications                                                              
  67.      /*--------------------------------------------------------------------------------------------- 
  68.                                                                                                      
  69.       /Include QRPGCBSRC,DQUSEC                                                                      
  70.       /Include QRPGCBSRC,DQMHSNDPM                                                                   
  71.       /Include QRPGCBSRC,DQMHRMVPM                                                                   
  72.                                                                                                      
  73.      D                SDS                                                                            
  74.      D program               334    343A                                                             
  75.      D jobName               244    253A                                                             
  76.      D userName              254    263A                                                             
  77.                                                                                                      
  78.      D security      E DS                  ExtName(W$PSECR)                                          
  79.                                                                                                      
  80.      D subfile         DS                                                                            
  81.      D  mgmsagid                      9B 0                                                           
  82.      D  houserange                   21A                                                             
  83.      D  mgstreetnm                   60A                                                             
  84.      D  mgcommnm                     32A                                                             
  85.      D  mgstreetsx                    4A                                                             
  86.      D  mgpostdir                     2A                                                             
  87.      D  mgstate                       2A                                                             
  88.                                                                                                      
  89.      D msagData      E DS                  ExtName(MGPMSAG)                                          
  90.      D                                     Prefix(D : 2)                                             
  91.                                                                                                      
  92.      /*--------------------------------------------------------------------------------------------- 
  93.      /*   Array Specifications                                                                       
  94.      /*--------------------------------------------------------------------------------------------- 
  95.                                                                                                      
  96.                                                                                                      
  97.      /*--------------------------------------------------------------------------------------------- 
  98.      /*   Indicator Specifications                                                                   
  99.      /*--------------------------------------------------------------------------------------------- 
  100.                                                                                                      
  101.      D EoSf            S               N                                                             
  102.      D BoSf            S               N                                                             
  103.                                                                                                      
  104.      D refreshSfl      S               N                                                             
  105.                                                                                                      
  106.      /*--------------------------------------------------------------------------------------------- 
  107.      /*   Display Indicator Specifications                                                           
  108.      /*--------------------------------------------------------------------------------------------- 
  109.                                                                                                      
  110.      D displayInd      DS                                                                            
  111.      D  fKeys                        26A                                        Function Keys        
  112.      D    exit                         N   OverLay(fkeys : 3)                    F3=Exit             
  113.      D    prompt                       N   OverLay(fkeys : 4)                    F4=Prompt           
  114.      D    refresh                      N   OverLay(fkeys : 5)                    F5=Refresh          
  115.      D    add                          N   OverLay(fkeys : 9)                    F9=Add              
  116.      D    viewChange                   N   OverLay(fkeys : 10)                   F10=View 1/2        
  117.      D    cancel                       N   OverLay(fkeys : 12)                   F12=Cancel          
  118.      D    pageDown                     N   OverLay(fkeys : 25)                   Page Down           
  119.      D    pageUp                       N   OverLay(fkeys : 26)                   Page Up             
  120.      D  recordAtr                    13A                                        Special Rec. atribs. 
  121.      D   screenChanged...                                                                            
  122.      D                                 N   Overlay(recordAtr : 1)                *IN27               
  123.      D   sflDsp                        N   OverLay(recordAtr : 4)                *IN30               
  124.      D   sflDspCtl                     N   OverLay(recordAtr : 5)                *IN31               
  125.      D   sflEnd                        N   OverLay(recordAtr : 6)                *IN32               
  126.      D   msgSflEnd                     N   OverLay(recordAtr : 7)                MsgSFL SFLEND *IN33 
  127.      D   sflNxtChg                     N   OverLay(recordAtr : 12)               *IN38               
  128.      D  editError                    20A                                        Field error indictor 
  129.      D   fieldError                    N   Overlay(editError : 1)                *IN40 - *IN59       
  130.      D                                     Dim(20)                                                   
  131.      D   optionError                   N   OverLay(editError : 1)                 *IN40              
  132.      D  fieldAtr                     20A                                        Special field atribs 
  133.      D   sflHome                       N   OverLay(fieldAtr : 1)                 *IN60               
  134.      D   optionModified...                                                                           
  135.      D                                 N   OverLay(fieldAtr : 5)                 *IN64               
  136.      D   ptSKeyModified...                                                                           
  137.      D                                 N   OverLay(fieldAtr : 6)                 *IN65               
  138.      D   ptAddrModified...                                                                           
  139.      D                                 N   OverLay(fieldAtr : 7)                 *IN66               
  140.      D  fileAtr                      20A                                        Special file atribs. 
  141.      D   displayF2                     N   OverLay(fileAtr : 1)                  *IN80               
  142.                                                                                                      
  143.      /*--------------------------------------------------------------------------------------------- 
  144.      /*   Standalone Data Specifications                                                             
  145.      /*--------------------------------------------------------------------------------------------- 
  146.                                                                                                      
  147.      D recordFound     S             10I 0                                                           
  148.                                                                                                      
  149.      D screen          S             10I 0                                                           
  150.      D saveOption      S              1A                                                             
  151.                                                                                                      
  152.      D sflRRN1         S              4P 0                                                           
  153.      D sflPgmQ         S             10A   Inz('*')                                                  
  154.      D sflPage         S             10I 0 Inz(13)                                                   
  155.      D sflLength       S             10I 0                                                           
  156.                                                                                                      
  157.      D relative        S             10I 0                                                           
  158.      D cursorToExec    S             10I 0                                                           
  159.                                                                                                      
  160.      D optionValue     S              1A                                                             
  161.                                                                                                      
  162.      /*--------------------------------------------------------------------------------------------- 
  163.      /*   Constant Specifications                                                                    
  164.      /*--------------------------------------------------------------------------------------------- 
  165.                                                                                                      
  166.                                                                                                      
  167.      /*============================================================================================= 
  168.      /*   Program *Entry                                                                             
  169.      /*============================================================================================= 
  170.                                                                                                      
  171.      D MGR1010         PI                                                                            
  172.      D  msagId                       10I 0 Const                                                     
  173.                                                                                                      
  174.      /*============================================================================================= 
  175.      /*   SQL Specifications                                                                         
  176.      /*============================================================================================= 
  177.                                                                                                      
  178.      C/Exec Sql                                                                                      
  179.      C+ declare snmCursor scroll cursor for                                                          
  180.      C+ select mgmsagid, char(mglowhn || '-' || trim(mghighhn), 21),                                 
  181.      C+        mgstreetnm, mgcommnm, mgstreetsx, mgpostdir, mgstate                                  
  182.      C+ from mgpmsag                                                                                 
  183.      C+ where mgstreetnm like trim(:ptstreetnm)                                                      
  184.      C+ order by mgstreetnm, mgstate, mgcommnm                                                       
  185.      C+ for read only                                                                                
  186.      C/End-Exec                                                                                      
  187.                                                                                                      
  188.      C/Exec Sql                                                                                      
  189.      C+ declare ctycursor scroll cursor for                                                          
  190.      C+ select mgmsagid, char(mglowhn || '-' || trim(mghighhn), 21),                                 
  191.      C+        mgstreetnm, mgcommnm, mgstreetsx, mgpostdir, mgstate                                  
  192.      C+ from mgpmsag                                                                                 
  193.      C+ where mgcommnm like trim(:ptcommnm) and                                                      
  194.      C+       mgstreetnm like trim(:ptstreetnm)                                                      
  195.      C+ order by mgcommnm, mgstreetnm, mgstate                                                       
  196.      C+ for read only                                                                                
  197.      C/End-Exec                                                                                      
  198.                                                                                                      
  199.      C/Exec Sql                                                                                      
  200.      C+ declare stctysnmCursor scroll cursor for                                                     
  201.      C+ select mgmsagid, char(mglowhn || '-' || trim(mghighhn), 21),                                 
  202.      C+        mgstreetnm, mgcommnm, mgstreetsx, mgpostdir, mgstate                                  
  203.      C+ from mgpmsag                                                                                 
  204.      C+ where mgstate = :ptstate and                                                                 
  205.      C+       mgcommnm like trim(:ptcommnm) and                                                      
  206.      C+       mgstreetnm like trim(:ptstreetnm)                                                      
  207.      C+ order by mgstate, mgcommnm, mgstreetnm                                                       
  208.      C+ for read only                                                                                
  209.      C/End-Exec                                                                                      
  210.                                                                                                      
  211.      C/Exec Sql                                                                                      
  212.      C+ declare keycursor scroll cursor for                                                          
  213.      C+ select mgmsagid, char(mglowhn || '-' || trim(mghighhn), 21),                                 
  214.      C+        mgstreetnm, mgcommnm, mgstreetsx, mgpostdir, mgstate                                  
  215.      C+ from mgpmsag                                                                                 
  216.      C+ where mgmsagid = :ptmsagid                                                                   
  217.      C+ for read only                                                                                
  218.      C/End-Exec                                                                                      
  219.                                                                                                      
  220.      /*============================================================================================= 
  221.      /* MainLine                                                                                     
  222.      /*============================================================================================= 
  223.                                                                                                      
  224.       /Free                                                                                          
  225.                                                                                                      
  226.        ExSr initialize;                                                                              
  227.                                                                                                      
  228.        displayInd = *ALL'0';                                                                         
  229.        displayF2= *ON;                                                                               
  230.                                                                                                      
  231.        ExSr clearSfl;                                                                                
  232.                                                                                                      
  233.        BoSf = *ON;                                                                                   
  234.        EoSf = *ON;                                                                                   
  235.                                                                                                      
  236.        If %Parms >= 1 and                                                                            
  237.          msagId <> 0;                                                                                
  238.           PTMSAGID = msagid;                                                                         
  239.           ptSKeyModified = *ON;                                                                      
  240.           ExSr positionTo;                                                                           
  241.        EndIf;                                                                                        
  242.                                                                                                      
  243.        DoU exit or cancel;                                                                           
  244.                                                                                                      
  245.           ExSr prepareDisplay;                                                                       
  246.                                                                                                      
  247.           Write SCMSG;                                                                               
  248.           Write HEADER;                                                                              
  249.           Write PTHEADER;                                                                            
  250.                                                                                                      
  251.           If screen = 1;                                                                             
  252.              ExFmt SCMSAG1;                                                                          
  253.                                                                                                      
  254.           Else;                                                                                      
  255.              ExFmt SCMSAG2;                                                                          
  256.           EndIf;                                                                                     
  257.                                                                                                      
  258.           Read PTHEADER;                                                                             
  259.                                                                                                      
  260.           /Include QRPGCBSRC,CQMHRMVPM                                                               
  261.                                                                                                      
  262.           Select;                                                                                    
  263.                                                                                                      
  264.           When exit or cancel;                                                                       
  265.              Leave;                                                                                  
  266.                                                                                                      
  267.           When refresh;                                                                              
  268.             ExSr refreshScreen;                                                                      
  269.                                                                                                      
  270.           When screenChanged;                                                                        
  271.              ExSr nextChanged;                                                                       
  272.              ExSr positionTo;                                                                        
  273.                                                                                                      
  274.           When pageDown;                                                                             
  275.              ExSr nextChanged;                                                                       
  276.              ExSr rollDown;                                                                          
  277.                                                                                                      
  278.           When pageUp;                                                                               
  279.              ExSr nextChanged;                                                                       
  280.              ExSr rollUp;                                                                            
  281.                                                                                                      
  282.           When viewChange;                                                                           
  283.              ExSr changeView;                                                                        
  284.                                                                                                      
  285.           When add;                                                                                  
  286.              maintainMSAGData('Add');                                                                
  287.                                                                                                      
  288.                                                                                                      
  289.           Other;                                                                                     
  290.              ExSr nextChanged;                                                                       
  291.                                                                                                      
  292.           EndSl;                                                                                     
  293.                                                                                                      
  294.           If refreshSfl;                                                                             
  295.              ExSr refreshScreen;                                                                     
  296.           EndIf;                                                                                     
  297.                                                                                                      
  298.        EndDo;                                                                                        
  299.                                                                                                      
  300.        ExSr closeCursor;                                                                             
  301.                                                                                                      
  302.        *INLR = *ON;                                                                                  
  303.                                                                                                      
  304.        //=========================================================================================== 
  305.        // Prepare Display                                                                            
  306.        //=========================================================================================== 
  307.                                                                                                      
  308.        BegSr prepareDisplay;                                                                         
  309.                                                                                                      
  310.           msgSflEnd = *ON;                                                                           
  311.           sndPm_Msg_Id = 'GEN0005';                                                                  
  312.           /Include QRPGCBSRC,CQMHSNDPM                                                               
  313.                                                                                                      
  314.           TIME = %Time;                                                                              
  315.           DAY = %SubDt(%Date : *D);                                                                  
  316.                                                                                                      
  317.           sflEnd = EoSf;                                                                             
  318.                                                                                                      
  319.           FKEYLINE = 'F3=Exit   F5=Refresh   F9=Add';                                                
  320.                                                                                                      
  321.           If screen = 1;                                                                             
  322.              FKEYLINE = %Trim(FKEYLINE) + '   F10=View 1   F12=Cancel';                              
  323.                                                                                                      
  324.           Else;                                                                                      
  325.              FKEYLINE = %Trim(FKEYLINE) + '   F10=View 2   F12=Cancel';                              
  326.           EndIf;                                                                                     
  327.                                                                                                      
  328.        EndSr;                                                                                        
  329.                                                                                                      
  330.        //=========================================================================================== 
  331.        // Position To                                                                                
  332.        //=========================================================================================== 
  333.                                                                                                      
  334.        BegSr positionTo;                                                                             
  335.                                                                                                      
  336.           displayF2 = *ON;                                                                           
  337.                                                                                                      
  338.           Select;                                                                                    
  339.                                                                                                      
  340.           When ptSKeyModified and                                                                    
  341.             PTMSAGID > 0;                                                                            
  342.              ExSr closeCursor;                                                                       
  343.              cursorToExec = 4;                                                                       
  344.              displayF2 = *OFF;                                                                       
  345.              PTSTATE = *BLANKS;                                                                      
  346.              PTCOMMNM = *BLANKS;                                                                     
  347.              PTSTREETNM = *BLANKS;                                                                   
  348.                                                                                                      
  349.              ExSr openCursor;                                                                        
  350.              ExSr setBefore;                                                                         
  351.              ExSr rollDown;                                                                          
  352.                                                                                                      
  353.           When ptAddrModified and                                                                    
  354.             PTSTATE <> *BLANKS;                                                                      
  355.              ExSr closeCursor;                                                                       
  356.              cursorToExec = 3;                                                                       
  357.              PTMSAGID = 0;                                                                           
  358.                                                                                                      
  359.              PTCOMMNM = %Trim(PTCOMMNM) + '%';                                                       
  360.              PTSTREETNM = %Trim(PTSTREETNM) + '%';                                                   
  361.                                                                                                      
  362.              ExSr openCursor;                                                                        
  363.              ExSr setBefore;                                                                         
  364.              ExSr rollDown;                                                                          
  365.                                                                                                      
  366.              PTCOMMNM = %XLate('%' : ' ' : PTCOMMNM);                                                
  367.              PTSTREETNM = %XLate('%' : ' ' : PTSTREETNM);                                            
  368.                                                                                                      
  369.           When ptAddrModified and                                                                    
  370.             PTCOMMNM <> *BLANKS;                                                                     
  371.              ExSr closeCursor;                                                                       
  372.              cursorToExec = 2;                                                                       
  373.              PTMSAGID = 0;                                                                           
  374.                                                                                                      
  375.              PTCOMMNM = %Trim(PTCOMMNM) + '%';                                                       
  376.              PTSTREETNM = %Trim(PTSTREETNM) + '%';                                                   
  377.                                                                                                      
  378.              ExSr openCursor;                                                                        
  379.              ExSr setBefore;                                                                         
  380.              ExSr rollDown;                                                                          
  381.                                                                                                      
  382.              PTCOMMNM = %XLate('%' : ' ' : PTCOMMNM);                                                
  383.              PTSTREETNM = %XLate('%' : ' ' : PTSTREETNM);                                            
  384.                                                                                                      
  385.           When ptAddrModified and                                                                    
  386.             PTSTREETNM <> *BLANKS;                                                                   
  387.                                                                                                      
  388.              ExSr closeCursor;                                                                       
  389.              cursorToExec = 1;                                                                       
  390.              PTMSAGID = 0;                                                                           
  391.                                                                                                      
  392.              PTSTREETNM = %Trim(PTSTREETNM) + '%';                                                   
  393.                                                                                                      
  394.              ExSr openCursor;                                                                        
  395.              ExSr setBefore;                                                                         
  396.              ExSr rollDown;                                                                          
  397.                                                                                                      
  398.              PTSTREETNM = %XLate('%' : ' ' : PTSTREETNM);                                            
  399.                                                                                                      
  400.           Other;                                                                                     
  401.              If cursorToExec <> 0;                                                                   
  402.                 ExSr closeCursor;                                                                    
  403.                 cursorToExec = 0;                                                                    
  404.              EndIf;                                                                                  
  405.                                                                                                      
  406.           EndSl;                                                                                     
  407.                                                                                                      
  408.        EndSr;                                                                                        
  409.                                                                                                      
  410.        //=========================================================================================== 
  411.        // Refresh Screen                                                                             
  412.        //=========================================================================================== 
  413.                                                                                                      
  414.        BegSr refreshScreen;                                                                          
  415.                                                                                                      
  416.           If sflDsp;                                                                                 
  417.              sflRRN1 = 1;                                                                            
  418.                                                                                                      
  419.              Chain sflRRN1 SFMSAG1;                                                                  
  420.                                                                                                      
  421.              EoSf = *OFF;                                                                            
  422.                                                                                                      
  423.              ExSr setBefore;                                                                         
  424.              ExSr rollDown;                                                                          
  425.           EndIf;                                                                                     
  426.                                                                                                      
  427.        EndSr;                                                                                        
  428.                                                                                                      
  429.        //=========================================================================================== 
  430.        // Next Changed                                                                               
  431.        //=========================================================================================== 
  432.                                                                                                      
  433.        BegSr NextChanged;                                                                            
  434.                                                                                                      
  435.           If sflDsp;                                                                                 
  436.              refreshSfl = *OFF;                                                                      
  437.                                                                                                      
  438.              If screen = 1;                                                                          
  439.                 ReadC SFMSAG1;                                                                       
  440.                                                                                                      
  441.              Else;                                                                                   
  442.                 ReadC SFMSAG2;                                                                       
  443.              EndIf;                                                                                  
  444.                                                                                                      
  445.              DoW Not %EoF(MGD101000);                                                                
  446.                                                                                                      
  447.                 optionValue = OPTION;                                                                
  448.                                                                                                      
  449.                 If screen = 1;                                                                       
  450.                    Chain sflRrn1 SFMSAG2;                                                            
  451.                                                                                                      
  452.                 Else;                                                                                
  453.                    Chain sflRrn1 SFMSAG1;                                                            
  454.                 EndIf;                                                                               
  455.                                                                                                      
  456.                 Select;                                                                              
  457.                                                                                                      
  458.                 When optionValue = '2';                                                              
  459.                    OPTION = ' ';                                                                     
  460.                    refreshSfl = *ON;                                                                 
  461.                    maintainMSAGData('Change');                                                       
  462.                                                                                                      
  463.                 When optionValue = '3';                                                              
  464.                    OPTION = ' ';                                                                     
  465.                    refreshSfl = *ON;                                                                 
  466.                    maintainMSAGData('Copy');                                                         
  467.                                                                                                      
  468.                 When optionValue = '4';                                                              
  469.                    OPTION = ' ';                                                                     
  470.                    refreshSfl = *ON;                                                                 
  471.       /End-Free                                                                                      
  472.      C/Exec Sql                                                                                      
  473.      C+ select 1 into :recordFound                                                                   
  474.      C+ from oppaddx                                                                                 
  475.      C+ where axmsagskey = :mgmsagid                                                                 
  476.      C+ fetch first 1 rows only                                                                      
  477.      C/End-Exec                                                                                      
  478.       /Free                                                                                          
  479.                    If sqlErrorTrap(sqlcod : 'Select' : 'OPPADDX' : sqlstt) =                         
  480.                        100;                                                                          
  481.       /End-Free                                                                                      
  482.      C/Exec Sql                                                                                      
  483.      C+ select 1 into :recordFound                                                                   
  484.      C+ from pdpe911                                                                                 
  485.      C+ where e9pkey = :mgmsagid                                                                     
  486.      C+ fetch first 1 rows only                                                                      
  487.      C/End-Exec                                                                                      
  488.       /Free                                                                                          
  489.                       If sqlErrorTrap(sqlcod : 'Select' : 'PDPE911' : sqlstt) =                      
  490.                           100;                                                                       
  491.                          maintainMSAGData('Delete');                                                 
  492.                                                                                                      
  493.                       Else;                                                                          
  494.                          optionError = *ON;                                                          
  495.                          sflNxtChg = *ON;                                                            
  496.                          sndPm_Msg_Id = 'PVMF011';                                                   
  497.                          %SubSt(sndPm_Data : 1 : 28) = x'0007' + 'MGPMSAG' +                         
  498.                            x'0007' + 'PDPE911' + x'0008' + 'Deletion';                               
  499.                          /Include QRpgCbSrc,DQMhSndPm                                                
  500.                       EndIf;                                                                         
  501.                                                                                                      
  502.                    Else;                                                                             
  503.                       optionError = *ON;                                                             
  504.                       sflNxtChg = *ON;                                                               
  505.                       sndPm_Msg_Id = 'PVMF011';                                                      
  506.                       %SubSt(sndPm_Data : 1 : 28) = x'0007' + 'MGPMSAG' +                            
  507.                         x'0007' + 'OPPADDX' + x'0008' + 'Deletion';                                  
  508.                       /Include QRpgCbSrc,DQMhSndPm                                                   
  509.                    EndIf;                                                                            
  510.                                                                                                      
  511.                 When optionValue = '5';                                                              
  512.                    OPTION = ' ';                                                                     
  513.                    maintainMSAGData('Display');                                                      
  514.                                                                                                      
  515.                 When optionValue = '8';                                                              
  516.                    OPTION = ' ';                                                                     
  517.                    MGR1011(MGMSAGID);                                                                
  518.                                                                                                      
  519.                 Other;                                                                               
  520.                    optionError = *ON;                                                                
  521.                    sflNxtChg = *ON;                                                                  
  522.                                                                                                      
  523.                    SndPm_Msg_Id = 'PVMAE80';                                                         
  524.                    %SubSt(SndPM_Data : 1 : 5) = x'0001' + OPTION + x'0000';                          
  525.                    /Include QRpgCbSrc,CQMhSndPm                                                      
  526.                                                                                                      
  527.                 EndSl;                                                                               
  528.                                                                                                      
  529.                 If sflRrn1 = 1;                                                                      
  530.                    sflHome = *ON;                                                                    
  531.                                                                                                      
  532.                 Else;                                                                                
  533.                    sflHome = *OFF;                                                                   
  534.                 EndIf;                                                                               
  535.                                                                                                      
  536.                 Update SFMSAG1;                                                                      
  537.                 Update SFMSAG2;                                                                      
  538.                                                                                                      
  539.                 optionError = *OFF;                                                                  
  540.                 sflNxtChg = *OFF;                                                                    
  541.                                                                                                      
  542.                 If screen = 1;                                                                       
  543.                    ReadC SFMSAG1;                                                                    
  544.                                                                                                      
  545.                 Else;                                                                                
  546.                    ReadC SFMSAG2;                                                                    
  547.                 EndIf;                                                                               
  548.              EndDo;                                                                                  
  549.                                                                                                      
  550.           EndIf;                                                                                     
  551.                                                                                                      
  552.        EndSr;                                                                                        
  553.                                                                                                      
  554.        //=========================================================================================== 
  555.        // Change View                                                                                
  556.        //=========================================================================================== 
  557.                                                                                                      
  558.        BegSr changeView;                                                                             
  559.                                                                                                      
  560.           If sflDsp;                                                                                 
  561.              If screen = 1;                                                                          
  562.                 ReadC SFMSAG1;                                                                       
  563.                                                                                                      
  564.              Else;                                                                                   
  565.                 ReadC SFMSAG2;                                                                       
  566.              EndIf;                                                                                  
  567.                                                                                                      
  568.              DoW Not %Eof(MGD101000);                                                                
  569.                 saveOption = OPTION;                                                                 
  570.                 OPTION = *BLANKS;                                                                    
  571.                                                                                                      
  572.                 If screen = 1;                                                                       
  573.                    Update SFMSAG1;                                                                   
  574.                    Chain SflRrn1 SFMSAG2;                                                            
  575.                                                                                                      
  576.                    OPTION = saveOption;                                                              
  577.                    optionModified = *ON;                                                             
  578.                                                                                                      
  579.                    Update SFMSAG2;                                                                   
  580.                                                                                                      
  581.                    ReadC SFMSAG1;                                                                    
  582.                                                                                                      
  583.                 Else;                                                                                
  584.                    Update SFMSAG2;                                                                   
  585.                    Chain SflRrn1 SFMSAG1;                                                            
  586.                                                                                                      
  587.                    OPTION = saveOption;                                                              
  588.                    optionModified = *ON;                                                             
  589.                                                                                                      
  590.                    Update SFMSAG1;                                                                   
  591.                                                                                                      
  592.                    ReadC SFMSAG1;                                                                    
  593.                 EndIf;                                                                               
  594.              EndDo;                                                                                  
  595.                                                                                                      
  596.              If screen = 1;                                                                          
  597.                 screen = 2;                                                                          
  598.                                                                                                      
  599.              Else;                                                                                   
  600.                 screen = 1;                                                                          
  601.              EndIf;                                                                                  
  602.           EndIf;                                                                                     
  603.                                                                                                      
  604.           optionModified = *OFF;                                                                     
  605.                                                                                                      
  606.        EndSr;                                                                                        
  607.                                                                                                      
  608.        //=========================================================================================== 
  609.        // rollDown                                                                                   
  610.        //=========================================================================================== 
  611.                                                                                                      
  612.        BegSr rollDown;                                                                               
  613.                                                                                                      
  614.           If EoSf;                                                                                   
  615.              sndPM_Msg_Id = 'GEN0429';                                                               
  616.              /Include QRPGCBSRC,CQMHSNDPM                                                            
  617.                                                                                                      
  618.           Else;                                                                                      
  619.              refreshSfl = *OFF;                                                                      
  620.              BoSf = *OFF;                                                                            
  621.                                                                                                      
  622.              ExSr readNext;                                                                          
  623.                                                                                                      
  624.              If sqlCod = 100;                                                                        
  625.                 ExSr SetAfter;                                                                       
  626.                 ExSr readPrevious;                                                                   
  627.              EndIf;                                                                                  
  628.                                                                                                      
  629.              ExSr clearSFL;                                                                          
  630.                                                                                                      
  631.              sflRRN1 = 0;                                                                            
  632.                                                                                                      
  633.              DoW sqlCod <> 100 and                                                                   
  634.                sflRRN1 < sflPage;                                                                    
  635.                                                                                                      
  636.                 sflRRN1 += 1;                                                                        
  637.                            
© 2004-2019 by midrange.com generated in 0.014s valid xhtml & css