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
 

 

Consolidating Comp-3 data and changing the PIC Format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 73
Location: Boston

PostPosted: Thu Mar 31, 2011 6:21 pm    Post subject: Consolidating Comp-3 data and changing the PIC Format
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    Post subject: Reply to: Consolidating Comp-3 data and changing the PIC For
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: 73
Location: Boston

PostPosted: Fri Apr 01, 2011 10:30 am    Post subject:
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    Post subject: Reply to: Consolidating Comp-3 data and changing the PIC For
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    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 Paasing symbolic parameter to instrea... Anirudh Anand JCL & VSAM 0 Thu Jul 27, 2017 1:22 pm
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 3 Wed Jul 26, 2017 9:11 pm
No new posts Passing data from REXX to C programme... chong.zhou All Other Mainframe Topics 0 Wed Jul 26, 2017 4:55 pm
No new posts BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 4 Tue Jul 25, 2017 12:12 am
No new posts copying data without knowing location arunsoods DFSORT/ICETOOL 8 Thu Jul 20, 2017 1:03 pm


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