Validating all fields of a row & send errors to ErrFile/

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The usual technique is to capture them individually in stage variables then use other stage variables to assemble the output message.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
WORKING_GRUNT
Participant
Posts: 7
Joined: Wed Aug 03, 2005 1:14 pm

Post by WORKING_GRUNT »

Hi, Thanks for replying so fast.

I am capturing each field individually and storing them in separate stage variables but I cannot seem to get more then 1 error message per row. I am rather new to DS and there may be something subtle that I not aware of with this technique.

For example ...
Acct# Chk# ID AcctCde ChkAmt
123A 2222 ABC 100.00

If there is an error in the account number field and the account code field I would like to be able to format the following records

ErrDesc Acct# Chk# ID AcctCde ChkAmt
Non-Numeric. Acct# 123A .....................................
AcctCde Required 123A ....................................

I only get the last message, I cannot get the first error message.

Again any help would be most appreciated. Sorry for the long winded post.

Thanks ... Working Grunt. :D
rleishman
Premium Member
Premium Member
Posts: 252
Joined: Mon Sep 19, 2005 10:28 pm
Location: Melbourne, Australia
Contact:

Post by rleishman »

I have seen an idea posted in this forum whereby you concatenate the messages with a line feed character (ASCII 10) between each one, and them write them directly to a sequential file.
So, if a single input row has 4 errors, a single "row" is written to the output but it actually comes out as 4 rows.
A file is the ONLY place you can write them. If you direct the output to any other kind of stage it won't work.
Ross Leishman
jenkinsrob
Participant
Posts: 31
Joined: Mon Dec 01, 2003 6:24 am
Location: London

Post by jenkinsrob »

If you have 3 errors on the same row in your source file do you want three rows in your Oracle table or 1 row detailing the 3 source errors??
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Create validation stage variables of the kind

Code: Select all

If test Then " " Else "Column x is bad because..."
Note that each has a space character if the column is good.

To create a single message with all, simply concatenate these all together, then apply a Trim() function to reduce any extraneous internal space.

Code: Select all

Trim(svValidate1 : svValidate2 : svValidate3)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

And you can put a char(10) at the start of each test message to make it appear on a seperate row. You can output both an error header file and an error item file, the header has some columns that identify the job name and process information (process identification and date) and something that identifies the row being processed. The item rows have details about the errors that occurred on that row. The char(10) format the output so the items follow the headers to make the file readable or loadable into a database.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I posted a routine that does this called KgdDebugMetadata. I think it is also on my tips page. The sequential file needs to be small because it reads it into a variable. It could be changed to readseq if you want. If you can figure it out then use it.
Mamu Kim
WORKING_GRUNT
Participant
Posts: 7
Joined: Wed Aug 03, 2005 1:14 pm

Post by WORKING_GRUNT »

To all who replied ....

[color=blue][size=9]Thank you![/size] [/color]

I am in the process of redesigning my job to accommodate what was suggested.

Thanks again for all your help.

:D
Post Reply