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
 

 

Help needed on DFSORT

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

New User


Joined: 29 May 2007
Posts: 50
Location: hyderabad

PostPosted: Fri Mar 20, 2009 12:04 pm    Post subject: Help needed on DFSORT
Reply with quote

Following is the DB2 QUERY:
Code:
SELECT SOURCE_CODE, DATA_SOURCE, ICN, REL_LINE_NBR,
       CONTRACT_NBR, MEMBER_NBR, ADJUST_INDIC,
       SUM (BILLED_AMT) BILL, SUM (PAYMENT_AMT) PYMT,
       SUM (WITHHOLD_AMT) WHLD, COUNT(*) CTR,
       MAX (FIN_CYCLE_DT) FIN_CYCLE_DT,'1'
FROM DSNV.DWS_CLAIMS_L_MTH
GROUP BY SOURCE_CODE, DATA_SOURCE, ICN, REL_LINE_NBR,
         CONTRACT_NBR, MEMBER_NBR, ADJUST_INDIC
ORDER BY SOURCE_CODE, DATA_SOURCE, ICN, REL_LINE_NBR,
         CONTRACT_NBR, MEMBER_NBR, ADJUST_INDIC;


My requirement is, I want to execute the same query using SORT.
I can extract data from table using select * from DSNV.DWS_CLAIMS_L_MTH, which can be input to SORT

Code:
LAYOUT OF INPUT FILE:      BYTES                                STARTING POSITION
SOURCE_CODE            - PIC X(2)                              19
DATA_SOURCE             - PIC X(2)                              106
ICN, REL_LINE_NBR       - PIC X(16)                             3
CONTRACT_NBR            - PIC X(12)                             42
MEMBER_NBR              - PIC X(2)                              54
ADJUST_INDIC            - PIC X(1)                              64
BILLED_AMT              - PIC  S9(9)V9(2) USAGE COMP-3          289
FIN_CYCLE_DT            - PIC  S9(9)V9(2) USAGE COMP-3          65
Back to top
View user's profile Send private message

vinothsubramanian

New User


Joined: 01 Sep 2006
Posts: 39
Location: Chennai, India

PostPosted: Fri Mar 20, 2009 12:58 pm    Post subject:
Reply with quote

Do you want to format the output file by mapping each field to any specific bytes or can it be retained as it is in the input file.
Back to top
View user's profile Send private message
vinothsubramanian

New User


Joined: 01 Sep 2006
Posts: 39
Location: Chennai, India

PostPosted: Fri Mar 20, 2009 1:01 pm    Post subject:
Reply with quote

Positions and Pic class of Payment_amt and withhold_amt
Back to top
View user's profile Send private message
bnveena

New User


Joined: 29 May 2007
Posts: 50
Location: hyderabad

PostPosted: Fri Mar 20, 2009 1:35 pm    Post subject: Reply to: Help needed on DFSORT
Reply with quote

I want to reformat the output file having only those fields which are present in selct query
Back to top
View user's profile Send private message
bnveena

New User


Joined: 29 May 2007
Posts: 50
Location: hyderabad

PostPosted: Fri Mar 20, 2009 1:39 pm    Post subject:
Reply with quote

Payment_amt S9(9)V9(2) USAGE COMP-3 295

withhold_amt S9(9)V9(2) USAGE COMP-3 302
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Mar 20, 2009 10:05 pm    Post subject: Reply to: Help needed on DFSORT
Reply with quote

bnveena,

The following DFSORT JCL will give you the desired results.

Using an INREC we only pick the fileds we are interested. I Put all your GROUP by fields at pos 1 and we sort on the first 35 bytes which is your GROUP BY clause length and using outfil sections we feature we get the desired results.

When you have GROUP BY the ORDER BY is a mute unless your order by clause is different from the Group by.

Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN=Your unload file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  INREC BUILD=(019,02,                 $ SOURCE CODE         
               106,02,                 $ DATA SOURCE         
               003,16,                 $ ICN,REL LINE NBR   
               042,12,                 $ CONTRACT NUMBER     
               054,02,                 $ MEMBER NUMBER       
               064,01,                 $ ADJUST INDIC       
               065,06,                 $ FIN CYCLE DT       
               289,06,                 $ BILLED AMT         
               295,06,                 $ PAYMENT AMT         
               302,06)                 $ WITHHOLD AMT       
                                                             
  SORT FIELDS=(1,35,CH,A)                                   
                                                             
  OUTFIL REMOVECC,NODETAIL,BUILD=(64X),                     
  SECTIONS=(1,35,                                           
  TRAILER3=(1,35,                                           
            TOT=(42,06,PD,PD,LENGTH=6),                     
            TOT=(48,06,PD,PD,LENGTH=6),                     
            TOT=(54,06,PD,PD,LENGTH=6),                     
            COUNT=(BI,LENGTH=4),                             
            MAX=(36,06,PD,PD,LENGTH=6),                     
            '1'))                     
/*
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 How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am
No new posts Help Needed with View Direct shailesh_do CA Products 2 Wed Jul 13, 2016 10:39 am
No new posts Symbolic Parameters in SYSIN DD state... madishpa DFSORT/ICETOOL 3 Mon Jun 27, 2016 6:23 pm


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