IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Converting Special format to normal integer


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mflax

New User


Joined: 01 Sep 2006
Posts: 17
Location: Delhi

PostPosted: Thu Jan 11, 2007 10:57 am
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jan 11, 2007 3:00 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jan 11, 2007 10:31 pm
Reply with quote

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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Jan 12, 2007 10:06 am
Reply with quote

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
View user's profile Send private message
manihcl85
Warnings : 1

New User


Joined: 11 Jan 2007
Posts: 52
Location: chennai

PostPosted: Fri Jan 12, 2007 10:36 am
Reply with quote

use IFTHEN and OVERLAY function in that u can very well replace an character with whatever field u want.
Back to top
View user's profile Send private message
mflax

New User


Joined: 01 Sep 2006
Posts: 17
Location: Delhi

PostPosted: Fri Jan 12, 2007 8:54 pm
Reply with quote

Thank You Priyesh, that solved my problem.

icon_lol.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jan 12, 2007 9:54 pm
Reply with quote

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
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Mon Feb 28, 2011 2:37 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Feb 28, 2011 3:40 am
Reply with quote

Hello,

Good to hear this was useful icon_smile.gif

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
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Mon Feb 28, 2011 4:00 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Feb 28, 2011 5:01 am
Reply with quote

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. . . icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
Search our Forums:

Back to Top