Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
mflax

New User

Joined: 01 Sep 2006
Posts: 17
Location: Delhi

Posted: Thu Jan 11, 2007 10:57 am    Post subject: Converting Special format to normal integer

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.

William Thompson

Global Moderator

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

Posted: Thu Jan 11, 2007 3:00 pm    Post subject: Re: special format to normal integer

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
Frank Yaeger

DFSORT Moderator

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

Posted: Thu Jan 11, 2007 10:31 pm    Post subject:

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)) /*
priyesh.agrawal

Senior Member

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

Posted: Fri Jan 12, 2007 10:06 am    Post subject: Re: Converting Special format to normal integer

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.
manihcl85
Warnings : 1

New User

Joined: 11 Jan 2007
Posts: 52
Location: chennai

 Posted: Fri Jan 12, 2007 10:36 am    Post subject: use IFTHEN and OVERLAY function in that u can very well replace an character with whatever field u want.
mflax

New User

Joined: 01 Sep 2006
Posts: 17
Location: Delhi

 Posted: Fri Jan 12, 2007 8:54 pm    Post subject: Re: Converting Special format to normal integer Thank You Priyesh, that solved my problem.
Frank Yaeger

DFSORT Moderator

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

 Posted: Fri Jan 12, 2007 9:54 pm    Post subject: 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.

New User

Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

 Posted: Mon Feb 28, 2011 2:37 am    Post subject: Converting Special format to normal integer 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.
dick scherrer

Site Director

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

 Posted: Mon Feb 28, 2011 3:40 am    Post subject: 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. . .

New User

Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

 Posted: Mon Feb 28, 2011 4:00 am    Post subject: Converting Special format to normal integer 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.
dick scherrer

Site Director

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

 Posted: Mon Feb 28, 2011 5:01 am    Post subject: Reply to: Converting Special format to normal integer 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
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm FTP data transfer from PC to Mainfram... AJAYREDDY All Other Mainframe Topics 8 Wed Aug 23, 2017 9:59 pm Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us