EBCDIC numeric check

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

Post Reply
infranik
Participant
Posts: 20
Joined: Tue Oct 11, 2005 8:11 am

EBCDIC numeric check

Post by infranik »

Is there any way we can check if a particular EBCDIC field is numeric ?
I am reading an ebcdic file in a parallel job and reading the field as char because I need to do the numeric check.
I tried the NUM() and ISVALID(int32,)functions but its not returning true even if its numeric value in the field.

has anyone faced such a scenario?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Those functions are expecting ASCII data, AFAIK, so you'd need to convert the field to use them. These aren't packed fields, are they?
-craig

"You can never have too many knives" -- Logan Nine Fingers
infranik
Participant
Posts: 20
Joined: Tue Oct 11, 2005 8:11 am

Post by infranik »

thanks chulett,
they are packed fields i am trying to check if numeric.
can we use the NUM () function on packed field? my data is being read and shown properly when i say 'view data' .
(i have set file properties as EBCDIC and binary and packed=yes.)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Once they're "unpacked" then sure, those functions should work fine.
-craig

"You can never have too many knives" -- Logan Nine Fingers
infranik
Participant
Posts: 20
Joined: Tue Oct 11, 2005 8:11 am

Post by infranik »

perfectly right that the function should work on the unpacked data (thats what i have got in my plate so far) but can we do those validations or checking on an unpacked EBCDIC data?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Assuming that last "unpacked" should say "packed"... no, not as far as I know. Happy for someone to prove me wrong, however.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not possible (except in original COBOL application, of course) without unpacking.

Well, that's not entirely true, but it would need to be a custom routine to examine each possible bit pattern of each pair of bytes (allowing for byte order of the hardware, of course), which would probably be slower than unpacking.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
infranik
Participant
Posts: 20
Joined: Tue Oct 11, 2005 8:11 am

Post by infranik »

Thanks guys..
Ray- I had a similar suggestion from a collegue telling me to maybe check the last bit of the packed field to compare if that is numeric.
A COBOL program to do the unpacking would take a long time (because of the size of the data) and consume resources on the mainframe.
I am trying a workaround for this and will update this post as soon as i find something worthwhile. maybe otherwise the business would have to live by the fact that this is a suspected technical limitation.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why a mainframe COBOL program, do you not need to unpack these fields regardless in your job? The job is doing that automatically when the file is read in, as you noted, so I'm honestly curious - why the need to check anything while it's still packed? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
infranik
Participant
Posts: 20
Joined: Tue Oct 11, 2005 8:11 am

Post by infranik »

We found a workaround for this issue.
Read the EBCDIC file in a SEQ file Stage allowing all Nulls(i.e.Nullable=Yes on all fields) .
the non numeric fields are implicitly replaced by a NULL value/s (High Values \xFF in our case) and we eliminate the need for checking if data is numeric - inside the DS job. DS also reads all the records in the file without dropping any.
Please PM me if anyone needs a further explanation.

regards,
Nikhil.
Post Reply