View previous topic :: View next topic
|
Author |
Message |
kris_madras
New User

Joined: 04 Jul 2005 Posts: 37
|
|
|
|
Need help on the logic. I have a file-aid code like this
Code: |
//S010 EXEC PGM=FILEAID
//DD01 DD DSN=TEST.INPUTFL,
// DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//DD01O DD SYSOUT=*
//SYSIN DD *
$$DD01 SPACE STOP=(1,0,C'XYZ')
$$DD01 LIST IN=6
/* |
My input file is like this.
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
XYZ
1111111
2222222
3333333
4444444
5555555
6666666
7777777
XYZ
1111111
2222222
XYZ
3333333 |
(1) The above file-aid code is printing the next 6 records as soon as it hits XYZ but only one time. Rest all 'XYZ' and next records are not processed.
But I wanted to repeat the search for 'N' number of times.
(2) The output is showing in SYSLIST. Can we write to the output file name pointed in $DD01O? The SYSLIST is showing FILE-AID version and other messages.
Thanks,
Krish |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1379 Location: Bamberg, Germany
|
|
|
|
While it might be interesting to see your final solution on this, however it's much quicker to do this simple task with a SORT product of your choice. |
|
Back to top |
|
 |
kris_madras
New User

Joined: 04 Jul 2005 Posts: 37
|
|
|
|
Hi,
I am interested to know SORT solution. But I don't want to read entire input file in sort. As soon as 'XYZ' and group records under XYZ are read 'n' number of times, I want to stop the process. |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1379 Location: Bamberg, Germany
|
|
|
|
Sample for a SORT
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,3,CH,EQ,C'XYZ'),PUSH=(20:ID=4,SEQ=1),RECORDS=7)
OUTFIL FNAMES=(SORTOUT),
INCLUDE=(20,4,ZD,LE,+2,AND,24,1,ZD,EQ,NUM),
REMOVECC,BUILD=(1,10)
END |
This will only print the first 'N'=2 groups up to a max of 6 records each. |
|
Back to top |
|
 |
kris_madras
New User

Joined: 04 Jul 2005 Posts: 37
|
|
|
|
Thank You.
But the problem is the SORT processes file from first record to end of the file and for matching XYZ, pads ID and SEQ. And then OUTFIL INCLUDE filters the records, write to the output file.
Any feature available in SYNCSORT to stop reading records as soon as it hits first 'N=2' groups? |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1379 Location: Bamberg, Germany
|
|
|
|
Of course you will have to put ID and SEQ at positions where they don't disturb. The padding, if any, is irrelevant for the problem.
For the 'N' you will have the same problem in FILEAID with putting in a stop as you will have with SORT, but a bit more worse. |
|
Back to top |
|
 |
|