High/low value identify

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

techsavy
Participant
Posts: 26
Joined: Sat Jan 10, 2015 11:11 am
Location: India

Post by techsavy »

If (Convert(CHAR(255),'', Trim(A))='')
OR (Convert(CHAR(0),'', Trim(A))='')
Then 0 Else 1

Col A reading in CFF as binary
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Convert only works on strings, as does your comparison... and trim.
-craig

"You can never have too many knives" -- Logan Nine Fingers
techsavy
Participant
Posts: 26
Joined: Sat Jan 10, 2015 11:11 am
Location: India

Post by techsavy »

okay got it. So is there anyway to do with a binary column? column is a COMP field as per copybook.
techsavy
Participant
Posts: 26
Joined: Sat Jan 10, 2015 11:11 am
Location: India

Post by techsavy »

Any clue friends?
I want to detect high/low field in a binary field in datastage.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use a RawToString() conversion.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That or I would think you could build equivalent binary stage variables to check against.
-craig

"You can never have too many knives" -- Logan Nine Fingers
techsavy
Participant
Posts: 26
Joined: Sat Jan 10, 2015 11:11 am
Location: India

Post by techsavy »

Craig- binary stage variable means?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Basically it means a stage variable of the same data type and size as the incoming values you want to compare it to. And then you define one to have an initial value of all low values and another to have all high values as essentially constants during the job run. Then you would compare your incoming values to the stage variables. This rather than converting everything to strings.

In pondering this I'm not sure it is actually possible as I don't recall what data types are supported for stage variables. But at a high level, as generic advice, I've done things like that many times.
-craig

"You can never have too many knives" -- Logan Nine Fingers
techsavy
Participant
Posts: 26
Joined: Sat Jan 10, 2015 11:11 am
Location: India

Post by techsavy »

Actually I tried with RawTostring() but no luck. I am not sure when I am doing a view on source file in CFF the high value looks like '-1'.
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

It seems like the CFF stage has done all of the work for you. Sounds to me like your binary input has been converted to a signed integer. In that case, low values (all bits off) will have an integer value of 0, and high values (all bits on) will have an integer value of -1.

Mike
techsavy
Participant
Posts: 26
Joined: Sat Jan 10, 2015 11:11 am
Location: India

Post by techsavy »

Looks like that Mike. but I am just wondering what is the decimal value to use for high value in job.
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

Now that I know this is a COMP field, the situation is different.

COMP is a storage format for a numeric value. It is not convertible to string in the usual sense, nor do you really want to think of it as "binary" data except in the FTP protocol sense.

You have a field of a certain length. Signed or unsigned, it has a minimum value of 0 and a maximum value of dec15 (F) in each position. Your check should be on that maximum value, not on the hex codes.

PIC 9(4) COMP has a maximum value of 9,999. One approach would be a logic statement like

Code: Select all

If Abs(col1) > 0 And Abs(col1) < 9999
would give you an active filter for all values in the column that you want to pass on, and a reject link could take the rest.

The odd thing about this is finding all xF in a COMP field. This is not standard practice that I'm aware of. I suggest checking back with your data source folks to find out why this is being done. In the meantime, to bypass the confusion, look to the actual storage of the field, and work your logic from that. If the COMP value is stored in a 2-byte storage length, then your maximum value is 65,535 (xFFFF).
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
techsavy
Participant
Posts: 26
Joined: Sat Jan 10, 2015 11:11 am
Location: India

Post by techsavy »

Thanks Franklin. This is really usefull info. So shall I need to find out min and max for each such field?
As you said its a COMP filed, import as INTEGER in CFF stage.
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

The short answer is yes, that would be my choice. In the meantime, I believe you have a design issue with the high-values being set in a COMP field. I suggest you follow up on that with your Cobol team.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
Post Reply