EBCDIC numeric check
Moderators: chulett, rschirm, roy
EBCDIC numeric check
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?
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?
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
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.
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.
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
"You can never have too many knives" -- Logan Nine Fingers
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.
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.