midrange.com code scratchpad
Name:
Initialize and Exit Subroutine Examples
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
10/09/2007 06:50:07 pm
IP:
Logged
Description:
The user was to lazy to give a description
Code:
  1.      /*                                                                       */                     
  2.      /* Out: 11/17/06  9:14 Ver:  1.  0 Level40 CHRISTEN, DUANE J. - IT&S     */                     
  3.      /* Ref: ANIN120601 ANI Inventory/Add functionality to getANI API (PVS980 */                     
  4.      /* DJC: Added function retreiveANIWithC#UH                               */                     
  5.      /*                                                                       */                     
  6.      /* Out:  8/28/06 13:38 Ver:  0.  0 Level40 CHRISTEN, DUANE J. - IT&S     */                     
  7.      /* Ref: ANIN090603 ANI Inventory/Tollfree Autocreate                     */                     
  8.      /* DJC: Initial Creation                                                 */                     
  9.                                                                                                      
  10.      /*   Copyright McLeod, Inc., as an unpublished work created in                                  
  11.      /*   2006.  This program is CONFIDENTIAL, unpublished work of                                   
  12.      /*   authorship.  IT IS A TRADE SECRET which is the property of                                 
  13.      /*   McLeod, Inc.  All use, disclosure, and/or reproduction not                                 
  14.      /*   specifically authorized by McLeod, Inc., is prohibited.                                    
  15.      /*   This program may also be protected under the copyright                                     
  16.      /*   and/or trade secret laws of non-U.S. countries.  All rights                                
  17.      /*   reserved.                                                                                  
  18.                                                                                                      
  19.      /*============================================================================================= 
  20.      /*   Notes                                                                                      
  21.      /*============================================================================================= 
  22.                                                                                                      
  23.      /* Compile with ACTGRP(PVS9800)                                                                 
  24.                                                                                                      
  25.      /*============================================================================================= 
  26.      /*   Control Specifications                                                                     
  27.      /*============================================================================================= 
  28.                                                                                                      
  29.      H NoMain                                                                                        
  30.      H ExtBinInt                                                                                     
  31.      H Option(*NODEBUGIO)                                                                            
  32.                                                                                                      
  33.      /*============================================================================================= 
  34.      /*   File Specifications                                                                        
  35.      /*============================================================================================= 
  36.                                                                                                      
  37.      FOPLUHXR6  IF   E           K Disk    UsrOpn                                                    
  38.                                                                                                      
  39.      FOPLANI1   IF   E           K Disk    UsrOpn                                                    
  40.                                                                                                      
  41.      /*============================================================================================= 
  42.      /*   Prototype Specifications                                                                   
  43.      /*============================================================================================= 
  44.                                                                                                      
  45.       /Include QRPGCBSRC,DQUSEC                                                                      
  46.       /Include QRPGCBSRC,DQMHSNDPM                                                                   
  47.       /Include QRpgCbSrc,PVS9800                                                                     
  48.       /Include QRpgCbSrc,MI_CPYBYTE                                                                  
  49.       /Include QRpgCbSrc,STRING.H                                                                    
  50.                                                                                                      
  51.       /Define PVRM9800__PROTOTYPES                                                                   
  52.       /Include QRpgCbSrc,PVRM980000                                                                  
  53.                                                                                                      
  54.      /*============================================================================================= 
  55.      /*   Data Specifications                                                                        
  56.      /*============================================================================================= 
  57.                                                                                                      
  58.      /*--------------------------------------------------------------------------------------------- 
  59.      /*   Data Structure Specifications                                                              
  60.      /*--------------------------------------------------------------------------------------------- 
  61.                                                                                                      
  62.                                                                                                      
  63.      /*--------------------------------------------------------------------------------------------- 
  64.      /*   Array Specifications                                                                       
  65.      /*--------------------------------------------------------------------------------------------- 
  66.                                                                                                      
  67.                                                                                                      
  68.      /*--------------------------------------------------------------------------------------------- 
  69.      /*   Indicator Specifications                                                                   
  70.      /*--------------------------------------------------------------------------------------------- 
  71.                                                                                                      
  72.      D globalInit      S               N                                                             
  73.                                                                                                      
  74.      /*--------------------------------------------------------------------------------------------- 
  75.      /*   Standalone Data Specifications                                                             
  76.      /*--------------------------------------------------------------------------------------------- 
  77.                                                                                                      
  78.                                                                                                      
  79.      /*--------------------------------------------------------------------------------------------- 
  80.      /*   Constant Specifications                                                                    
  81.      /*--------------------------------------------------------------------------------------------- 
  82.                                                                                                      
  83.                                                                                                      
  84.      /*############################################################################################# 
  85.      /*   retreiveANIWithC#UhUd - Retreive OPPANI record using Cst#, Unit Header/Detail              
  86.      /*############################################################################################# 
  87.                                                                                                      
  88.      P retreiveANIWithC#UhUd...                                                                      
  89.      P                 B                   Export                                                    
  90.                                                                                                      
  91.      /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
  92.      /* Procedure Interface                                                                          
  93.      /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
  94.                                                                                                      
  95.      D retreiveANIWithC#UhUd...                                                                      
  96.      D                 PI                                                                            
  97.      D  resultBase                     *   Value                                ANI Records          
  98.      D  resultFormat                 10A   Value                                Result Format        
  99.      D  customerNumber...                                                       Customer Number      
  100.      D                                7P 0 Value                                                     
  101.      D  unitHeader                    5P 0 Value                                Unit Header          
  102.      D  unitDetail                    5P 0 Value                                Unit Detail          
  103.      D  errorStructure...                                                       Error Structure      
  104.      D                                 *   Value                                                     
  105.                                                                                                      
  106.      /*============================================================================================= 
  107.      /* Procedure Data Specifications                                                                
  108.      /*============================================================================================= 
  109.                                                                                                      
  110.       /Include QRPGCBSRC,DUserCh                                                                     
  111.                                                                                                      
  112.      /*--------------------------------------------------------------------------------------------- 
  113.      /* Procedure Data Structure Specifications                                                      
  114.      /*--------------------------------------------------------------------------------------------- 
  115.                                                                                                      
  116.      D OPPANI          DS                  LikeRec(OPFANI)                                           
  117.      D                                     Based(resultBase)                                         
  118.                                                                                                      
  119.      /*--------------------------------------------------------------------------------------------- 
  120.      /* Procedure Array Specifications                                                               
  121.      /*--------------------------------------------------------------------------------------------- 
  122.                                                                                                      
  123.                                                                                                      
  124.      /*--------------------------------------------------------------------------------------------- 
  125.      /* Procedure Indicator Specifications                                                           
  126.      /*--------------------------------------------------------------------------------------------- 
  127.                                                                                                      
  128.                                                                                                      
  129.      /*--------------------------------------------------------------------------------------------- 
  130.      /* Procedure Standalone Data Specifications                                                     
  131.      /*--------------------------------------------------------------------------------------------- 
  132.                                                                                                      
  133.                                                                                                      
  134.      /*--------------------------------------------------------------------------------------------- 
  135.      /* Procedure Constant Specifications                                                            
  136.      /*--------------------------------------------------------------------------------------------- 
  137.                                                                                                      
  138.                                                                                                      
  139.      /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
  140.      /* Procedure Code                                                                               
  141.      /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
  142.                                                                                                      
  143.       /Free                                                                                          
  144.                                                                                                      
  145.        ExSr initialize;                                                                              
  146.                                                                                                      
  147.        Chain (customerNumber : unitHeader : unitDetail : 'A') OPLUHXR6;                              
  148.                                                                                                      
  149.        If Not %Found(OPLUHXR6);                                                                      
  150.           SetGt (customerNumber : unitHeader : unitDetail) OPLUHXR6;                                 
  151.           ReadPE (customerNumber : unitHeader : unitDetail) OPLUHXR6;                                
  152.                                                                                                      
  153.           If %Eof(OPLUHXR6);                                                                         
  154.              sndPm_Msg_Id = 'PVMF002';                                                               
  155.              %SubSt(sndPm_Data : 1 : 21) = 'OPPUHXR';                                                
  156.              %SubSt(sndPm_Data : 22 : 61) = x'0034' +                                                
  157.                'Customer #: ' + %Trim(%EditC(customerNumber : 'Z')) +                                
  158.                ', Unit Header: ' + %Trim(%EditC(unitHeader : 'Z')) +                                 
  159.                ', Unit Detail: ' + %Trim(%EditC(unitDetail : 'Z'));                                  
  160.              /Include QRpgCbSrc,CQMhSndPm                                                            
  161.           EndIf;                                                                                     
  162.        EndIf;                                                                                        
  163.                                                                                                      
  164.        Chain (UHCST# : UHANI : UHPIND) OPFANI OPPANI;                                                
  165.                                                                                                      
  166.        If Not %Found(OPLANI1);                                                                       
  167.              sndPm_Msg_Id = 'PVMF002';                                                               
  168.              %SubSt(sndPm_Data : 1 : 21) = 'OPPANI';                                                 
  169.              %SubSt(sndPm_Data : 22 : 61) = x'0034' +                                                
  170.                'Customer #: ' + %Trim(%EditC(UHCST# : 'Z')) +                                        
  171.                ', Ani: ' + %Trim(%EditW(UHANI : '0(  )&   -    ')) +                                 
  172.                ', Pin Id: ' + %Trim(%EditC(UHPIND : 'Z'));                                           
  173.              /Include QRpgCbSrc,CQMhSndPm                                                            
  174.        EndIf;                                                                                        
  175.                                                                                                      
  176.        ExSr exitProcedure;                                                                           
  177.                                                                                                      
  178.        //=========================================================================================== 
  179.        // Initilizing Subroutine                                                                     
  180.        //=========================================================================================== 
  181.                                                                                                      
  182.        BegSr initialize;                                                                             
  183.                                                                                                      
  184.           If Not globalInit;                                                                         
  185.              globalInit = *ON;                                                                       
  186.              sndPm_Data_Length = 500;                                                                
  187.                                                                                                      
  188.              /Include QRpgCbSrc,ZQMhSndPm                                                            
  189.           EndIf;                                                                                     
  190.                                                                                                      
  191.           /Include QRpgCbSrc,ZUserCh                                                                 
  192.                                                                                                      
  193.           If setJmp(jumpPoint) = 1;                                       // Error Jump Point        
  194.              ExSr exitProcedure;                                          // Exit on error           
  195.           EndIf;                                                                                     
  196.                                                                                                      
  197.           sndPM_Msg_Type = '*ESCAPE';                                                                
  198.                                                                                                      
  199.           userCHConditionHandler = %PAddr('PROVISIONERUSERCH003');        // Condition Handler       
  200.           registerConditionHandler(userCHConditionHandler : userCHBase : *OMIT);                     
  201.                                                                                                      
  202.           userCH.errorBase = errorStructure;                                                         
  203.           usec_Base = errorStructure;                                                                
  204.           usec_Data_Length = usec_Provided - usec_Avail_Static;                                      
  205.           usec_Data_Base = usec_Base + usec_Avail_Static;                                            
  206.                                                                                                      
  207.           %Subst(usec_Data : 1 : usec_Data_Length) = *BLANKS;                                        
  208.                                                                                                      
  209.           usec_Msg_Id = *BLANKS;                                                                     
  210.                                                                                                      
  211.           Clear OPPANI;                                                                              
  212.                                                                                                      
  213.           If Not %Open(OPLANI1);                                                                     
  214.              Open OPLANI1;                                                                           
  215.           EndIf;                                                                                     
  216.                                                                                                      
  217.           If Not %Open(OPLUHXR6);                                                                    
  218.              Open OPLUHXR6;                                                                          
  219.           EndIf;                                                                                     
  220.                                                                                                      
  221.        EndSr;                                                                                        
  222.                                                                                                      
  223.        //=========================================================================================== 
  224.        //   Exit Procedure                                                                           
  225.        //=========================================================================================== 
  226.                                                                                                      
  227.                                                                                                      
  228.        BegSr ExitProcedure;                                                                          
  229.                                                                                                      
  230.           unRegisterConditionHandler(userCHConditionHandler : *OMIT);                                
  231.                                                                                                      
  232.           /Include QRpgCbSrc,LUserCh                                                                 
  233.                                                                                                      
  234.           Return;                                                                                    
  235.                                                                                                      
  236.        EndSr;                                                                                        
  237.                                                                                                      
  238.       /End-Free                                                                                      
  239.                                                                                                      
  240.      P retreiveANIWithC#UhUd...                                                                      
  241.      P                 E                                                                             
  242.                                                                                                      
  243.      /*############################################################################################# 
  244.      /*   retreiveANIWithC#Uh  - Retreive OPPANI record using Cst#, Unit Header                      
  245.      /*############################################################################################# 
  246.                                                                                                      
  247.      P retreiveANIWithC#Uh...                                                                        
  248.      P                 B                   Export                                                    
  249.                                                                                                      
  250.      /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
  251.      /* Procedure Interface                                                                          
  252.      /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
  253.                                                                                                      
  254.      D retreiveANIWithC#Uh...                                                                        
  255.      D                 PI                                                                            
  256.      D  resultBase                     *   Value                                ANI Records          
  257.      D  resultFormat                 10A   Value                                Result Format        
  258.      D  customerNumber...                                                       Customer Number      
  259.      D                                7P 0 Value                                                     
  260.      D  unitHeader                    5P 0 Value                                Unit Header          
  261.      D  errorStructure...                                                       Error Structure      
  262.      D                                 *   Value                                                     
  263.                                                                                                      
  264.      /*============================================================================================= 
  265.      /* Procedure Data Specifications                                                                
  266.      /*============================================================================================= 
  267.                                                                                                      
  268.       /Undefine DUSERCH                                                                              
  269.       /Include QRPGCBSRC,DUserCh                                                                     
  270.                                                                                                      
  271.      /*--------------------------------------------------------------------------------------------- 
  272.      /* Procedure Data Structure Specifications                                                      
  273.      /*--------------------------------------------------------------------------------------------- 
  274.                                                                                                      
  275.      D OPPANI          DS                  LikeRec(OPFANI)                                           
  276.      D                                     Based(resultBase)                                         
  277.                                                                                                      
  278.      /*--------------------------------------------------------------------------------------------- 
  279.      /* Procedure Array Specifications                                                               
  280.      /*--------------------------------------------------------------------------------------------- 
  281.                                                                                                      
  282.                                                                                                      
  283.      /*--------------------------------------------------------------------------------------------- 
  284.      /* Procedure Indicator Specifications                                                           
  285.      /*--------------------------------------------------------------------------------------------- 
  286.                                                                                                      
  287.                                                                                                      
  288.      /*--------------------------------------------------------------------------------------------- 
  289.      /* Procedure Standalone Data Specifications                                                     
  290.      /*--------------------------------------------------------------------------------------------- 
  291.                                                                                                      
  292.                                                                                                      
  293.      /*--------------------------------------------------------------------------------------------- 
  294.      /* Procedure Constant Specifications                                                            
  295.      /*--------------------------------------------------------------------------------------------- 
  296.                                                                                                      
  297.                                                                                                      
  298.      /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
  299.      /* Procedure Code                                                                               
  300.      /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
  301.                                                                                                      
  302.       /Free                                                                                          
  303.                                                                                                      
  304.        ExSr initialize;                                                                              
  305.                                                                                                      
  306.        SetLl (customerNumber : unitHeader) OPLUHXR6;                                                 
  307.        ReadE (customerNumber : unitHeader) OPLUHXR6;                                                 
  308.                                                                                                      
  309.        DoW Not %Eof(OPLUHXR6) and                                                                    
  310.          UHSTAT <> 'A';                                                                              
  311.           ReadE (customerNumber : unitHeader) OPLUHXR6;                                              
  312.        EndDo;                                                                                        
  313.                                                                                                      
  314.        If %Eof(OPLUHXR6);                                                                            
  315.           SetGt (customerNumber : unitHeader) OPLUHXR6;                                              
  316.           ReadPE (customerNumber : unitHeader) OPLUHXR6;                                             
  317.                                                                                                      
  318.           If %Eof(OPLUHXR6);                                                                         
  319.              sndPm_Msg_Id = 'PVMF002';                                                               
  320.              %SubSt(sndPm_Data : 1 : 21) = 'OPPUHXR';                                                
  321.              %SubSt(sndPm_Data : 22 : 61) = x'002E' +                                                
  322.                'Customer #: ' + %Trim(%EditC(customerNumber : 'Z')) +                                
  323.                ', Unit Header: ' + %Trim(%EditC(unitHeader : 'Z'));                                  
  324.              /Include QRpgCbSrc,CQMhSndPm                                                            
  325.           EndIf;                                                                                     
  326.        EndIf;                                                                                        
  327.                                                                                                      
  328.        Chain (UHCST# : UHANI : UHPIND) OPFANI OPPANI;                                                
  329.                                                                                                      
  330.        If Not %Found(OPLANI1);                                                                       
  331.              sndPm_Msg_Id = 'PVMF002';                                                               
  332.              %SubSt(sndPm_Data : 1 : 21) = 'OPPANI';                                                 
  333.              %SubSt(sndPm_Data : 22 : 61) = x'0034' +                                                
  334.                'Customer #: ' + %Trim(%EditC(UHCST# : 'Z')) +                                        
  335.                ', Ani: ' + %Trim(%EditW(UHANI : '0(  )&   -    ')) +                                 
  336.                ', Pin Id: ' + %Trim(%EditC(UHPIND : 'Z'));                                           
  337.              /Include QRpgCbSrc,CQMhSndPm                                                            
  338.        EndIf;                                                                                        
  339.                                                                                                      
  340.        ExSr exitProcedure;                                                                           
  341.                                                                                                      
  342.        //=========================================================================================== 
  343.        // Initilizing Subroutine                                                                     
  344.        //=========================================================================================== 
  345.                                                                                                      
  346.        BegSr initialize;                                                                             
  347.                                                                                                      
  348.           If Not globalInit;                                                                         
  349.              globalInit = *ON;                                                                       
  350.              sndPm_Data_Length = 500;                                                                
  351.                                                                                                      
  352.              /Include QRpgCbSrc,ZQMhSndPm                                                            
  353.           EndIf;                                                                                     
  354.                                                                                                      
  355.           /Undefine ZUSERCH                                                                          
  356.           /Include QRpgCbSrc,ZUserCh                                                                 
  357.                                                                                                      
  358.           If setJmp(jumpPoint) = 1;                                       // Error Jump Point        
  359.              ExSr exitProcedure;                                          // Exit on error           
  360.           EndIf;                                                                                     
  361.                                                                                                      
  362.           sndPM_Msg_Type = '*ESCAPE';                                                                
  363.                                                                                                      
  364.           userCHConditionHandler = %PAddr('PROVISIONERUSERCH003');        // Condition Handler       
  365.           registerConditionHandler(userCHConditionHandler : userCHBase : *OMIT);                     
  366.                                                                                                      
  367.           userCH.errorBase = errorStructure;                                                         
  368.           usec_Base = errorStructure;                                                                
  369.           usec_Data_Length = usec_Provided - usec_Avail_Static;                                      
  370.           usec_Data_Base = usec_Base + usec_Avail_Static;                                            
  371.                                                                                                      
  372.           %Subst(usec_Data : 1 : usec_Data_Length) = *BLANKS;                                        
  373.                                                                                                      
  374.           usec_Msg_Id = *BLANKS;                                                                     
  375.                                                                                                      
  376.           Clear OPPANI;                                                                              
  377.                                                                                                      
  378.           If Not %Open(OPLANI1);                                                                     
  379.              Open OPLANI1;                                                                           
  380.           EndIf;                                                                                     
  381.                                                                                                      
  382.           If Not %Open(OPLUHXR6);                                                                    
  383.              Open OPLUHXR6;                                                                          
  384.           EndIf;                                                                                     
  385.                                                                                                      
  386.        EndSr;                                                                                        
  387.                                                                                                      
  388.        //=========================================================================================== 
  389.        //   Exit Procedure                                                                           
  390.        //=========================================================================================== 
  391.                                                                                                      
  392.                                                                                                      
  393.        BegSr ExitProcedure;                                                                          
  394.                                                                                                      
  395.           unRegisterConditionHandler(userCHConditionHandler : *OMIT);                                
  396.                                                                                                      
  397.           /Undefine LUSERCH                                                                          
  398.           /Include QRpgCbSrc,LUserCh                                                                 
  399.                                                                                                      
  400.           Return;                                                                                    
  401.                                                                                                      
  402.        EndSr;                                                                                        
  403.                                                                                                      
  404.       /End-Free                                                                                      
  405.                                                                                                      
  406.      P retreiveANIWithC#Uh...                                                                        
  407.      P                 E                                                                             
  408.                                                                                                      
  409.        //=========================================================================================== 
© 2004-2019 by midrange.com generated in 0.01s valid xhtml & css