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
 

 

To sort the file by record key

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

New User


Joined: 13 Feb 2008
Posts: 9
Location: hyderabad

PostPosted: Wed Feb 13, 2008 5:07 pm    Post subject: To sort the file by record key
Reply with quote

1. To sort the file by record key which include the below fields and accumaulate the total under that key
01 (WS)-RECORD.
03 (WS)-REC-KEY.
05 (WS)-WHIRL-ORG PIC 9(03).
05 (WS)-OWNING-BRANCH PIC 9(09).
05 (WS)-ORIGIN-SOURCE PIC X(05).
05 (WS)-AFFINITY-GRP.
07 (WS)-PARTNER PIC X(04).
07 (WS)-AFFINITY PIC X(04).
07 (WS)-AFFILIATION PIC X(04).
07 (WS)-SUB-AFFILIATION PIC X(04).
07 (WS)-REWARDS-LEVEL PIC X(04).
For example:

if the input file contains that data
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEE
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEE
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEE
080XXXXXXXXXYYYYYFFFFBBBBCCCCDDDDGGG
080XXXXXXXXXHHHHHFFFFBBBBCCCCDDDDGGG
080XXXXXXXXXYYYYYFFFFBBBBCCCCDDDDGGG
080XXXXXXXXXHHHHHFFFFBBBBCCCCDDDDGGG

the out put file should contains
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEE3
080XXXXXXXXXYYYYYFFFFBBBBCCCCDDDDGGG2
080XXXXXXXXXHHHHHFFFFBBBBCCCCDDDDGGG2

The last byte like 3,2&2 should specify the count of records with the same key


01 (WS)-RECORD.
03 (WS)-REC-KEY.
05 (WS)-WHIRL-ORG PIC 9(03).
05 (WS)-OWNING-BRANCH PIC 9(09).
05 (WS)-ORIGIN-SOURCE PIC X(05).
05 (WS)-AFFINITY-GRP.
07 (WS)-PARTNER PIC X(04).
07 (WS)-AFFINITY PIC X(04).
07 (WS)-AFFILIATION PIC X(04).
07 (WS)-SUB-AFFILIATION PIC X(04).
07 (WS)-REWARDS-LEVEL PIC X(04).
03 (WS)-TOTAL-APPS PIC S(09) COMP-3.
03 FILLER PIC X(38).


[/list][/code]
Back to top
View user's profile Send private message

shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Wed Feb 13, 2008 5:32 pm    Post subject:
Reply with quote

Hi praveen_kandrakota,

Please check with the following code for your requirement.
Code:
// EXEC PGM=SORT                                       
//SYSOUT DD SYSOUT=*                                   
//SORTIN DD *                                         
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEE                 
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEE                 
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEE                 
080XXXXXXXXXYYYYYFFFFBBBBCCCCDDDDGGGG                 
080XXXXXXXXXHHHHHFFFFBBBBCCCCDDDDGGGG                 
080XXXXXXXXXYYYYYFFFFBBBBCCCCDDDDGGGG                 
080XXXXXXXXXHHHHHFFFFBBBBCCCCDDDDGGGG                 
//SORTOUT DD SYSOUT=*                                 
//SYSIN DD *                                           
 SORT FIELDS=(1,37,CH,A)                               
 OUTFIL REMOVECC,NODETAIL,                             
 SECTIONS=(1,37,TRAILER3=(1,37,COUNT=(TO=PD,LENGTH=5)))
/*                                                     
//     

Output: (HEX ON MODE)
Code:
080XXXXXXXXXHHHHHFFFFBBBBCCCCDDDDGGGG    :                                     
FFFEEEEEEEEECCCCCCCCCCCCCCCCCCCCCCCCC0000244444444444444444444444444444444444444
08077777777788888666622223333444477770000C00000000000000000000000000000000000000
 ------------------------------------------------------------------------------
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEE    :                                     
FFFEEEEEEEEEEEEEECCCCCCCCCCCCCCCCCCCC0000344444444444444444444444444444444444444
08077777777788888111122223333444455550000C00000000000000000000000000000000000000
 ------------------------------------------------------------------------------
080XXXXXXXXXYYYYYFFFFBBBBCCCCDDDDGGGG    :                                     
FFFEEEEEEEEEEEEEECCCCCCCCCCCCCCCCCCCC0000244444444444444444444444444444444444444
08077777777788888666622223333444477770000C00000000000000000000000000000000000000
 ------------------------------------------------------------------------------

Thanks,
Shankar
Back to top
View user's profile Send private message
praveen_kandrakota

New User


Joined: 13 Feb 2008
Posts: 9
Location: hyderabad

PostPosted: Wed Feb 13, 2008 6:01 pm    Post subject: Reply to: To sort the file by record key
Reply with quote

hi sankar,

If you dont mine could you please explain about NODETAIL , Trailer3 and COUNT=(TO=PD) parameters
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Thu Feb 14, 2008 3:39 pm    Post subject:
Reply with quote

Hi praveen_kandrakota,
Quote:
could you please explain about NODETAIL , Trailer3 and COUNT=(TO=PD) parameters

Please find the information regarding NODETAIL, TRAILER3 and COUNT=(TO=PD) in the below link.

http://publibz.boulder.ibm.com/zoslib/pdf/ice1ca20.pdf

Thanks,
Shankar
Back to top
View user's profile Send private message
praveen_kandrakota

New User


Joined: 13 Feb 2008
Posts: 9
Location: hyderabad

PostPosted: Thu Feb 14, 2008 3:43 pm    Post subject: Reply to: To sort the file by record key
Reply with quote

Thanks alot
Back to top
View user's profile Send private message
praveen_kandrakota

New User


Joined: 13 Feb 2008
Posts: 9
Location: hyderabad

PostPosted: Thu Feb 14, 2008 9:26 pm    Post subject: incorect output file
Reply with quote

Hi sankar,

i have created job in the below

Code:

//STEP030  EXEC PGM=SORT
//SORTIN    DD DSN=DERP.CP000000.CDMH.FFB.NFL,               
//             DISP=SHR                                     
//SORTOUT   DD DSN=DERP.CP000000.CDMH.FFB.NFLMOTLY(+1),     
//             DISP=(,CATLG,DELETE),                     
//             SPACE=(CYL,(20,10),RLSE)     
//SYSOUT    DD SYSOUT=*                                     
//SYSIN     DD *                                             
   SORT FIELDS=(1,37,CH,A)                                   
   OUTFIL REMOVECC,NODETAIL,                                 
     SECTIONS=(1,37,TRAILER3=(1,37,COUNT=(TO=PD,LENGTH=5))) 
/*                 


The input file contains the data as follows.

Code:

080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEEFFFF2
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEEFFFF3
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEEFFFF4
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEEFFFF1
080YYYYYYYYYZZZZZGGGGBBBBCCCCDDDDEEEEFFFF2
080WWWWWWWWWAAAAAHHHHBBBBCCCCDDDDEEEEFFFF3
080UUUUUUUUUSSSSSAAAABBBBCCCCDDDDEEEEFFFF4
080YYYYYYYYYZZZZZGGGGBBBBCCCCDDDDEEEEFFFF5
080WWWWWWWWWAAAAAHHHHBBBBCCCCDDDDEEEEFFFF7
080UUUUUUUUUSSSSSAAAABBBBCCCCDDDDEEEEFFFF8
080YYYYYYYYYZZZZZGGGGBBBBCCCCDDDDEEEEFFFF5


The opput file should be like

Code:

080UUUUUUUUUSSSSSAAAABBBBCCCCDDDDEEEE2
080WWWWWWWWWAAAAAHHHHBBBBCCCCDDDDEEEE2
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEE2
080YYYYYYYYYZZZZZGGGGBBBBCCCCDDDDEEEE3


The last digit specifies the count of the reccords of same key

but the output is creating as below

Code:

080UUUUUUUUUSSSSSAAAABBBBCCCCDDDDEEEE.....
080WWWWWWWWWAAAAAHHHHBBBBCCCCDDDDEEEE.....
080XXXXXXXXXYYYYYAAAABBBBCCCCDDDDEEEE....<
080YYYYYYYYYZZZZZGGGGBBBBCCCCDDDDEEEE.....


Could you please let me know what is incorrect
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Feb 14, 2008 9:59 pm    Post subject:
Reply with quote

Hello,

Your output appears correct - you specified PD which is not readable (hence the "dots" and special characters). If you look at the file with HEX ON, you will see valid packed-decimal numbers.
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 Changing sort Card Dynamically vickey_dw DFSORT/ICETOOL 2 Sat Aug 19, 2017 2:33 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 10 Fri Aug 18, 2017 10:50 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm


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