MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reformat the Edited Numeric field to implicit decimal format

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
priya173
Beginner


Joined: 04 May 2006
Posts: 10
Topics: 6
Location: India

PostPosted: Thu Feb 22, 2007 3:03 pm    Post subject: Reformat the Edited Numeric field to implicit decimal format Reply with quote

Hi,

I have a huge file (length 4939) with a lot of numeric fields in explicit decimal format. But since I need to perform few arithmetic operations on these fields, I would want to get them converted to the Implicit decimal format.

I tried the Fileaid reformat option but then it is not converting few fields in the occurs clause. Can someone help me with some utility to do it. I do not want to write a COBOL program for this.

Input fields:
-------------
Amt1 PIC 9(9).9(2)
Amt2 PIC 9(5).9(5)

Output fields:
---------------
Amt1 PIC 9(9)V9(2)
Amt2 PIC 9(5)V9(5)
_________________
Regards,
Subha
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Feb 22, 2007 3:36 pm    Post subject: Reply with quote

Quote:

But since I need to perform few arithmetic operations on these fields, I would want to get them converted to the Implicit decimal format.



priya173,

You can still perform Arthimetic operations with explicit decimal point within SORT using the UFF and SFF formats. Show us an sample input and desired output and we will show you a way to do it

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
priya173
Beginner


Joined: 04 May 2006
Posts: 10
Topics: 6
Location: India

PostPosted: Thu Feb 22, 2007 3:52 pm    Post subject: Example for Reformat fields Reply with quote

Input File
0000111.000111 0000222.000222
0000222.000222 0000333.000333
0000333.000333 0000444.000444

Output File
0000333.000333
0000555.000555
0000777.000777

All that I want to do is add the two fieds and write the sum in the output files. The output file amount could be in any format
_________________
Regards,
Subha
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Feb 22, 2007 4:09 pm    Post subject: Reply with quote

Subha,

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
0000111.000111 0000222.000222
0000222.000222 0000333.000333
0000333.000333 0000444.000444
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(1,14,UFF,ADD,16,14,UFF,
    EDIT=(TTTTTTT.TTTTTT))
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Feb 22, 2007 4:09 pm    Post subject: Reply with quote

priya73,

try this


Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD *                         
0000111.000111 0000222.000222           
0000222.000222 0000333.000333           
0000333.000333 0000444.000444           
//SORTOUT  DD SYSOUT=*                   
//SYSIN    DD *                         
 SORT FIELDS=COPY                       
 OUTREC FIELDS=(01,14,UFF,ADD,16,14,UFF,
                EDIT=(IIIIIIT.TTTTTT))   
/*                     


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
priya173
Beginner


Joined: 04 May 2006
Posts: 10
Topics: 6
Location: India

PostPosted: Thu Feb 22, 2007 11:26 pm    Post subject: Reply with quote

Actually the example was a much simpler one in relaity I have to read 3 files and based on the value of the files I need to perform few arithmetic operations.

Like...

File1
Emp_Dep and Sal

File2
Emp_Id and Rating

Calculation

If Emp_Dep = 'INS" and Rating = '1' then
Hike = (Sal * 0.40 ) + Sal

There are 25 fields like this so we thought of converting the numeric fields and then using the output file.

Kindly let me know if this is possible.
_________________
Regards,
Subha
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Feb 23, 2007 7:47 am    Post subject: Reply with quote

priya173,

Why are you wasting time? Why can't you tell us the requirement properly at once ? Search the board for examples of matching files and apply the logic shown above for calculation


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group