Sidebar

The API Corner: So Just What Changed in This Record?

APIs
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

 

Learn about flexibly tracking field changes.

 

On the IT Knowledge Exchange, Luissimon recently posted, "I need to get which field changed in a file, instead of writing multiple (IF this field changed THEN DO…) for each field in each file. I was wondering if I could use some tool in RPG for doing that?" While I can't say that I'm familiar with an RPG built-in to accomplish this, I can see how using a few system APIs within an RPG application program can meet this need.

In this column, we'll look at how we can register a trigger program to be called whenever an update operation is performed on a file and how that trigger program can then determine, using the List Fields (QUSLFLD) API, which fields have been changedand without the program having to know in advance what file or fields are being tracked.

Now before we start, I do want to point out one major item. This article shows how to provide this auditing function using one program. I'm using one program solely for the purpose of being able to demonstrate everything in one article. In a production environment, I would never use this implementation, though I would use the database triggers and system APIs being discussed in this article. Rather than one large program, I would use three distinct programs. After we've looked at the sample program, I'll overview how I would implement the various functions of the program in three different programs.

Here is the source for our example program AUDDTACHG (Audit Data Change).

h dftactgrp(*no)                                                    
                                                                    
d AudDtaChg       pr                                                
d  TrgBfr                             likeds(QDBTB)                 
d  LenTrgBfr                    10i 0 const                         
                                                                    
d AudDtaChg       pi                                                
d  TrgBfr                             likeds(QDBTB)                 
d  LenTrgBfr                    10i 0 const                         
                                                                    
 ****************************************************************   
                                                                    
d CrtUsrSpc       pr                  extpgm('QUSCRTUS')            
d  QualUsrSpcN                  20a   const                         
d  XAttr                        10a   const                         
d  IntSize                      10i 0 const                         
d  IntValue                      1a   const                         
d  PubAut                       10a   const                         
d  TxtDesc                      50a   const                         
d  ReplaceOpt                   10a   const options(*nopass)        
d  ErrCde                             likeds(QUSEC) options(*nopass)
d  Domain                       10a   const options(*nopass)        
d  TfrSize                      10i 0 const options(*nopass)        
d  OptSpcAlgn                    1a   const options(*nopass)        
                                                                    
d FindChgs        pr                                                
                                                                    
d LstFlds         pr                  extpgm('QUSLFLD')             
d  UsrSpcName                   20a   const                         
d  Format                        8a   const                         
d  QualFilNam                   20a   const                         
d  RcdFmt                       10a   const                         
d  OvrPrc                        1a   const                         
d  ErrCde                             likeds(QUSEC) options(*nopass)
                                                                    
d LstRcdFmts      pr                  extpgm('QUSLRCD')             
d  UsrSpcName                   20a   const                         
d  Format                        8a   const                         
d  QualFilNam                   20a   const                         
d  OvrPrc                        1a   const                         
d  ErrCde                             likeds(QUSEC) options(*nopass)
                                                                    
d RtvUsrSpcPtr    pr                  extpgm('QUSPTRUS')            
d  QualUsrSpcN                  20a   const                         
d  UsrSpcPtr                      *                                 
d  ErrCde                             likeds(QUSEC) options(*nopass)
                                                                    
 ****************************************************************   
                                                                    
d SpcPtr          s               *                                 
d ListHdr         ds                  likeds(QUSH0100)              
d                                     based(SpcPtr)                 
                                                                    
d FldEntryPtr     s               *                                 
d FldEntry        ds                  likeds(QUSL0100)              
d                                     based(FldEntryPtr)            
                                                                    
d RcdEntryPtr     s               *                                 
d RcdEntry        ds                  likeds(QUSL010001)            
d                                     based(RcdEntryPtr)           
                                                                   
d ErrCde          ds                  qualified                    
d  Hdr                                likeds(QUSEC)                
d  MsgDta                      256a                                
                                                                   
 ****************************************************************  
                                                                   
d AftImagePtr     s               *                                
d AftImage        s          32766a   based(AftImagePtr)           
d AftNullPtr      s               *                                
d AftNullValue    s           8000a   based(AftNullPtr)            
d B4ImagePtr      s               *                                
d B4Image         s          32766a   based(B4ImagePtr)            
d B4NullPtr       s               *                                
d B4NullValue     s           8000a   based(B4NullPtr)             
d GetOut          s               n                                
d RcdFmt          s             10a                                
d SpcName         s             20a   inz('AUDDTACHG QTEMP')       
                                                                   
d X               s             10i 0                            
                                                                 
 ****************************************************************
                                                                 
 /copy qsysinc/qrpglesrc,trgbuf                                  
 /copy qsysinc/qrpglesrc,qusec                                   
 /copy qsysinc/qrpglesrc,qusgen                                  
 /copy qsysinc/qrpglesrc,quslfld                                 
 /copy qsysinc/qrpglesrc,quslrcd                                 
                                                                 
 ****************************************************************
                                                                 
 /free                                                           
                                                                 
  if (GetOut);                                                   
     *inlr = *on;                                                
     return;                                                     
  endif;                                                         
                                                                 
  select;                                                        
     when TrgBfr.QDBTE = '1';                                  
          // Insert operation -- not a concern today           
                                                               
     when TrgBfr.QDBTE = '2';                                  
          // Delete operation -- not a concern today           
                                                               
     when TrgBfr.QDBTE = '3';                                  
          // Update operations have before and after images    
                                                               
          B4ImagePtr = %addr(TrgBfr) + TrgBfr.QDBORO;          
          B4NullPtr = %addr(TrgBfr) + TrgBfr.QDBORNBM;         
                                                               
          AftImagePtr = %addr(TrgBfr) + TrgBfr.QDBNRO;         
          AftNullPtr = %addr(TrgBfr) + TrgBfr.QDBNRNBM;        
                                                               
          FindChgs();                                          
                                                               
     other;                                                    
          // Basically Read operations which should never      
          // trigger this program...                           
                                                                    
  endsl;                                                            
                                                                    
  *inlr = *on;                                                      
  return;                                                           
                                                                    
  // *************************************************************  
                                                                    
  begsr *inzsr;                                                     
                                                                    
    QUSBPrv = 0;                                                    
    ErrCde.Hdr.QUSBPrv = %size(ErrCde);                             
                                                                    
    RtvUsrSpcPtr(SpcName :SpcPtr :ErrCde);                          
                                                                    
    select;                                                         
       when ErrCde.Hdr.QUSBAvl = 0;                                 
            // User space previously created                        
                                                                    
       when ErrCde.Hdr.QUSEI = 'CPF9801';                           
            // UsrSpc not found, so create it                  
                                                               
            CrtUsrSpc(SpcName :' ' :4096 :x'00' :'*ALL' :' '   
                      :'*YES' :ErrCde :'*DEFAULT' :0 :'1');    
                                                               
            if ErrCde.Hdr.QUSBAvl <> 0;                        
               dsply ('Unable to create *USRSPC: ' +           
                      ErrCde.Hdr.QUSEI);                       
               GetOut = *on;                                   
            else;                                              
               // Get accessibility to user space              
                                                               
               RtvUsrSpcPtr(SpcName :SpcPtr :ErrCde);          
               if ErrCde.Hdr.QUSBAvl <> 0;                     
                  dsply ('Unable to access *USRSPC: ' +        
                      ErrCde.Hdr.QUSEI);                       
                  GetOut = *on;                                
               endif;                                          
            endif;                                             
       other;                                                  
            // Something seriously wrong.                       
                                                                
            dsply ('Serious Error found: ' +                    
                  ErrCde.Hdr.QUSEI);                            
            GetOut = *on;                                       
    endsl;                                                      
                                                                
    if (not GetOut);                                            
       LstRcdFmts(SpcName :'RCDL0100'                           
                  :(TrgBfr.QDBFILN02 + TrgBfr.QDBLIBN02)        
                  :'0' :ErrCde);                                
                                                                
       select;                                                  
          when ErrCde.Hdr.QUSBAvl <> 0;                         
               dsply ('Unable to access record formats: ' +     
                      ErrCde.Hdr.QUSEI);                        
               GetOut = *on;                                    
                                                                
          when ListHdr.QUSIS <> 'C';                            
               dsply ('Unable to access all record formats: ' + 
                      ErrCde.Hdr.QUSEI);                     
               GetOut = *on;                                 
                                                             
          when ListHdr.QUSNbrLE <> 1;                        
               dsply ('More than one record format found');  
               GetOut = *on;                                 
                                                             
          other;                                             
               RcdEntryPtr = SpcPtr + ListHdr.QUSOLD;        
               RcdFmt = RcdEntry.QUSFN05;                    
       endsl;                                                
    endif;                                                   
                                                             
    if (not GetOut);                                         
       LstFlds(SpcName :'FLDL0100'                           
               :(TrgBfr.QDBFILN02 + TrgBfr.QDBLIBN02)        
               :RcdFmt :'0' :ErrCde);                        
                                                             
       select;                                               
          when ErrCde.Hdr.QUSBAvl <> 0;                      
               dsply ('Unable to access field info: ' +            
                      ErrCde.Hdr.QUSEI);                           
               GetOut = *on;                                       
                                                                   
          when ListHdr.QUSIS <> 'C';                               
               dsply ('Unable to access all fields');              
               GetOut = *on;                                       
                                                                   
          other;                                                   
               // Continue on                                      
       endsl;                                                      
    endif;                                                         
                                                                   
  endsr;                                                           
                                                                   
 /end-free                                                         
                                                                   
 ***************************************************************** 
                                                                   
p FindChgs        b                                                
d FindChgs        pi                                               
                                                                   
 /free                                                             
                                                                   
  for X = 1 to ListHdr.QUSNbrLE;                                   
      if X = 1;                                                    
         FldEntryPtr = SpcPtr + ListHdr.QUSOLD;                    
      else;                                                        
         FldEntryPtr += ListHdr.QUSSEE;                            
      endif;                                                       
                                                                   
      select;                                                      
         when ((FldEntry.QUSNVA = '0') or                          
               (%subst(B4NullValue :X :1) = '0' and                
                %subst(AftNullValue :X :1) = '0')) and             
               %subst(B4Image :FldEntry.QUSOBP :FldEntry.QUSFLB) <>
               %subst(AftImage :FldEntry.QUSOBP :FldEntry.QUSFLB); 
                                                                   
              dsply (%trimr(FldEntry.QUSFN02) +                    
                     ' value changed');                            
                                                         
         when %subst(B4NullValue :X :1) = '1' and        
              %subst(AftNullValue :X :1) = '1';          
              // Both are null, so no change             
                                                         
         when %subst(B4NullValue :X :1) = '1' and        
              %subst(AftNullValue :X :1) = '0';          
                                                         
              dsply (%trimr(FldEntry.QUSFN02) +          
                     ' changed from null to not null');  
                                                         
         when %subst(B4NullValue :X :1) = '0' and        
              %subst(AftNullValue :X :1) = '1';          
                                                         
              dsply (%trimr(FldEntry.QUSFN02) +          
                     ' changed from not null to null');  
                                                         
      endsl;                                             
                                                         
  endfor;                                                
                            
 /end-free                  
                            
p FindChgs        e         

As AUDDTACHG will be used as a database trigger program, the system will call the program passing two parameters. As documented in the IBM Knowledge Center under How trigger programs work, the first parameter will contain information about the change operation and the second parameter the length of the first parameter. Documentation for the first parameter, often referred to as a trigger buffer, can be found here with the QSYSINC include for the parameter in member TRGBUF of QSYSINC/QRPGLESRC. TRGBUF defines the static portion of the parameter with data structure QDBTB, and AUDDTACHG prototypes the first parameter passed to it (TrgBfr) as being likeds(QDBTB).

Having received the two parameters, the *INZSR subroutine of AUDDTACHG runs. The *INZSR, after setting the Bytes provided field of the QUSEC API error code structure to 0 (send exceptions) and the Bytes provided field of the ErrCde API error code structure to a non-zero value (return exceptions in ErrCde), checks to see if the user space QTEMP/AUDDTACHG exists by calling the Retrieve Pointer to User Space (QUSPTRUS) API to set the pointer variable SpcPtr to the address of the user space. If this is the first time the trigger program AUDDTACHG has been called in the current job, the user space will not exist (ErrCde.Hdr.QUSBAvl will be non-zero and ErrCde.Hdr.QUSEI will be CPF9801 – Object in library not found) and AUDDTACHG will then create the user space with the Create User Space (QUSCRTUS) API and again call the QUSPTRUS API to set SpcPtr to the address of to the user space.

The SpcPtr variable is used by the program to base the common List API generic header (data structure QUSH0100 from QSYSINC/QRPGLESRC,QUSGEN) using the name ListHdr.

Our desire is to call the List Fields (QUSLFLD) API in order to determine what fields are defined for the record change that caused AUDDTACHG to be called, which is what the API will return to our user space. The QUSLFLD API, however, requires a record format name (in addition to the name of the file) and, unfortunately, the trigger buffer passed by the system to AUDDTACHG does not include the record format name. So the program calls the List Record Formats (QUSLRCD) API to get the record format name associated with the physical file TrgBfr.QBDFilN02 (the file name passed in the trigger buffer) in library TrgBfr.QDBLibN02 (the library name passed in the trigger buffer).

As physical files can have only one record format, and AUDDTACHG will be used only as a trigger for physical files, the program sets the variable RcdFmt to the value of the first, and only, record format name (RcdEntry.QUSFN05) returned by QUSLRCD. This "first" entry is accessed by setting the pointer variable RcdEntryPtr to the address of the user space (SpcPtr) plus the QUSLRCD List API generic header offset to list data (ListHdr.QUSOLD). The RcdEntryPtr variable is used by the program to base the QUSLRCD RCDL0100 returned record entry (data structure QUSL010001 from QSYSINC/QRPGLESRC,QUSLRCD) using the name RcdEntry.

Having obtained the necessary record format name, AUDDTACHG then calls the QUSLFLD API, reusing the same user space, as we have what we need from QUSLRCD, to access all of the field definitions associated with the file (using the same trigger buffer fields of TrgBfr.QDBFilN02 and TrgBfr.QDBLibN02 for file and library name, respectively) along with the record format name found in variable RcdFmt. The *INZSR subroutine then returns to the main line of AUDDTACHG.

In the main line of the program, a check is made to see what type of operation caused our trigger program to be called. This information can be found in TrgBfr.QDBTE (trigger event) with a value of '1' indicating a new record was written to the file, a value of '2' indicating a record was deleted from the file, a value of '3' indicating that an update of an existing record was done, and a value of '4' indicating that a record was read from the file. For today, all we care about are changes, a TrgBfr.QDBTE value of '3'. The other cases are basically a subset of a change operation in that an add adds all fields, a delete deletes all fields, and a read doesn't change anything.

Having determined that the current operation is an update, AUDDTACHG sets four pointers:

  • B4ImagePtr to where the "prior to update" record value is found in the trigger buffer. The B4ImagePtr variable is used to base the variable B4Image, which is defined as a character field with a length of 32766 bytes (the maximum database file size). The value of B4ImagePtr is set using the address of the trigger buffer plus the trigger buffer–provided original record offset within the trigger buffer (TrgBfr.QDBORO). B4Image now represents the entire "before update" record contents.
  • B4NullPtr to where the null byte map associated with the "prior to update" fields is found in the trigger buffer. The B4NullPtr variable is used to base the variable B4NullValue, which is defined as a character field with a length of 8000 bytes (the maximum number of fields in a record format). The value of B4NullPtr is set using the address of the trigger buffer plus the trigger buffer–provided original record null byte map offset (TrgBfr.QDBORNBM). B4NullValue now represents the entire "before update" null map contents.
  • AftImagePtr to where the "after update" record value is found in the trigger buffer. The AftImagePtr variable is used to base the variable AftImage which, like B4Image, is defined with a length of 32766 bytes. The value of AftImagePtr is set using the address of the trigger buffer plus the trigger buffer–provided new record offset (TrgBfr.QDBNRO). AftImage now represents the entire "after update" record contents.
  • AftNullPtr to where the null byte map associated with the "after update" fields is found in the trigger buffer. The AftNullPtr is used to base the variable AftNullValue which, like B4NullValue, is defined with a length of 8000 bytes. The value of AftNullPtr is set using the address of the trigger buffer plus the trigger buffer–provided new record null byte map offset (TrgBfr.QDBNRNBM). AftNullValue now represents the entire "after update" null map contents.

Null byte maps, if you're not familiar with them, allow you to determine if a given field is set to a NULL or non-NULL value where NULL means no value (which is different than, say, a field set to all blanks). For each field of the record, there will be a 1-byte character field in the null byte map. If the null byte map field is set to '0', then the field is not NULL. If the null byte map field is set to '1', then the field is set to NULL.

Having set the various pointers to address the before and after record values and null byte maps, AUDDTACHG calls procedure FindChgs().

FindChgs() loops thru all of the field definitions returned by the QUSLFLD API. The number of fields returned, the to value associated with the for statement, is found in the QUSLFLD List API generic header number of list entries (ListHdr.QUSNbrLE). As when we wanted to access the first RcdEntry in the *INZSR, FindChgs() sets the pointer variable FldEntryPtr when accessing the first field entry (X is equal to 1) by adding the List API header offset to list data (ListHdr.QUSOLD) to the address of the user space (SpcPtr). Subsequent field definitions (X is greater than 1) are accessed by adding the List API header size of each entry (ListHdr.QUSSEE) to the current value of FldEntryPtr. The FldEntryPtr variable is used by the program to base the QUSLFLD FLDL0100 returned field entry (data structure QUSL0100 from QSYSINC/QRPGLESRC,QUSLFLD) using the variable FldEntry.

Within the for loop, a select is run for each defined field. The first when is checking for the following conditions:

  • Does this field even allow NULL values? This is determined by examining the QUSLFLD returned value FldEntry.QUSNVA (Null values allowed). If the value is '0', then NULL values are not allowed.
  • If NULL values are allowed, are both the "before update" and "after update" fields set to a non-NULL value? This is determined by examining the trigger buffer null byte map fields associated with the field. If the Xth byte of B4NullValue is '0', then the "before update" field was not NULL, and if the Xth byte of AftNullValue is '0', then the "after update" field is not NULL
  • If either of the two previous checks are true (the field is not NULL-capable or the field is NULL-capable and both the before and after fields are not NULL), then a check is made for the "before" field value not being equal to the "after" field value. This is done by comparing the substring of the B4Image and AftImage values. The %subst start position is determined using the QUSLFLD returned value FldEntry.QUSOBP (Output buffer position) and the length using the QUSLFLD returned value FldEntry.QUSFLB (Field length in bytes). If the B4Image field value is not equal to the AftImage field value, then a message is displayed using the dsply operation. The message provides the name of the field that was changed (using the QUSLFLD returned value FldEntry.QUSFN02 (Field name) with the text 'value changed').

The following when operations are pretty straightforward. If both "before" and "after" null byte map values are '1', indicating that both are NULL, we know there was no change.

Otherwise, there was a change, either changing from NULL to not NULL or from not NULL to NULL, and an appropriate message is displayed.

When the for loop completes and all appropriate messages related to field value changes have been displayed, FindChgs() returns to the main line of AUDDTACHG, *INLR is set on, and the program returns.

That's it. Per the original request of "…which field changed in a file…," we have identified each field that was changed and avoided any hard coding of field names with multiple if checks. I suspect, however, that a follow-on request might be "OK, I now know the fields that were changed, but I really wanted to know what the before and after values were when the field changed. Can this be done in the same manner?" The answer of course is yes, and all you have to do is patiently wait for next month's API Corner.

Assuming that you've stored the above program source in member AUDDTACHG of source file QRPGLESRC and that the library containing QRPGLESRC is in your current library list, then you can create the program with the following command:

CrtBndRPG Pgm(AUDDTACHG) 

To test AUDDTACHG, we'll create a physical file with a variety of data types, sizes, and attributes. The file will be DTACHGPF (Data change physical file) with the following DDS definition.

R RECORD                              
  TXTFLD        30A         ALWNULL   
  VARTXTFLD     50A         VARLEN    
  NBRFLD3P0      3P 0                 
  NBRFLD10P2    10P 2                 
  NBRFLD4B2      4B 2                 
  NBRFLD9B0      9B 0                 
  NBRFLD18B0    18B                   
  NBRFLD10S0    10S 0       ALWNULL   
  NBRFLD15S2    15S 2                 
  DATFLD          L         ALWNULL   
  TIMFLD          T                   
  TSFLD           Z          

Assuming you have stored the above DDS source in member DTACHGPF of source file QDDSSRC and that the library containing QDDSSRC is in your current library list, then you can create the file with this command:

CrtPF File(DTACHGPF) SrcFile(QDDSSRC)

And then you associate AUDDTACHG as an update trigger to DTACHGPF with this command:

AddPFTrg File(DTACHGPF) TrgTime(*After) TrgEvent(*Update) Pgm(AUDDTACHG)

Now add a record to DTACHGPF using whatever tool you are comfortable with (DFU, SQL, RPG program, etc.) and, after adding the record, change one or more field values again using the tool of your choice. You should then get the messages identifying only those fields that you changed.

I mentioned at the start of this article that "In a production environment I would never use this implementation" and that I would tend more toward using three distinct programs. The three programs I have in mind are these:

  1. The first program would be an interactive program that maintains a control file of those files and fields within the file that are to be audited for change (or insert and delete activity). The program would be passed a file name, use the logic found in the *INZSR subroutine of AUDDTACHG to access the fields defined for the file, merge this list with any existing file/field records in the control file, and present the user with a subfile showing those fields currently audited and those not being audited. The user makes whatever changes are desired (stop auditing this field, start auditing this field), and the program then writes/updates to the control file those fields that are to be audited. For each field being audited, the control file record would contain the essential pieces of information used by the AUDDTACHG FindChgs() procedurethe name of the file (TrgBfr.QDBFilN02), the name of the field (FldEntry.QUSFN02), whether or not the field can be set to NULL (FldEntry.QUSNVA), the offset to the field within the record (FldEntry.QUSOBP), and the length of the field in bytes (FldEntry.QUSFLB).
  2. The second program would be the trigger program associated with any file that has one or more records in the control file from program 1. The trigger program would verify that the file is audited (there is at least one record in the control file for the file being changed) and, if so, maintain three (or five) transaction files. The first transaction file would be a header file most likely indexed by the current %timestamp value. Each header record would also contain (at a minimum) a unique numeric value identifying the transaction, the file name (TrgBfr.QDBFilN02), the file library name (TrgBfr.QDBLibN02), the type of trigger event (TrgBfr.QDBTE), and the qualified name of the program performing the trigger event (to find this, you can refer to an earlier API Corner article, Retrieving Information, Part I, which uses the Retrieve Call Stack (QWVRCSTK) API). This program would then write to a second file (indexed by the same unique value used in the header file) that holds "before images" (B4Image) and the "before null byte map" (B4NullValue), with the third file (again indexed by the same header file index value) holding the "after images" (AftImage) and the "after null byte map" (AftNullValue). If the combination of Image and NullValue into one record/file exceeds the maximum size of a record, then the fourth and fifth transaction files would contain the B4NullValue and AftNullValue images (again indexed by the same unique value found in the header file). To support auditing of insert operations (TrgBfr.QDBTE = '1'), this program would write the header record, the AftImage value, and the AftNullValue value. To support auditing of delete operations (TrgBfr.QDBTE = '2'), this program would write the header record, the B4Image, and the B4NullValue value.
  3. The third program would read the header file (using the timestamp index) maintained by the second program and, for update events, access the before and after transaction files using the unique key value found in the header file record. Using the control file maintained by the first program, this third program would then perform the processing being done in the FindChgs() procedure of AUDDTACHG to identify any changed data values and record those changes to a printer file, a permanent audit file, or just dsply them (though this last option is rather unlikely). Having processed a given transaction the program would then delete the header record and any Image/NullValue records associated with the transaction

This three-program approach would have many advantages over an implementation such as AUDDTACHG. Three that readily come to mind are these:

  • Most files contain at least some fields that do not need to be audited, so why process them every time?
  • Most files are not going to change very often in terms of the fields defining the record, so why re-access the field definition values (that is, use QUSLFLD) every time? Just record the essential facts about fields that are to be audited once.
  • Why do the audit analysis as part of the application transaction (basically slowing down interactive response time)? Record what's needed (the who, what, when of the header file) and do the field level analysis in a background batch program.

I will add that this three-program approach is not just theoretical. I successfully implemented this approach a few years back for a company needing to audit field-level changes involving several hundred files. They had absolutely no desire to change any of the application programs maintaining these files, and they wanted to minimize the impact to their users. I will point out, though, that my implementation included a few additional "bells and whistles"items like having the transaction file records written by the second program be in the same commitment cycle as the initiating program in order to catch rollback situations, control level values in the transaction header file to accommodate changed record-level definitions (new fields, changed field definitions, etc), and the like.

Have Some System API Questions?

As usual, if you have any API questions, send them to me at This email address is being protected from spambots. You need JavaScript enabled to view it..

Bruce Vining

Bruce Vining is president and co-founder of Bruce Vining Services, LLC, a firm providing contract programming and consulting services to the System i community. He began his career in 1979 as an IBM Systems Engineer in St. Louis, Missouri, and then transferred to Rochester, Minnesota, in 1985, where he continues to reside. From 1992 until leaving IBM in 2007, Bruce was a member of the System Design Control Group responsible for OS/400 and i5/OS areas such as System APIs, Globalization, and Software Serviceability. He is also the designer of Control Language for Files (CLF).A frequent speaker and writer, Bruce can be reached at bvining@brucevining.com. 


MC Press books written by Bruce Vining available now on the MC Press Bookstore.

IBM System i APIs at Work IBM System i APIs at Work
Leverage the power of APIs with this definitive resource.
List Price $89.95

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

RESOURCE CENTER

  • WHITE PAPERS

  • WEBCAST

  • TRIAL SOFTWARE

  • White Paper: Node.js for Enterprise IBM i Modernization

    SB Profound WP 5539

    If your business is thinking about modernizing your legacy IBM i (also known as AS/400 or iSeries) applications, you will want to read this white paper first!

    Download this paper and learn how Node.js can ensure that you:
    - Modernize on-time and budget - no more lengthy, costly, disruptive app rewrites!
    - Retain your IBM i systems of record
    - Find and hire new development talent
    - Integrate new Node.js applications with your existing RPG, Java, .Net, and PHP apps
    - Extend your IBM i capabilties to include Watson API, Cloud, and Internet of Things


    Read Node.js for Enterprise IBM i Modernization Now!

     

  • Profound Logic Solution Guide

    SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation.
    Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects.
    The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the companyare not aligned with the current IT environment.

    Get your copy of this important guide today!

     

  • 2022 IBM i Marketplace Survey Results

    Fortra2022 marks the eighth edition of the IBM i Marketplace Survey Results. Each year, Fortra captures data on how businesses use the IBM i platform and the IT and cybersecurity initiatives it supports.

    Over the years, this survey has become a true industry benchmark, revealing to readers the trends that are shaping and driving the market and providing insight into what the future may bring for this technology.

  • Brunswick bowls a perfect 300 with LANSA!

    FortraBrunswick is the leader in bowling products, services, and industry expertise for the development and renovation of new and existing bowling centers and mixed-use recreation facilities across the entertainment industry. However, the lifeblood of Brunswick’s capital equipment business was running on a 15-year-old software application written in Visual Basic 6 (VB6) with a SQL Server back-end. The application was at the end of its life and needed to be replaced.
    With the help of Visual LANSA, they found an easy-to-use, long-term platform that enabled their team to collaborate, innovate, and integrate with existing systems and databases within a single platform.
    Read the case study to learn how they achieved success and increased the speed of development by 30% with Visual LANSA.

     

  • The Power of Coding in a Low-Code Solution

    LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed.
    Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

    • Discover the benefits of Low-code's quick application creation
    • Understand the differences in model-based and language-based Low-Code platforms
    • Explore the strengths of LANSA's Low-Code Solution to Low-Code’s biggest drawbacks

     

     

  • Why Migrate When You Can Modernize?

    LANSABusiness users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
    In this white paper, you’ll learn how to think of these issues as opportunities rather than problems. We’ll explore motivations to migrate or modernize, their risks and considerations you should be aware of before embarking on a (migration or modernization) project.
    Lastly, we’ll discuss how modernizing IBM i applications with optimized business workflows, integration with other technologies and new mobile and web user interfaces will enable IT – and the business – to experience time-added value and much more.

     

  • UPDATED: Developer Kit: Making a Business Case for Modernization and Beyond

    Profound Logic Software, Inc.Having trouble getting management approval for modernization projects? The problem may be you're not speaking enough "business" to them.

    This Developer Kit provides you study-backed data and a ready-to-use business case template to help get your very next development project approved!

  • What to Do When Your AS/400 Talent Retires

    FortraIT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators is small.

    This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:

    • Why IBM i skills depletion is a top concern
    • How leading organizations are coping
    • Where automation will make the biggest impact

     

  • Node.js on IBM i Webinar Series Pt. 2: Setting Up Your Development Tools

    Profound Logic Software, Inc.Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. In Part 2, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Attend this webinar to learn:

    • Different tools to develop Node.js applications on IBM i
    • Debugging Node.js
    • The basics of Git and tools to help those new to it
    • Using NodeRun.com as a pre-built development environment

     

     

  • Expert Tips for IBM i Security: Beyond the Basics

    SB PowerTech WC GenericIn this session, IBM i security expert Robin Tatam provides a quick recap of IBM i security basics and guides you through some advanced cybersecurity techniques that can help you take data protection to the next level. Robin will cover:

    • Reducing the risk posed by special authorities
    • Establishing object-level security
    • Overseeing user actions and data access

    Don't miss this chance to take your knowledge of IBM i security beyond the basics.

     

     

  • 5 IBM i Security Quick Wins

    SB PowerTech WC GenericIn today’s threat landscape, upper management is laser-focused on cybersecurity. You need to make progress in securing your systems—and make it fast.
    There’s no shortage of actions you could take, but what tactics will actually deliver the results you need? And how can you find a security strategy that fits your budget and time constraints?
    Join top IBM i security expert Robin Tatam as he outlines the five fastest and most impactful changes you can make to strengthen IBM i security this year.
    Your system didn’t become unsecure overnight and you won’t be able to turn it around overnight either. But quick wins are possible with IBM i security, and Robin Tatam will show you how to achieve them.

  • Security Bulletin: Malware Infection Discovered on IBM i Server!

    SB PowerTech WC GenericMalicious programs can bring entire businesses to their knees—and IBM i shops are not immune. It’s critical to grasp the true impact malware can have on IBM i and the network that connects to it. Attend this webinar to gain a thorough understanding of the relationships between:

    • Viruses, native objects, and the integrated file system (IFS)
    • Power Systems and Windows-based viruses and malware
    • PC-based anti-virus scanning versus native IBM i scanning

    There are a number of ways you can minimize your exposure to viruses. IBM i security expert Sandi Moore explains the facts, including how to ensure you're fully protected and compliant with regulations such as PCI.

     

     

  • Encryption on IBM i Simplified

    SB PowerTech WC GenericDB2 Field Procedures (FieldProcs) were introduced in IBM i 7.1 and have greatly simplified encryption, often without requiring any application changes. Now you can quickly encrypt sensitive data on the IBM i including PII, PCI, PHI data in your physical files and tables.
    Watch this webinar to learn how you can quickly implement encryption on the IBM i. During the webinar, security expert Robin Tatam will show you how to:

    • Use Field Procedures to automate encryption and decryption
    • Restrict and mask field level access by user or group
    • Meet compliance requirements with effective key management and audit trails

     

  • Lessons Learned from IBM i Cyber Attacks

    SB PowerTech WC GenericDespite the many options IBM has provided to protect your systems and data, many organizations still struggle to apply appropriate security controls.
    In this webinar, you'll get insight into how the criminals accessed these systems, the fallout from these attacks, and how the incidents could have been avoided by following security best practices.

    • Learn which security gaps cyber criminals love most
    • Find out how other IBM i organizations have fallen victim
    • Get the details on policies and processes you can implement to protect your organization, even when staff works from home

    You will learn the steps you can take to avoid the mistakes made in these examples, as well as other inadequate and misconfigured settings that put businesses at risk.

     

     

  • The Power of Coding in a Low-Code Solution

    SB PowerTech WC GenericWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed.
    Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

    • Discover the benefits of Low-code's quick application creation
    • Understand the differences in model-based and language-based Low-Code platforms
    • Explore the strengths of LANSA's Low-Code Solution to Low-Code’s biggest drawbacks

     

     

  • The Biggest Mistakes in IBM i Security

    SB Profound WC Generic The Biggest Mistakes in IBM i Security
    Here’s the harsh reality: cybersecurity pros have to get their jobs right every single day, while an attacker only has to succeed once to do incredible damage.
    Whether that’s thousands of exposed records, millions of dollars in fines and legal fees, or diminished share value, it’s easy to judge organizations that fall victim. IBM i enjoys an enviable reputation for security, but no system is impervious to mistakes.
    Join this webinar to learn about the biggest errors made when securing a Power Systems server.
    This knowledge is critical for ensuring integrity of your application data and preventing you from becoming the next Equifax. It’s also essential for complying with all formal regulations, including SOX, PCI, GDPR, and HIPAA
    Watch Now.

  • Comply in 5! Well, actually UNDER 5 minutes!!

    SB CYBRA PPL 5382

    TRY the one package that solves all your document design and printing challenges on all your platforms.

    Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product.

    Request your trial now!

  • Backup and Recovery on IBM i: Your Strategy for the Unexpected

    FortraRobot automates the routine tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:
    - Simplified backup procedures
    - Easy data encryption
    - Save media management
    - Guided restoration
    - Seamless product integration
    Make sure your data survives when catastrophe hits. Try the Robot Backup and Recovery Solution FREE for 30 days.

  • Manage IBM i Messages by Exception with Robot

    SB HelpSystems SC 5413Managing messages on your IBM i can be more than a full-time job if you have to do it manually. How can you be sure you won’t miss important system events?
    Automate your message center with the Robot Message Management Solution. Key features include:
    - Automated message management
    - Tailored notifications and automatic escalation
    - System-wide control of your IBM i partitions
    - Two-way system notifications from your mobile device
    - Seamless product integration
    Try the Robot Message Management Solution FREE for 30 days.

  • Easiest Way to Save Money? Stop Printing IBM i Reports

    FortraRobot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing.
    Manage your reports with the Robot Report Management Solution. Key features include:

    - Automated report distribution
    - View online without delay
    - Browser interface to make notes
    - Custom retention capabilities
    - Seamless product integration
    Rerun another report? Never again. Try the Robot Report Management Solution FREE for 30 days.

  • Hassle-Free IBM i Operations around the Clock

    SB HelpSystems SC 5413For over 30 years, Robot has been a leader in systems management for IBM i.
    Manage your job schedule with the Robot Job Scheduling Solution. Key features include:
    - Automated batch, interactive, and cross-platform scheduling
    - Event-driven dependency processing
    - Centralized monitoring and reporting
    - Audit log and ready-to-use reports
    - Seamless product integration
    Scale your software, not your staff. Try the Robot Job Scheduling Solution FREE for 30 days.