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
 

 

How to sort a file excluding the header .

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Fri May 22, 2009 11:26 am    Post subject: How to sort a file excluding the header .
Reply with quote

i havve a file in which firrst record is header , i need to sort the rest of the dat alone.I dont have icetool , please suggest some other way
eg see the dat below.

THIS IS TEST HEADER
9876
9816
111
2323
290
Back to top
View user's profile Send private message

Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri May 22, 2009 12:31 pm    Post subject:
Reply with quote

for your example
Code:
 INCLUDE COND=(1,4,CH,NE,C'THIS')
or
Code:
 OMIT COND=(1,4,CH,EQ,C'THIS')


Garry.
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Fri May 22, 2009 2:33 pm    Post subject:
Reply with quote

Garry , include or exclude will result in the header missing in the output i, want the Header in the output with the data below sorted.

Output has to be like :

THIS IS TEST HEADER
111
290
2323
9816
9876
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri May 22, 2009 2:53 pm    Post subject:
Reply with quote

You can use below...
Code:

//S1    EXEC  PGM=SORT                                       
//SORTIN DD *                                                 
THIS IS TEST HEADER                                           
9876                                                         
9816                                                         
111                                                           
2323                                                         
290                                                           
//SORTOUT   DD SYSOUT=*                                       
//SYSOUT    DD  SYSOUT=*                                     
//SYSIN    DD  *                                             
  INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'THIS'),OVERLAY=(81:C'1')), 
        IFTHEN=(WHEN=NONE,OVERLAY=(81:C'2'))                 
  SORT FIELDS=(81,1,CH,A,1,4,CH,A)                           
  OUTREC BUILD=(1,80)       
/*     
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Fri May 22, 2009 8:07 pm    Post subject:
Reply with quote

THNK U
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri May 22, 2009 9:49 pm    Post subject:
Reply with quote

Quote:
I dont have icetool


This statement makes no sense. If you have DFSORT, you do have ICETOOL. ICETOOL has been shipped with DFSORT since 1991!

You can use this DFSORT/ICETOOL job to do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD *
THIS IS TEST HEADER
9876
9816
111
2323
290
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,4,CH,A)
/*
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Sat May 23, 2009 7:28 pm    Post subject:
Reply with quote

no Frank, i can use SYNCTOOL but not ICETOOL , i have tried it
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Sat May 23, 2009 9:08 pm    Post subject:
Reply with quote

Quote:
no Fran, i can use SYNCTOOL but not ICETOOL , i have tried it

That means you don't have DFSORT but SYNCSORT at your shop
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Sat May 23, 2009 9:10 pm    Post subject:
Reply with quote

Quote:
i can use SYNCTOOL but not ICETOOL , i have tried it
Really? Please post the SYSOUT of the job and the JCL you used-- not sure if you are using DFSORT or SyncSort, your previous topics are mix of both. Usually, at SyncSort sites ICETOOL is alaised to invoke SYNCTOOL.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Tue May 26, 2009 8:55 pm    Post subject:
Reply with quote

cvishu wrote:
no Frank, i can use SYNCTOOL but not ICETOOL , i have tried it

As Anuj indicated, SYNCTOOL ships with an alias of ICETOOL. What exactly did you execute and what was the error message that you received? If it was a syntax error, then that most likely indicates that you are running an older release of the product. Support for DATASORT was included in SYNCTOOL 1.6.2, which shipped with SyncSort for z/OS 1.3.2.
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Wed May 27, 2009 6:32 pm    Post subject:
Reply with quote

COMMAND INPUT ===> SCROLL ===> CSR
********************************* TOP OF DATA **********************************
SYT000I SYNCTOOL RELEASE 1.5.2 - COPYRIGHT 2004 SYNCSORT INC.
SYT001I INITIAL PROCESSING MODE IS "STOP"
SYT002I "TOOLIN" INTERFACE BEING USED

DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1)
SYT048E STATEMENT DOES NOT BEGIN WITH A VALID OPERATOR
SYT030I OPERATION COMPLETED WITH RETURN CODE 12

SYT015I PROCESSING MODE CHANGED FROM "STOP" TO "SCAN" DUE TO OPERATION FAILURE

SYT004I SYNCTOOL PROCESSING COMPLETED WITH RETURN CODE 12
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed May 27, 2009 7:31 pm    Post subject:
Reply with quote

cvishu,

If you're using SyncSort for z/OS 1.3 or later, I think you can achieve this using the below SyncSort job.
(This is untested as I have an older version here. icon_sad.gif)
Code:
//STEP1  EXEC  PGM=SORT                                           
//SYSOUT   DD  SYSOUT=*                                           
//SORTIN   DD *                                                   
THIS IS TEST HEADER                                               
9876                                                               
9816                                                               
111                                                               
2323                                                               
290                                                               
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD  *                                                   
  INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'THIS'),OVERLAY=(85:C'1')),       
        IFTHEN=(WHEN=NONE,BUILD=(81:1,4,JFY=(SHIFT=RIGHT),85:C'2'))
  SORT FIELDS=(85,1,CH,A,81,4,CH,A)                               
  OUTREC BUILD=(1,80)
Sambhaji,

The sort order of the output from your job and the expected output posted by the OP is NOT matching. You need to right justify the values before sorting.

Frank,

I know this is a SyncSort topic. But I am just curious whether the DFSORT's DATASORT will give the required output evenif the input values are left justified?
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Wed May 27, 2009 8:05 pm    Post subject:
Reply with quote

Arun,

Based on the OP's SYNCTOOL release, it appears that they are running SyncSort for z/OS 1.2.

The solution you posted will only produce the header message. You need to change your IFTHEN BUILD to an IFTHEN OVERLAY, which would produce the following output:
Code:
THIS IS TEST HEADER
111               
290               
2323               
9816               
9876               


In regards to the ICETOOL solution using DATASORT, here is the output that would be produced:
Code:
THIS IS TEST HEADER
111               
2323               
290               
9816               
9876               


So I guess it really depends on what the OP is looking for...
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed May 27, 2009 8:14 pm    Post subject:
Reply with quote

cvishu wrote:
Output has to be like :

THIS IS TEST HEADER
111
290
2323
9816
9876
Thanks Alissa for posting the results, We are also running SyncSort for z/OS 1.2. So besides an upgradation to the recent version, would n't it be enough to modify the above card to an IFTHEN OVERLAY to obtain the above expected results ? icon_smile.gif
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Wed May 27, 2009 9:46 pm    Post subject:
Reply with quote

As long as you keep the JFY statement, yes.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed May 27, 2009 9:59 pm    Post subject:
Reply with quote

Quote:
Frank,

I know this is a SyncSort topic. But I am just curious whether the DFSORT's DATASORT will give the required output evenif the input values are left justified?


If the data is left justified, you can use a DFSORT/ICETOOL job like the following to get the output you want:

Code:

//S1   EXEC  PGM=ICETOOL                           
//TOOLMSG   DD  SYSOUT=*                           
//DFSMSG    DD  SYSOUT=*                           
//IN DD *                                         
THIS IS TEST HEADER                               
9876                                               
9816                                               
111                                               
2323                                               
290
/*                                               
//OUT DD SYSOUT=*                                 
//TOOLIN DD *                                     
DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1)       
//CTL1CNTL DD *                                   
  INREC OVERLAY=(81:1,4,UFF,TO=ZD,LENGTH=4)       
  SORT FIELDS=(81,4,ZD,A)                         
  OUTFIL BUILD=(1,80)                             
/*
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu May 28, 2009 12:08 am    Post subject:
Reply with quote

Now it's in line with the OPs requirement.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu May 28, 2009 9:31 am    Post subject:
Reply with quote

cvishu,

Here's a SyncSort 1.2 job which should work for your requirement.
Code:
//STEP1  EXEC  PGM=SORT                                           
//SYSOUT   DD  SYSOUT=*                                           
//SORTIN   DD *                                                   
THIS IS TEST HEADER                                               
9876                                                               
9816                                                               
111                                                               
2323                                                               
290                                                               
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD  *                                                   
  INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'THIS'),OVERLAY=(85:C'1')),       
        IFTHEN=(WHEN=NONE,OVERLAY=(81:1,4,UFF,ZD,LENGTH=4,85:C'2'))
  SORT FIELDS=(85,1,CH,A,81,4,ZD,A)                               
  OUTREC BUILD=(1,80)                                             
/*
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Mon Jun 01, 2009 10:31 pm    Post subject:
Reply with quote

thnks people
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
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 CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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