Author Topic: User exit in C - need advice  (Read 35 times)

ssorich

  • Newbie
  • *
  • Posts: 4
    • View Profile
User exit in C - need advice
« on: October 05, 2017, 08:02:43 AM »
We already have an exit that changes all x00 to x20... I donlt know C language, but I am trying to change only the value in column1 to spaces instead of all characters... Is anybody familiar with how to change the code to do so? Thanks!

Here is the source:
#include "apkexits.h"                                                           
                                                                     

char *recordptr; /* pointer to record to be analyzed */
int recordlen; /* length of record to be analyzed */

long ACIF_EXPORT INPEXIT( INPEXIT_PARMS *exitstruc)
{

   recordptr = exitstruc->record;
   recordlen = exitstruc->recordln;
   int cnt = 0;


   if(exitstruc->eof != INP_EOFLAG)
   {

      for (cnt = 0; cnt < recordlen; cnt++ ) {
         if ((unsigned char) exitstruc->record[cnt] == 0x00) {
            exitstruc->record[cnt] = 0x20;
         }
      }

      exitstruc->request = INP_USE;
   }

   return( 0 );
}

Justin Derrick

  • IBM Content Manager OnDemand Consultant
  • Administrator
  • Hero Member
  • *****
  • Posts: 1348
  • CMOD Guru for hire...
    • View Profile
    • Tenacious Consulting
Re: User exit in C - need advice
« Reply #1 on: October 05, 2017, 01:37:04 PM »
I'm not a C programmer, so I'm not super clear on what's inside that pointer you're being passed in that code. 

If it's a single line of a linedata report, then you could place restrictions on the position (i.e. array offset) of the characters that you're optionally replacing.

Alternately, if you're just getting a buffer of X characters, then you'd need to look for a line ending character followed immediately by the character you want to replace.

Hopefully some other folks with more experience can chime in and get you closer to a solution.

-JD.
#Install, #Educate, #Repair, #Upgrade, #Migrate, #Enhance, #Optimize.

Call:  +1-866-533-7742
Click:  http://JustinDerrick.com/
eMail:  jd@justinderrick.com
IBM CMOD Wiki:  http://CMOD.wiki/

Interests:  #AIX6 #AIX7 #Linux #Multiplatforms #DB2v9 #DB2v10 #TSM #Tivoli #Performance #Security #Audits #Customizing #Availability #HA #DR #Training

ssorich

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: User exit in C - need advice
« Reply #2 on: October 06, 2017, 09:03:19 AM »
Thanks Justin - and agreed - it's one substring or array value from what I want t to be