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

Remove decimal part in PD field with out changing length


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

New User


Joined: 26 Oct 2006
Posts: 50
Location: Chennai

PostPosted: Wed Jan 21, 2009 2:08 pm
Reply with quote

Hi,

Good day every one. I would appreciate if some one assist to do the below.
I have a input file with the below layout.

Comp-Num pic s9(3). Position 4,3
BEGINING PIC S9(13)V99 COMP-3. Position 47,8
EARNED PIC S9(13)V99 COMP-3. Position 55,8
ADJUSTED PIC S9(13)V99 COMP-3. Position 63,8
REDEEMED PIC S9(13)V99 COMP-3. Position 71,8
TRAN-OUT PIC S9(13)V99 COMP-3. Position 79,8
TRAN-IN PIC S9(13)V99 COMP-3. Position 87,8
FORFEITED PIC S9(13)V99 COMP-3. Position 95,8
LAPSED PIC S9(13)V99 COMP-3. Position 103,8
AVAILABLE PIC S9(13)V99 COMP-3. Position 111,8

I want to remove all the decimal part in all COMP-3 field for particular company 400 thru sort with out changing the field length.

For example, if the BEGINING having the value 100.50 and the AVAILABLE having the value of 13434.44 in input file
then the output should have BEGINING as 100 and AVAILABLE should have the value of 13434 in the output file.
Please note that the length should not be changed.

Output file should be matched with the input file layout. So after removing the decimal part we should be able to match all
the field with S9(13)V99 COMP-3.

Also this is the VSAM file
Back to top
View user's profile Send private message
technut

New User


Joined: 27 Dec 2007
Posts: 73
Location: India

PostPosted: Wed Jan 21, 2009 4:11 pm
Reply with quote

You could convert the COMP-3 variable to alphanumeric variable and then use UNSTRING DELIMITED BY '.'
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Jan 21, 2009 4:43 pm
Reply with quote

Quote:
You could convert the COMP-3 variable to alphanumeric variable and then use UNSTRING DELIMITED BY '.'


UNSTRING in DFSORT?

I assume you want to round all the amounts down, so 13434.44 becomes 13434.00, and not 134.34.

You might convert the field to ZD during INREC processing, appending to end of the record, and overlay the last two characters of that field with zeroes. Then in OUTREC processing, convert that work field to PD, overlaying the original field and remove the work field?

Garry.
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Wed Jan 21, 2009 5:22 pm
Reply with quote

Quote:
For example, if the BEGINING having the value 100.50 and the AVAILABLE having the value of 13434.44 in input file
then the output should have BEGINING as 100 and AVAILABLE should have the value of 13434 in the output file.
Please note that the length should not be changed.

Output file should be matched with the input file layout. So after removing the decimal part we should be able to match all
the field with S9(13)V99 COMP-3.


After removing the decimal if you match with the same file layout, it will again show the decimal part.

(i.e) After removing the decimal part 13434.44 to 13434, if match the resulted value with the same input structure it will look like 134.34 . Do you want this as the result. If not give your requirement more clear, with an example of INPUT and OUTPUT, and the rules clearly.
Back to top
View user's profile Send private message
technut

New User


Joined: 27 Dec 2007
Posts: 73
Location: India

PostPosted: Wed Jan 21, 2009 6:15 pm
Reply with quote

I meant doing this through Cobol(UNSTRING in COBOL). Requestor did not say that he wants this to be done through DFSORT only. Did not notice that post was in DFSORT.
Back to top
View user's profile Send private message
bbharathiraj
Warnings : 1

New User


Joined: 26 Oct 2006
Posts: 50
Location: Chennai

PostPosted: Wed Jan 21, 2009 6:39 pm
Reply with quote

After removing the decimal if you match with the same file layout, it will again show the decimal part
Yes. You are right. Thanks to highlight this.
So I suppose to change to change decimal part to 00.
I have tried with outrec. But it didn't give expected result.
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: Wed Jan 21, 2009 10:15 pm
Reply with quote

100.50 as an 8-byte PD value looks like this in hex:

000000000010050C

13434.44 as an 8-byte PD values looks like this in hex:

000000001343444C

If you want the output values to look like this:

000000000010000C

000000001343400C

You can use DFSORT control statements like the following:

Code:

  OPTION COPY
  INREC OVERLAY=(47:(47,8,PD,DIV,+100),MUL,+100,TO=PD,LENGTH=8,
     55:(55,8,PD,DIV,+100),MUL,+100,TO=PD,LENGTH=8,
     63:(63,8,PD,DIV,+100),MUL,+100,TO=PD,LENGTH=8,
     ...)


I assumed all of your values are positive. If they can be positive or negative, let me know and I'll show you how to handle that.
Back to top
View user's profile Send private message
bbharathiraj
Warnings : 1

New User


Joined: 26 Oct 2006
Posts: 50
Location: Chennai

PostPosted: Thu Jan 22, 2009 6:31 am
Reply with quote

Hi Frank,

Yes. The value can be negative or positive.
Could you please provide me to handle this?
Thanks a lot
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 22, 2009 7:35 am
Reply with quote

I take it back. It does work for both positive and negative values as coded.
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 Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top