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

How to sort a file excluding the header .


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Fri May 22, 2009 12:31 pm
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
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
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
Reply with quote

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

DFSORT Developer


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

PostPosted: Fri May 22, 2009 9:49 pm
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
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
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

Superior Member


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

PostPosted: Sat May 23, 2009 9:10 pm
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: 496
Location: USA

PostPosted: Tue May 26, 2009 8:55 pm
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
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: 2481
Location: @my desk

PostPosted: Wed May 27, 2009 7:31 pm
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: 496
Location: USA

PostPosted: Wed May 27, 2009 8:05 pm
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: 2481
Location: @my desk

PostPosted: Wed May 27, 2009 8:14 pm
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: 496
Location: USA

PostPosted: Wed May 27, 2009 9:46 pm
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 Developer


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

PostPosted: Wed May 27, 2009 9:59 pm
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: 2481
Location: @my desk

PostPosted: Thu May 28, 2009 12:08 am
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: 2481
Location: @my desk

PostPosted: Thu May 28, 2009 9:31 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top