Cobol data file
Moderators: chulett, rschirm, roy
Cobol data file
Hi all,
In my Cobol source file, I have field as S(5)V99.The values are like
000770{
001690D
000845B
011250{
I tried to use DataTypePicS9 / DataTypePicComp3V99 / DataTypeEbcdicPic9V99
But I could not convert and load it into my target DB (Oracle)
Please some though some light ...
thanks in advance,
In my Cobol source file, I have field as S(5)V99.The values are like
000770{
001690D
000845B
011250{
I tried to use DataTypePicS9 / DataTypePicComp3V99 / DataTypeEbcdicPic9V99
But I could not convert and load it into my target DB (Oracle)
Please some though some light ...
thanks in advance,
Thank you,
Anu
Anu
Your EBCDIC is allready transfered to ASCII so use this function:
FUNCTION SwitchEBCDICSign(Arg1)
Laenge=len(Arg1)
Links=Arg1[1,Laenge-1]
Hyro=SEQ(Arg1[1])
BEGIN CASE
CASE Hyro >= 65 AND Hyro <= 73; Ans=(Links:Hyro-64)+0
CASE Hyro >= 74 AND Hyro <= 82; Ans=(Links:Hyro-73)*-1
CASE Hyro=249 ; Ans=(Links:"0")+0
CASE Hyro=166 ; Ans=(Links:"0")*-1
CASE Hyro=228 ; Ans=(Links:"0")+0
CASE Hyro=252 ; Ans=(Links:"0")*-1
CASE Hyro >= 48 AND Hyro <= 57; Ans=( Links:Hyro-48 )+0
CASE @TRUE ; Ans=@NULL
END CASE
RETURN(Ans)
FUNCTION SwitchEBCDICSign(Arg1)
Laenge=len(Arg1)
Links=Arg1[1,Laenge-1]
Hyro=SEQ(Arg1[1])
BEGIN CASE
CASE Hyro >= 65 AND Hyro <= 73; Ans=(Links:Hyro-64)+0
CASE Hyro >= 74 AND Hyro <= 82; Ans=(Links:Hyro-73)*-1
CASE Hyro=249 ; Ans=(Links:"0")+0
CASE Hyro=166 ; Ans=(Links:"0")*-1
CASE Hyro=228 ; Ans=(Links:"0")+0
CASE Hyro=252 ; Ans=(Links:"0")*-1
CASE Hyro >= 48 AND Hyro <= 57; Ans=( Links:Hyro-48 )+0
CASE @TRUE ; Ans=@NULL
END CASE
RETURN(Ans)
Wolfgang Hürter
Amsterdam
Amsterdam
WoMaWil wrote:Your EBCDIC is allready transfered to ASCII so use this function:
FUNCTION SwitchEBCDICSign(Arg1)
Laenge=len(Arg1)
Links=Arg1[1,Laenge-1]
Hyro=SEQ(Arg1[1])
BEGIN CASE
CASE Hyro >= 65 AND Hyro <= 73; Ans=(Links:Hyro-64)+0
CASE Hyro >= 74 AND Hyro <= 82; Ans=(Links:Hyro-73)*-1
CASE Hyro=249 ; Ans=(Links:"0")+0
CASE Hyro=166 ; Ans=(Links:"0")*-1
CASE Hyro=228 ; Ans=(Links:"0")+0
CASE Hyro=252 ; Ans=(Links:"0")*-1
CASE Hyro >= 48 AND Hyro <= 57; Ans=( Links:Hyro-48 )+0
CASE @TRUE ; Ans=@NULL
END CASE
RETURN(Ans)
thank you very much WoMaWil. I created a Routine with above code. and when I converted
SwitchEBCDICSign(001690D) =16904
SwitchEBCDICSign(000845B) =8452
But the Routine is not returning any thing for below values.
SwitchEBCDICSign(000770{) = null
SwitchEBCDICSign(011250{) = null
Lately, tried to convert the incoming S9(5)V99 with DataTypePicComp3V99().But this function returning a value like "30303012345.57".But I think, this value should be like "30303.57"(Number(5,2)), as incoming field is of S9(5)V99.I guess, S9(5)V99 = Decimal(5,2). Some one please correct me if I am wrong.
DSSIDDU, thanks for the reply. I do not have .cfd. I have lot of source fields. Can we define them in CFF stage manually?
thanks in advance,
Thank you,
Anu
Anu
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If you're unfamiliar with COBOL I'm afraid a full explanation would not make any sense. Basically, CFD stands for "COBOL File Definition", which is a file containing metadata - in a particular format - that describe the data in some other, data, file. COBOL uses a concept called "levels" to represent structured data, and uses a number of "COMP" (computational) data types to represent packed decimal data. It is these with which you are trying to deal.
Maybe using Wolfgang's routine, or an appropriate modification of it, will be better for you. I had assumed, since you were working with COBOL data, that you were COBOL-"literate".
Maybe using Wolfgang's routine, or an appropriate modification of it, will be better for you. I had assumed, since you were working with COBOL data, that you were COBOL-"literate".
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.
Hi,
To fill my needs more precisely I wrote my own version of the SwitchEBCDICSign.
Function SwitchEBCDICSign(Montant)
LMontant=Trim(Montant)
Longeur=len(LMontant)
Lien=LMontant[1,Longeur-1]
Car=SEQ(Right(LMontant,1))
if num(LMontant) then Ans=LMontant
else
* Call DSLogInfo("Montant ":LMontant,"TRACE")
* Call DSLogInfo("Longeur ":Longeur,"TRACE")
* Call DSLogInfo("Lien ":Lien,"TRACE")
* Call DSLogInfo("1car ":LMontant[1],"TRACE")
* Call DSLogInfo("Car ":Car,"TRACE")
Begin CASE
* Entre A et I
CASE Car >= 65 AND Car <= 73
Ans=(Lien:Car-64)+0
* Entre J et R
CASE Car >= 74 AND Car <= 82
Ans=(Lien:Car-73)*-1
* Cf Ascii Etendue
CASE Car=249
Ans=(Lien:"0")+0
* Cf en Ascii Etendue
CASE Car=166
Ans=(Lien:"0")*-1
* {
CASE Car=123
Ans=(Lien:"0")*-1
* }
CASE Car=125
Ans=(Lien:"0")*-1
* Cf en Ascii Etendue
CASE Car=228
Ans=(Lien:"0")+0
* Cf en Ascii Etendue
CASE Car=252
Ans=(Lien:"0")*-1
* Entre 0 et 9
CASE Car >= 48 AND Car <= 57
Ans=( Lien:Car-48 )+0
* Autre cas
CASE @TRUE
Ans=@NULL
END CASE
end
RETURN(Ans)
To fill my needs more precisely I wrote my own version of the SwitchEBCDICSign.
Function SwitchEBCDICSign(Montant)
LMontant=Trim(Montant)
Longeur=len(LMontant)
Lien=LMontant[1,Longeur-1]
Car=SEQ(Right(LMontant,1))
if num(LMontant) then Ans=LMontant
else
* Call DSLogInfo("Montant ":LMontant,"TRACE")
* Call DSLogInfo("Longeur ":Longeur,"TRACE")
* Call DSLogInfo("Lien ":Lien,"TRACE")
* Call DSLogInfo("1car ":LMontant[1],"TRACE")
* Call DSLogInfo("Car ":Car,"TRACE")
Begin CASE
* Entre A et I
CASE Car >= 65 AND Car <= 73
Ans=(Lien:Car-64)+0
* Entre J et R
CASE Car >= 74 AND Car <= 82
Ans=(Lien:Car-73)*-1
* Cf Ascii Etendue
CASE Car=249
Ans=(Lien:"0")+0
* Cf en Ascii Etendue
CASE Car=166
Ans=(Lien:"0")*-1
* {
CASE Car=123
Ans=(Lien:"0")*-1
* }
CASE Car=125
Ans=(Lien:"0")*-1
* Cf en Ascii Etendue
CASE Car=228
Ans=(Lien:"0")+0
* Cf en Ascii Etendue
CASE Car=252
Ans=(Lien:"0")*-1
* Entre 0 et 9
CASE Car >= 48 AND Car <= 57
Ans=( Lien:Car-48 )+0
* Autre cas
CASE @TRUE
Ans=@NULL
END CASE
end
RETURN(Ans)
thurmy34 wrote:Hi,
To fill my needs more precisely I wrote my own version of the SwitchEBCDICSign.
Function SwitchEBCDICSign(Montant)
LMontant=Trim(Montant)
Longeur=len(LMontant)
Lien=LMontant[1,Longeur-1]
Car=SEQ(Right(LMontant,1))
if num(LMontant) then Ans=LMontant
else
* Call DSLogInfo("Montant ":LMontant,"TRACE")
* Call DSLogInfo("Longeur ":Longeur,"TRACE")
* Call DSLogInfo("Lien ":Lien,"TRACE")
* Call DSLogInfo("1car ":LMontant[1],"TRACE")
* Call DSLogInfo("Car ":Car,"TRACE")
Begin CASE
* Entre A et I
CASE Car >= 65 AND Car <= 73
Ans=(Lien:Car-64)+0
* Entre J et R
CASE Car >= 74 AND Car <= 82
Ans=(Lien:Car-73)*-1
* Cf Ascii Etendue
CASE Car=249
Ans=(Lien:"0")+0
* Cf en Ascii Etendue
CASE Car=166
Ans=(Lien:"0")*-1
* {
CASE Car=123
Ans=(Lien:"0")*-1
* }
CASE Car=125
Ans=(Lien:"0")*-1
* Cf en Ascii Etendue
CASE Car=228
Ans=(Lien:"0")+0
* Cf en Ascii Etendue
CASE Car=252
Ans=(Lien:"0")*-1
* Entre 0 et 9
CASE Car >= 48 AND Car <= 57
Ans=( Lien:Car-48 )+0
* Autre cas
CASE @TRUE
Ans=@NULL
END CASE
end
RETURN(Ans)
thanks Ray. I will look for alternative. I have requested for .cfg file. Thanks for the code thurmy34.
Thank you,
Anu
Anu
-
- Participant
- Posts: 16
- Joined: Fri Apr 28, 2006 1:01 pm
Hi,
Could you please send new version of SwitchEBCDICSign to patrickmn10@yahoo.com, Also let me know what values did u test, give me some examples of that.
thanks
Could you please send new version of SwitchEBCDICSign to patrickmn10@yahoo.com, Also let me know what values did u test, give me some examples of that.
thanks
Hi,thurmy34 wrote:Hi,
Does anyone interested by a new version of the SwitchEBCDICSign routine ?
Yes would be most interested. Can you please send the routine to jnguy@bigpond.net.au
Thanks,
Nick
Hi All
If you were instered by the SwitchEBCDICSign function take a look a t this topic
viewtopic.php?t=101163
Maybe it's better to use the sdk ?
I will try this myself ang keep you posted.
Regards
If you were instered by the SwitchEBCDICSign function take a look a t this topic
viewtopic.php?t=101163
Maybe it's better to use the sdk ?
I will try this myself ang keep you posted.
Regards