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

Changing the precision of a comp3 field


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

New User


Joined: 05 Apr 2010
Posts: 41
Location: Kolkata,India

PostPosted: Tue Jan 08, 2013 3:06 pm
Reply with quote

Hi,

In my file i have a comp3 field [S9(2)V9(4) COMP-3].I need to convert this field into a S9(2)V9(4) COMP-3 field.My input file looks like this.

Code:
 ACCTNO    PRDINC    PRDPRN   
9/AN      4/PS      20/AN   
(1-9)     (10-13)   (14-33) 
2-------- 3-------- 4--------
Record--1   20.1235 Trailer1
Record--2    0.0015 Trailer2
Record--3   11.0150 Trailer3
Record--4         0 Trailer4
Record--5   11.0004 Trailer5
Record--6    4.7800 Trailer6


My expected ouput file

Code:

ACCTNO2   PRDINC2  PRDPRN2   
9/AN      3/PS     20/AN     
(1-9)R    (10-12)R (13-24)R 
6-------- 7------- 8---------
Record--1    20.12 Trailer1 
Record--2        0 Trailer2 
Record--3    11.01 Trailer3 
Record--4        0 Trailer4 
Record--5    11.00 Trailer5 
Record--6     4.78 Trailer6


Can it be done with sort?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jan 08, 2013 5:24 pm
Reply with quote

Well, you can divide the field by 100 and put the result back where the field came from.

You can temporarily add a Zoned Decimal to the file, source it from the comp-3, then put it back in the original site of the comp-3 but having reduced the length of the Zoned Decimal by two, although this becomes more complex with a signed field, like you have.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jan 08, 2013 11:13 pm
Reply with quote

razesh84 wrote:
Hi,

In my file i have a comp3 field [S9(2)V9(4) COMP-3].I need to convert this field into a S9(2)V9(4) COMP-3 field.My input file looks like this.


You mean S9(2)V9(2) ? You have the same for both input and output.

Use the following control cards.
Code:

//SYSIN    DD *                                 
  OPTION COPY                                   
  INREC OVERLAY=(10:10,4,PD,DIV,+100,PD,LENGTH=4)
//*
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts changing defaults in db2 admin - Unlo... DB2 0
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top