View previous topic :: View next topic
|
Author |
Message |
mflax
New User
Joined: 01 Sep 2006 Posts: 17 Location: Delhi
|
|
|
|
Hi,
I have an amt field in a specified format, like below. Can we convert it to normal integer using jcl.
Code: |
0624H = 62.48
1173F = 117.36
1272B = 127.22 |
where char at last digit correspond to 1-9 for A-I and we have to make output integer as 2 place decimal.
Thank You. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Hi,
mflax wrote: |
I have an amt field in a specified format, like below. Can we convert it to normal integer using jcl.
0624H = 62.48
1173F = 117.36
1272B = 127.22
where char at last digit correspond to 1-9 for A-I and we have to make output integer as 2 place decimal. |
DFSORT has several functions to take care of the imbeded sign and, IIRC, sort can take care of editing in the decimal point.
Have you taken the time to look at other threads?
Have you looked at DFSORT's tricks doc?
Have you looked at any fine manuals?
Answers abound, waiting for you to harvest them....
Bill |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
mflax,
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
0624H
1173F
1272B
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC FIELDS=(1,5,ZD,EDIT=(IIT.TT))
/*
|
|
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
mflax...
As my tiny brain cells & week memory goes with this format, it has got more than what you say. where every character at last position represents an integer with a sign.
Code: |
'A' 1 'J' -1
'B' 2 'K' -2
'C' 3 'L' -3
'D' 4 'M' -4
'E' 5 'N' -5
'F' 6 'O' -6
'G' 7 'P' -7
'H' 8 'Q' -8
'I' 9 'R' -9
'{' 0 '}' -0 |
So if you have an 'R' at last position, that should mean a negative value with a 9 as last integer.
Same way '}' denotes a negative value with a Zero as last integer.
A little modification in the job provided by Frank would exactly do what probably you "should have" asked for.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
0624H
1173F
1272B
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC FIELDS=(1,5,ZD,EDIT=(SIIT.TT),SIGNS=(,-))
/* |
P.S. Pls excuse me, if your case is different than what I described for. |
|
Back to top |
|
|
manihcl85 Warnings : 1 New User
Joined: 11 Jan 2007 Posts: 52 Location: chennai
|
|
|
|
use IFTHEN and OVERLAY function in that u can very well replace an character with whatever field u want. |
|
Back to top |
|
|
mflax
New User
Joined: 01 Sep 2006 Posts: 17 Location: Delhi
|
|
|
|
Thank You Priyesh, that solved my problem.
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
mflax,
Since you only showed positive values, I assumed that's all you had. If you had showed negative values as well, I would have shown you how to handle those as Priyesh did. Please try to give all of the information for your requirement in the future. |
|
Back to top |
|
|
madmartinsonxx
New User
Joined: 10 Dec 2010 Posts: 96 Location: Massachusetts
|
|
|
|
Thanks for letting me find this post!! I have not seen 'stuff' as old as what i am working with right now in 15 years. Rigid as all get out. This post got us through 3 reports we needed to deliver. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Good to hear this was useful
If the system/reports are 15 years old are they written using SORT or COBOL? Those fields would simply be PIC S9(3)V99 in cobol and could be directly moved to the report or used in computations. . . |
|
Back to top |
|
|
madmartinsonxx
New User
Joined: 10 Dec 2010 Posts: 96 Location: Massachusetts
|
|
|
|
Dick,
Thanks. The systems are that old but these extracts for conversion reconcilation purposes came from who knows where over the last year. We are looking at s9(10)v9(4) fields and every other combination of signed fields you can imagine. After I got this current request I was looking at the '{' and '}' fields in the file and I was taken aback for a second because I knew i had seen them before but it didn't grab me like an apple does. The lady that has the request wanted us to change them to their respective 'char' in excel. Which would take a week, probably. with all the mistakes one can make in there. One quick poke over here and I had what her dear lil heart desired. The Infosphere guys here don't have a clue as to what their looking at so it's up to the dinosaurs to give the data meaningful interpretation. Again , many thanks for keeping this board working. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Yup, for what it's worth, i've found that sending completely "Win-friendly" data to the pc works every time. Takes a tiny bit to reformat and delimit on the mainframe, but prevents tons of grief for the Win-user. . .
d |
|
Back to top |
|
|
|