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

Consolidating Comp-3 data and changing the PIC Format


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

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Thu Mar 31, 2011 6:21 pm
Reply with quote

Hi,
I have a requirement where I would have to consolidate(add) a particular field(position 334,7) for every account number(position 16,9). The field to be summed up has the picture clause defined as PIC S9(11)V9(2) COMP-3. But after I sum it up I have to put the value into PIC S9(14)V9(4) COMP-3. The challenge I am facing is in the location of the decimal point when I use the sort card below. The value which has to be 495688.89 after summing appears as 4956.8889. The Input file has a LRECL=550, RECFM=FB.

Please help me resolve this issue.
Code:

//SYSIN    DD *                                 
  SORT FIELDS=(16,9,CH,A)                       
  SUM FIELDS=(334,7,PD)                         
  OUTFIL BUILD=(16,9,X,334,7,PD,TO=PD,LENGTH=10)


Thanks,
Ashwin.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Mar 31, 2011 11:13 pm
Reply with quote

hailashwin,

You have increased your decimals from 2 to 4. What value would you like to store? ex : 495688.89 what do you expect in S9(14)V9(4) COMP-3? is it 495688.0089 or 495688.8900
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Fri Apr 01, 2011 10:30 am
Reply with quote

Hi Kolusu,
I want the summed up value to be stored in S9(14)V9(4) COMP-3.
I will give you an example for a better understanding of what I am expecting. Here in the input file, the value that is seen is of PIC S9(11)V9(2) COMP-3. But when I write to the output file, I want the field to be in a S9(14)V9(4) COMP-3 which carries the total for each occurance of the 9 byte value.

Input:
Code:

AAAAAAAAA....25.25
BBBBBBBBB....10.40
AAAAAAAAA....11.67
AAAAAAAAA....12.87
BBBBBBBBB....11.11
CCCCCCCCC....89.99


Expected Output:
Code:

AAAAAAAAA   49.7900
BBBBBBBBB   21.5100
CCCCCCCCC   89.9900


Thanks,
Ashwin.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Apr 01, 2011 9:39 pm
Reply with quote

hailashwin,

Unless I am missing something, isn't it a simple like multiplying the 7 byte pd field with +100 and making it a 10 byte field? Use the following control cards.

Code:

//SYSIN    DD *                                           
  INREC BUILD=(16,9,X,334,7,PD,MUL,+100,PD,LENGTH=10)     
  SORT FIELDS=(01,9,CH,A)                                 
  SUM FIELDS=(11,10,PD)                                   
//*


The output is 20 byte file. If you do want to verify the summed values then you can use an OUTREC statement to see the pd value in edit format {S9(14)V9(4)} as shown below

Code:

  OUTREC OVERLAY=(22:11,10,PD,EDIT=(STTTTTTTTTTTTTT.TTTT),SIGNS=(+,-))
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
Search our Forums:

Back to Top