Previous Topic

Next Topic

Book Contents

Book Index

Example

This example illustrates how function MSUBSTMASK can be used to modify strings in a USERBLOCK process (SUBSDATE) by removing the first 2 digits in the year field.

Figure 246 ON COMPARE Statement Example

EXECUTE 'RECONCIL'

ON_COMPARE

 SOURCE1

DD 'DDBEFORE' PROCESS USERBLOCK 'SUBSDATE'

 SOURCE2

DD 'DD#AFTER'

  WHEN FLINE 1 TLINE 80 FCOL 1 TCOL 80 SEARCH '.AL.'

 DO EXTRACT 'DIFFDESC' LEVEL 0 LINE +0 FCOL 1 TCOL 80

 DO PRINT DATA '%%DIFFDESC'

EXECUTE 'END'

ON_DATA

  ALWAYS

  DO TERMINATE RESULT OK USER-CODE 0

EXECUTE 'SUBSDATE'

ON_DATA

   ALWAYS

  DO SET 'RC' EVAL 'MSUBSTMASK(''DDSUBST'',SYSCURLINE)'

SYSCURLINE is the long-string variable that contains the string that is currently being processed. DDSUBST is enclosed by double quotes because the MSUBSTMASK function is enclosed by single quotes inside a DO SET statement. DDSUBST contains the following lines:

//DDSUBST DD *

SUBSTFROM '??/??/19??' SUBSTTO '??/??/??' EOS

SUBSTFROM '??/??/20??' SUBSTTO '??/??/??' EOS

/*

For an example of how function MSUBSTMASK can be used for converting currencies, see Euro Support.

Parent Topic

ON COMPARE: Data Selection Parameter