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

Sort on IMS DB unloads


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rajasekhar K

New User


Joined: 07 Jul 2009
Posts: 3
Location: India

PostPosted: Fri Jul 31, 2009 5:00 pm
Reply with quote

Hi,

Please anyone help on this.

I am using Sycsort Z/OS 1.3.1 version. I have IMS DB unloads which is VB length(4000).The file have one level1 segment(01) and six level2 segments(02).I want the file to be sorted on the basis of expiry date which is present in the level1 segment(starts-26,4).The file structure is as follows:
Pos 1-2 - Level number (01,02,02…,01,02,02,….)
Pos 3-10 -Segment Name
Pos 11-12 -Length of each segment(variable length)
After Pos 12 - Data
For example: (expiry date format is year month—YYMM)
Input file:
01segment1..xxxxxxxxxxxxx9912xxxxxxxxxxxxxxxxxxx
02segment2..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment3..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment4..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment5..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment6..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
01segment1..xxxxxxxxxxxxx0912xxxxxxxxxxxxxxxxxxx
02segment2..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment3..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment4..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment5..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment6..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
01segment1..xxxxxxxxxxxxx1009xxxxxxxxxxxxxxxxxxx
02segment2..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment3..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment4..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment5..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment6..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

The Output should be:
01segment1..xxxxxxxxxxxxx0912xxxxxxxxxxxxxxxxxxx
02segment2..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment3..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment4..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment5..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment6..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
01segment1..xxxxxxxxxxxxx1009xxxxxxxxxxxxxxxxxxx
02segment2..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment3..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment4..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment5..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment6..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
01segment1..xxxxxxxxxxxxx9912xxxxxxxxxxxxxxxxxxx
02segment2..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment3..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment4..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment5..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02segment6..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

The sort should be segment level group only like segment 1,2,2,2,2,2,2,segment1,2,2,2,2,2,2 …so on.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Aug 04, 2009 12:11 pm
Reply with quote

Rajasekhar K,

Welcome to the forums.

Can you explain how 9912 is coming last in your expected output. When handling 2-digit YY year fields, you need to be sure about how the century part CC has to be expanded before sorting. Are you considering this as 2099?.
Back to top
View user's profile Send private message
Rajasekhar K

New User


Joined: 07 Jul 2009
Posts: 3
Location: India

PostPosted: Tue Aug 04, 2009 12:56 pm
Reply with quote

Hi,

Thank you for your reply.

The last year century Never come in the Input file.Input file contains the expiry date as "0010" means 2000-october and "9912" means
2099-december only.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Aug 05, 2009 10:44 am
Reply with quote

Rajasekhar K,

The below SYNCTOOL job should work for your requirement.
Code:
//STEP0100 EXEC PGM=SYNCTOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//IN       DD DSN= Input file  (VB/4000)                           
//T1       DD DSN=&&T1,UNIT=SYSDA,DISP=(,PASS)                     
//OUT      DD DSN= Output file (VB/4000)                           
//TOOLIN   DD *                                                     
 SPLICE FROM(IN) TO(T1) ON(5,8,ZD) WITH(25,3996) WITHALL KEEPBASE -
 USING(CTL1) VLENOVLY                                               
 SORT FROM(T1) TO(OUT) USING(CTL2)                                 
//CTL1CNTL DD *                                                     
 INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,8,ZD,8X,30,4,5)),       
       IFTHEN=(WHEN=(25,2,CH,EQ,C'01'),                             
       OVERLAY=(5:SEQNUM,8,ZD)),                                   
       IFTHEN=(WHEN=NONE,                                           
       OVERLAY=(13:SEQNUM,8,ZD,5:5,8,ZD,SUB,13,8,ZD,M11,LENGTH=8)) 
//CTL2CNTL DD *                                                     
 OPTION EQUALS                                                     
 SORT FIELDS=(21,4,CH,A)                                           
 OUTREC BUILD=(1,4,25)   
Back to top
View user's profile Send private message
Rajasekhar K

New User


Joined: 07 Jul 2009
Posts: 3
Location: India

PostPosted: Wed Aug 05, 2009 5:34 pm
Reply with quote

Hi Arcvns,

Thank you very much.

Its working fine.

Regards,
K.Rajasekhar
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Aug 05, 2009 6:45 pm
Reply with quote

You're welcome. icon_smile.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top