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

Sort some records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Nov 08, 2012 8:29 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Nov 09, 2012 6:15 pm
Reply with quote

see my post and DFSORT snippet for a better method
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 09, 2012 6:15 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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 Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top