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
 

 

Remove decimal part in PD field with out changing length

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Remove decimal part in PD field with out changing length
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    Post subject: Reply to: Remove decimal part in PD field with out changing
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

Active Member


Joined: 08 May 2006
Posts: 995
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed Jan 21, 2009 4:43 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Remove decimal part in PD field with out changing
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    Post subject: Reply to: Remove decimal part in PD field with out changing
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 Moderator


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

PostPosted: Wed Jan 21, 2009 10:15 pm    Post subject:
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    Post subject: Reply to: Remove decimal part in PD field with out changing
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 Moderator


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

PostPosted: Thu Jan 22, 2009 7:35 am    Post subject:
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    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 BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 1 Tue Jul 25, 2017 12:12 am
No new posts RMM: scratching a volume that RMM thi... Hervey Martinez IBM Tools 0 Mon May 15, 2017 8:51 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts Length of Tape file Mohan Kothakota JCL & VSAM 9 Thu Apr 20, 2017 10:24 pm


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