RPGIV @ Work

A unique site for RPG and System i Lovers


Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

QIBM_QDB_OPEN Example Print E-mail
User Rating: / 0
Written by Chamara Withanachchi   
     H dftactgrp(*no) actgrp(*caller)                                      
     D DBOP0100        DS                  qualified                       
     D  HeaderSize                   10i 0                                 
     D  FormatName                    8                                    
     D  ArrayOffset                  10i 0                                 
     D  FileCount                    10i 0                                 
     D  ElementLength                10i 0                                 
     D  JobName                      10                                    
     D  UserName                     10                                    
     D  JobNumber                     6                                    
     D  CurrentUser                  10                                    
     D  QueryOpen                     1                                    
     D DBOPFile        DS                  qualified Based(DBOPFilePtr)    
     D  FileName                     10                                    
     D  Library                      10                                    
     D  Member                       10                                    
     D                                2                                
     D  FileType                     10i 0                             
     D  UnderlyingPF                 10i 0                             
     D  InputOption                   1                                
     D  OutputOption                  1                                
     D  UpdateOption                  1                                
     D  DeleteOption                  1                                
     D returnCode      S             10i 0                             
     D i               S             10i 0                             
     D userNam         S                   Like(DBOP0100.UserName)     
     D fileNam         S                   Like(DBOPFile.fileName)     
     D librNam         S                   Like(DBOPFile.Library)      
     D curUser         S                   Like(DBOP0100.currentUser)  
     D cmd             S                   Like(StdCmd)                
     D len             S                   Like(stdLen)                
     D                                     Inz(%size(cmd))             
     D StdCmd          S            250A                               
     D StdLen          S             15P 5                        
     D Execute         PR                  ExtPgm('QCMDEXC')      
     D     CmdStr                          Like(StdCmd)           
     D                                     Options(*VarSize)      
     D                                     Const                  
     D     CmdStrLen                       Like(StdLen) Const     
     D DB_Open         PR                  ExtPgm('DBOPEN')       
     D  DBOP01001                          Like(DBOP0100)         
     D  ReturnCode1                        Like(ReturnCode)       
     D DB_Open         PI                                         
     D  DBOP01001                          Like(DBOP0100)         
     D  ReturnCode1                        Like(ReturnCode)       

          // Extract current user from passed in structure           
          curUser = DBOP0100.CurrentUser;                            
          returnCode = 1;                                            
          // Process each table being opened by the request          
          For i = 1 to DBOP0100.FileCount;                           
             DBOPFilePtr = %Addr(DBOP0100) + DBOP0100.ArrayOffset +  
                           (i - 1) * DBOP0100.ElementLength;         
             FileNam = dbopFile.FileName;                            
             //If My File in my lib Opens                            
             If fileNam = 'PEMPMAS' and librNam = 'INACPAYD10';      
                cmd = 'SNDMSG MSG(''''PEMPMAS open from ' +          
                      'INACPAYD10 Library'''') TOUSR(*SYSOPR)';      
                Execute(cmd : len);                                  


User Comments

Please login or register to add comments

<Previous   Next>