0

Is there a parameter for sort programme to exclude (ignore) the first line of a file from sorting in jcl.

Thanks,

jakatas
  • 23
  • 2
  • 4

3 Answers3

3

If your Sort level is up-to-date, you can use DATASORT. Borrowed from an answer by Frank Yaeger, via google.

//S1   EXEC  PGM=ICETOOL                           
//TOOLMSG   DD  SYSOUT=*                           
//DFSMSG    DD  SYSOUT=*                           
//IN DD *                                           
FIRST                                               
AAAA                                               
CCCC                                               
DDDD                                               
FFFF                                               
GGGG                                               
//OUT DD SYSOUT=*                                   
//TOOLIN DD *                                       
DATASORT FROM(IN) TO(OUT) FIRST USING(CTL1)         
/*                                                 
//CTL1CNTL DD *                                     
  SORT FIELDS=(1,4,CH,A)                           
/*
Bill Woodger
  • 12,968
  • 4
  • 38
  • 47
  • Exactly what was asked for. The thing about DFSORT/ICETOOL is that if you search long enough for some sort of capability it can usually be found! – NealB Jan 18 '13 at 17:16
2

You can try the following:

//SYSIN    DD *   
SORT FIELDS=...
SKIPREC=1
/*

You may have to do a sort copy and in a subsequent JCL step do the sort.

Gilbert Le Blanc
  • 50,182
  • 6
  • 67
  • 111
  • Actually i dont want to reject the first line, as i said i just want to exlude it from the sort so i can keep it as a header in the sortout file, thats why i am wondering if there is a simple parameter like the skiprec one to do that (without using a temporary file), otherwise i'll try to make it by cobol. – jakatas Jan 18 '13 at 16:35
  • 1
    You can either do that with a Cobol program, or you can use IBM utilities to accomplish your task. If you use IBM utilities, your job will contain several steps and several temporary files. – Gilbert Le Blanc Jan 18 '13 at 16:44
  • yeah, i assume that's not possible with a simple parameter, i am going to make by COBOL, thanks anyway ! – jakatas Jan 18 '13 at 16:50
  • I don't think that that would be so, Gilbert. When we discover that the TS has Syncsort, which I don't think has DATASORT, there are already solutions available, in one step. – Bill Woodger Jan 18 '13 at 18:30
1

Try using the ICETOOL SUBSET operator. Here is a really simple example:

//STEP01   EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN1      DD *        -- Unsorted input data...
FIRST LINE
5
6
7
1
4
/*
//TOOLIN   DD *         -- ICETOOL commands
 SUBSET FROM(IN1) TO(OUT1) REMOVE INPUT HEADER
/*
//OUT1 DD SYSOUT=*      -- Sorted output goes here

Upon completion OUT1 contains:

1
4
5
6
7

which are the data from IN1, sorted, missing the first input line.

The DFSORT/ICETOOL manual can be found here and the ICETOOL SUBSET operator is documented here

edit

Based on your comment to Gilbert, I suggest using a second job step to IDCAMS REPRO (copy) the first record from the original input file and then concatenate it to the ICETOOL output. The JCL is relatively straight forward.

NealB
  • 16,670
  • 2
  • 39
  • 60
  • interesting but as i mentioned above, i dont want to remove the header from the sortout file i just want to remove it from from the sorting process ans let it as a header in the sortout file, i am gonna use a cobol program to do that, thanks anyway – jakatas Jan 18 '13 at 16:59