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
 

 

Would like to sort records and sum up the values at the same

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

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Thu Jul 10, 2008 4:09 pm    Post subject: Would like to sort records and sum up the values at the same
Reply with quote

Hi,

I have the following situation.

I have two files with following

Layout:

Column1 x(03)
Column2 x(03)
Column3 9(03)
Column4 9(03)

and data as follows:
File1

Code:


PDPMED200100
LMSMED300150
CFOCOM050040


File2

Code:

PDPMED300150
XYZCOM200100
CFOCOM030020



I would like to sort the above 2 files on the basis of column1(descending) and column2(ascending) and create a single file. Also would like to add up the column3 in the first file with column3 in the second file for that particular record.

O/p File

Code:

MEDPDP500250
MEDLMS300150
COMCFO080060
COMXYZ200100


Please could anyone let me know if this is possible with sort.
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Thu Jul 10, 2008 9:29 pm    Post subject:
Reply with quote

muffirulz,

Your output does NOT match the Sort criteria you mentioned. How did CFO record come before XYZ record? You dont seem to follow the same rule for first 2 records

Assuming that it is a typo here is DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=ICEMAN         
//SYSOUT   DD SYSOUT=*             
//SORTIN   DD *                     
PDPMED200100                       
LMSMED300150                       
CFOCOM050040                       
PDPMED300150                       
XYZCOM200100                       
CFOCOM030020                       
//SORTOUT  DD SYSOUT=*             
//SYSIN    DD *                     
  INREC OVERLAY=(13:4,3,1,3)       
  SORT FIELDS=(4,3,CH,D,1,3,CH,A)   
  SUM FIELDS=(7,3,ZD)               
  OUTREC BUILD=(13,6,7,6)           
//*                                 


The output from this job is

Code:

MEDLMS300150
MEDPDP500100
COMCFO080040
COMXYZ200100
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Fri Jul 11, 2008 6:21 pm    Post subject: Reply to: Would like to sort records and sum up the values a
Reply with quote

Thanks skolusu.

I had one more question,

Cosider the following

Layout

Column1 x(03)
Column2 x(03)
Column3 9(03)
Column4 9(03)
Column5 x(10)


File1

Code:

PDPMED2001002007-01-11
LMSMED3001502007-01-10
CFOCOM0500402007-01-09
 


File2

Code:


PDPMED3001502007-01-01
XYZCOM2001002007-01-02
CFOCOM0300202007-01-04



Now in the O/p I would like the result as
Code:


MEDLMS300150
MEDPDP500100
COMCFO080040
COMXYZ200100



i.e drop the date part in the output file.
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Fri Jul 11, 2008 7:59 pm    Post subject: Reply to: Would like to sort records and sum up the values a
Reply with quote

I a sorry for the mistake that has occured previously. Let me specify the problem once more

Following is the layout of the i/p file
Code:

05 WS-MTHLY-LINE-OF-BUSINESS   PIC X(03)                     
05 WS-MTHLY-FORM-TYPE          PIC X(03)             
05 WS-MTHLY-IMAGE-CNT                 PIC 9(07)
05 WS-MTHLY-BADIMG-CNT                  PIC 9(07)
05 WS-MTHLY-NETTOTAL-CNT                   PIC 9(07)
05 WS-MTHLY-AUDIT-DATE      PIC X(10)
05 WS-FILLER         PIC X(63)


Below is the file 1

Code:

COMLMS0000015000000200000132008/07/01
COMCVB0000085000001500000702008/07/01
COMDFG0000039000001700000222008/07/01
MEDWER0000059000002600000332008/07/01
MEDGHJ0000087000002100000662008/07/01
MEDREF0000015000000200000132008/07/01
MEDQXS0000025000000300000222008/07/01


File2
Code:

COMLMS0000025000001200000132008/07/02
COMDFG0000039000000700000322008/07/02
MEDGHJ0000066000002000000462008/07/02
COMCVB0000085000001500000702008/07/02
MEDWER0000059000002600000332008/07/02
MEDQXS0000025000000300000222008/07/02
MEDREF0000035000001200000232008/07/02


The o/p required is below

Code:

MEDGHJ000015300000410000112
MEDQXS000005000000060000044
MEDREF000005000000140000036
MEDWER000011800000520000066
COMCVB000017000000300000140
COMDFG000007800000240000054
COMLMS000004000000140000026


Basically the o/p file should have the same record length as of input file but should skip the date from the i/p.

Would appreciate if anyone could provide a solution soon.

Thanks,
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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am


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