Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Converting Special format to normal integer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Converting Special format to normal integer
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: 3158
Location: Tucson AZ

PostPosted: Thu Jan 11, 2007 3:00 pm    Post subject: Re: special format to normal integer
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 Moderator


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

PostPosted: Thu Jan 11, 2007 10:31 pm    Post subject:
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: 1452
Location: Chicago, IL

PostPosted: Fri Jan 12, 2007 10:06 am    Post subject: Re: Converting Special format to normal integer
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    Post subject:
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    Post subject: Re: Converting Special format to normal integer
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 Moderator


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

PostPosted: Fri Jan 12, 2007 9:54 pm    Post subject:
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    Post subject: Converting Special format to normal integer
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

Site Director


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

PostPosted: Mon Feb 28, 2011 3:40 am    Post subject:
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    Post subject: Converting Special format to normal integer
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

Site Director


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

PostPosted: Mon Feb 28, 2011 5:01 am    Post subject: Reply to: Converting Special format to normal integer
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us