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
 

 

Sort some records

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

New User


Joined: 30 Jul 2006
Posts: 14

PostPosted: Thu Nov 08, 2012 8:22 pm    Post subject: Sort some records
Reply with quote

Hello

I have the following input file (FB/80)
Code:

=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001  $AA.AA.CLIST                                                           
000002  $BB.B.CLIST                                                           
000003  $CC.C.CNTL                                                             
000004  ADD.D.DD.DDD.DDDD                                                     
000005  AEE.E.EE.EEEEEEE                                                       
000006  AFF.F.FF.FFFFFFF.FFFF                                                 
000007  PGG.G.GGGG.GGGG.G0001V00                                               
000008  PHH.H.HH.HHHH.HHHH                                                     
000009  PII.I.II.IIII.IIII.IIIIIII.IIII.G0016V00                               
000010  PII.I.II.IIII.IIII.IIIIIII.IIII.G0017V00                               
000011  PII.I.II.IIII.IIII.IIIIIII.IIII.G0018V00                               
000012  PJJ.JJ.J.JJJJ.JJJJ.JJJJ.G0055V00                                       
000013  PKK.K.KK.KKKK.KKK                                                     
000014  PLL.L.LL.LLLLLL.LLLLL.LLL.G0231V00                                     
000015  PMM.M.MM.MMMMMM.MMM.MMMM.G0007V00                                     
000016  PNN.N.NNN.NNNN.NNN.NNN.NNNNNNNN                                       
000017  POO.O.OOO.OOOO.OOO.OOOOOOO.OOO                                         
000018  PPP.P.PPP.PPPP.PPP.PPPPPPP.PPP.PPPP.G0001V00                           
000019  PQQ.Q.QQQ.QQQ.QQ.QQQQ.G4561V00                                         
000020  PQQ.Q.QQQ.QQQ.QQQ.QQQQ.G7659V00                                       
000021  PRR.R.RRR.RRR.RR.RRRR.G0023V00                                         
000022  PSS.S.SSS.SSS.SSS.SSSS.G0456V00                                       


First, I want only the records whose ending is V00

Code:

=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001  PGG.G.GGGG.GGGG.G0001V00                                               
000002  PII.I.II.IIII.IIII.IIIIIII.IIII.G0016V00                               
000003  PII.I.II.IIII.IIII.IIIIIII.IIII.G0017V00                               
000004  PII.I.II.IIII.IIII.IIIIIII.IIII.G0018V00                               
000005  PJJ.JJ.J.JJJJ.JJJJ.JJJJ.G0055V00                                       
000006  PLL.L.LL.LLLLLL.LLLLL.LLL.G0231V00                                     
000007  PMM.M.MM.MMMMMM.MMM.MMMM.G0007V00                                     
000008  PPP.P.PPP.PPPP.PPP.PPPPPPP.PPP.PPPP.G0001V00                           
000009  PQQ.Q.QQQ.QQQ.QQ.QQQQ.G4561V00                                         
000010  PQQ.Q.QQQ.QQQ.QQQ.QQQQ.G7659V00                                       
000011  PRR.R.RRR.RRR.RR.RRRR.G0023V00                                         
000012  PSS.S.SSS.SSS.SSS.SSSS.G0456V00                                       


Then I want to delete the last column such as ". G%%%% V00. 'The output file should look like this.

Code:

=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001  PGG.G.GGGG.GGGG                                                       
000002  PII.I.II.IIII.IIII.IIIIIII.IIII                                       
000003  PII.I.II.IIII.IIII.IIIIIII.IIII                                       
000004  PII.I.II.IIII.IIII.IIIIIII.IIII                                       
000005  PJJ.JJ.J.JJJJ.JJJJ.JJJJ                                               
000006  PLL.L.LL.LLLLLL.LLLLL.LLL                                             
000007  PMM.M.MM.MMMMMM.MMM.MMMM                                               
000008  PPP.P.PPP.PPPP.PPP.PPPPPPP.PPP.PPPP                                   
000009  PQQ.Q.QQQ.QQQ.QQ.QQQQ                                                 
000010  PQQ.Q.QQQ.QQQ.QQQ.QQQQ                                                 
000011  PRR.R.RRR.RRR.RR.RRRR                                                 
000012  PSS.S.SSS.SSS.SSS.SSSS                                                 


Could I do this with DFSORT or Icetool? I hope you can help me with my problem.

regards
Roland
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7255

PostPosted: Thu Nov 08, 2012 8:29 pm    Post subject: Reply to: Sort some records
Reply with quote

You should be able to do a Substring (SS) for "V00 " on an INCLUDE to get only those you want.

Then you'll need PARSE.

You'll only need the maximum that is valid for a DSN...

Then you need to find the first PARSEd item that is blank, and set the previous PARSEd item to space.
Back to top
View user's profile Send private message
Roland_Achtsnit

New User


Joined: 30 Jul 2006
Posts: 14

PostPosted: Fri Nov 09, 2012 6:07 pm    Post subject: Reply to: Sort some records
Reply with quote

Hello

Thank you for your reply. Now I have written the following job and it work's fine. I know the IF=THEN must be built from. G0 to. G9.

Code:

//SELECT    EXEC PGM=ICEMAN                                           
//SYSOUT    DD SYSOUT=*                                               
//SORTIN    DD -------- FB/80                                         
//SORTOUT   DD -------- FB/80                                         
//SYSIN     DD *                                                       
   INCLUDE COND=(2,44,SS,EQ,C'V00')                                   
     INREC IFOUTLEN=80,                                               
       IFTHEN=(WHEN=(2,44,SS,EQ,C'.G0'),                               
          PARSE=(%00=(STARTAT=NONBLANK,ENDBEFR=C'.G0',FIXLEN=44)),     
          BUILD=(2:%00)),                                             
       IFTHEN=(WHEN=(2,44,SS,EQ,C'.G1'),                               
          PARSE=(%01=(STARTAT=NONBLANK,ENDBEFR=C'.G1',FIXLEN=44)),     
          BUILD=(2:%01))                                               
     SUM FIELDS=NONE                                                   
     SORT FIELDS=(2,44,CH,A)                                           
/*                                                                     


Maybe someone had a better idea?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Fri Nov 09, 2012 6:15 pm    Post subject: Reply to: Sort some records
Reply with quote

see my post and DFSORT snippet for a better method
http://www.ibmmainframes.com/viewtopic.php?t=54570&highlight=build
( it will check the whole pattern of the last qualifier )
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7255

PostPosted: Fri Nov 09, 2012 6:15 pm    Post subject: Reply to: Sort some records
Reply with quote

I would make the INCLUDE for "V00 " (one trailing space).

This would allow an "ordinary" DSN which just happened to end with V00 through, but I don't think one of those should be likely, and it is possible to make it more secure.

I still think the PARSE route is better, as you may have a GDG which has a qualifier which starts G<numeric> for some reason (unlikely). I have a thought, but probably can't get at it until this evening.

EDIT: Ah, whilst typing enrico has a nice solution.
Back to top
View user's profile Send private message
Roland_Achtsnit

New User


Joined: 30 Jul 2006
Posts: 14

PostPosted: Fri Nov 09, 2012 8:43 pm    Post subject: Reply to: Sort some records
Reply with quote

Thanks to everyone for their help. This is a very good solution to move the issue of the DSN to the right.


regards
Roland
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 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 How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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