The problem we need to solve:

  • We want to examine the GL Distribution Code (in the GL Buffer as positions 51 for 50 characters)
    • If segment three is one of three distinct values, then we want to bypass this record
    • If segments one through three is a specific value then we want to bypass this record

We can do this simply by replacing an existing single variable with GL Buffer as the IDIF variable defined. The earlier in the record structure you can do your bypassing logic, the sooner the UPGLF program can move on to the next record, if necessary.

For purposes of this example, we will presume that the first variable on the file would be PERSON CODE (in the GL Buffer as positions 119 for 16 characters).

If we change the IDIF to use GL BUFFER as the Variable rather than PERSON_CODE, we can then use the following derivation expression:

CASE WHEN (substr(~,61,5) = '11101') then 'BYPASS'
     WHEN (substr(~,61,5) = '28805') then 'BYPASS'
     WHEN (substr(~,61,5) = '28806') then 'BYPASS'
     WHEN (substr(~,51,15) = '100-00000-00000') then 'BYPASS'
     ELSE trim(substr(~,119,16))
END
  • Here we examine the distribution code, third segment with substr(~,61,5) in a CASE WHEN statement for each of the three values that we want to bypass, and if true, return the word 'BYPASS' to the variable. This causes the UPGLF function to discard the record and read the next.
  • We also examine the distribution code for the first three segments with substr(~,51,15) for our specific value, and if true also discard the record.
  • If none of these conditions are true, we return the PERSON_CODE with trim(substr(~,119,16)) which retrieves the person code out of the GL BUFFER, and strips off the trailing spaces with the TRIM command.