Data Express provides the UDCXML1 data masking routine as a template for processing XML data. You can use the template as-is, or customize and/or replicate it according to your needs.
The sections that follow explain how to customize the STARTING-OPERATIONS section in the UDCXML1 template to manage:
Source XML can be stored in DB2 using any of several supported character sets such as EBCDIC, ASCII, various dialects of EBCDIC and ASCII, or even custom character sets.
To correctly manage this, the engine called by the data masking routine needs to know the character set in use so it can appropriately process the data. Depending on the specified character set, the data masking engine performs certain tasks such as the transforming of single-byte characters from one set to another, transforming EBCDIC to ASCII before processing, and recoding any transformed characters back to the original character set before writing the output.
By default, the character set specified to Data Express is "*NONE", meaning that no character transforming is required. This assumes that the data being parsed is in EBCDIC and uses the same code page as is specified in your Data Express mainframe installation:
STARTING-OPERATIONS. * * CHARACTER SET * * MOVE "ASCII" TO WS-CHARSET. * MOVE "EBCDIC" TO WS-CHARSET. MOVE "*NONE" TO WS-CHARSET.
In addition to ASCII and EBCDIC, you can customize this value to represent an alternative or a custom character set.
For example:
10 TRASC03. 15 TAB-TRASC03 PIC X(16) VALUE 'NO-TRASX'. 15 EL-TRASC03-001 PIC X(2) VALUE X'0000'. 15 EL-TRASC03-002 PIC X(2) VALUE X'0101'. 15 EL-TRASC03-003 PIC X(2) VALUE X'0202'. . . . 15 EL-TRASC03-256 PIC X(2) VALUE X'0000'.
10 TAB-VALUE03 PIC X(16). 10 TAB-EL03 PIC X(2) OCCURS 256 TIMES.
To pass data to a masking routine, you code several MOVE statements in the STARTING-OPERATIONS section. Before starting:
Data Express provides the WS-NUMTAG(n) field to hold the total number of data masking object instances to process, and provides the following three fields to identify the data and the masking routine for each instance. Each data masking object instance uses all three fields:
The following example shows code used to move the data from eight XML data object instances to their appropriate masking routines:
*--------------------------------------------------------------- * STARTING-OPERATIONS. . . . * * MASKING ROUTINE * MOVE 8 TO WS-NUMTAG. MOVE "Nm" TO WS-TAG (1). MOVE 255 TO WS-LEN1 (1). MOVE "ADLER" TO WS-ROUTINE (1). MOVE "AdrLine" TO WS-TAG (2). MOVE 255 TO WS-LEN1 (2). MOVE "ADLER" TO WS-ROUTINE (2). MOVE "Mndt,Dbtr,Id,PrvtId,Othr,Id" TO WS-TAG (3). MOVE 16 TO WS-LEN1 (3). MOVE "UDCCDFC" TO WS-ROUTINE (3). MOVE SPACES TO WS-TAG (4). STRING "UndrlygAccptncDtls,OrgnlMndt,OrgnlMndt," DELIMITED BY SIZE "Dbtr,Id,PrvtId,Othr,Id" DELIMITED BY SIZE INTO WS-TAG (4). MOVE 16 TO WS-LEN1 (4). MOVE "UDCCDFC" TO WS-ROUTINE (4). MOVE "BirthDt" TO WS-TAG (5). MOVE 10 TO WS-LEN1 (5). MOVE "UDCMDY0" TO WS-ROUTINE (5) MOVE "NOME" TO WS-TAG (6). MOVE 255 TO WS-LEN1 (6). MOVE "UDCNAMC" TO WS-ROUTINE (6) MOVE "COGNOME" TO WS-TAG (7). MOVE 255 TO WS-LEN1 (7). MOVE "UDCSURC" TO WS-ROUTINE (7). MOVE "TAXCODE" TO WS-TAG (8). MOVE 16 TO WS-LEN1 (8). MOVE "UDCCDFC" TO WS-ROUTINE (8). STARTING-OPERATIONS-EX.
You can customize the following algorithm to set the output PDS. The name of the variable to use is WS-PDS-OUT:
*--------------------------------------------------------------- * STARTING-OPERATIONS. . . . * * OUTPUT PDS NAMING CONVENTION * MOVE SPACES TO WS-PDS-OUT. STRING "XXX.YYY." DELIMITED BY SIZE WS-METODO DELIMITED BY SPACES "." DELIMITED BY SIZE WS-TABELLA DELIMITED BY SPACES ".LIB" DELIMITED BY SIZE INTO WS-PDS-OUT.