Page 1 of 1

JCL SORT on PS file

PostPosted: Thu Mar 11, 2010 1:03 pm
by Brindha
Hi,

I have one PS file which is a report kind of file. From that file i need to find one string and based on that i need to extract the next line.

Example:
----------------- TRIGGERED BY JOBS/DATASETS/NETWORKS ----------
JOB=FT@D0111 SCHID=234 QTM=0000 LEADTM=0000 SUBMTM=0000

I need to find the string '----------------- TRIGGERED BY JOBS/DATASETS/NETWORKS ----------' and write the next record in out put file.

Output file should contain

JOB=FT@D0111 SCHID=234 QTM=0000 LEADTM=0000 SUBMTM=0000

Thanks in advance for your help.

Brindha.

Re: JCL SORT

PostPosted: Thu Mar 11, 2010 9:18 pm
by Bill Dennis
Is it always just one line following your trigger? Never multiples?

Re: JCL SORT

PostPosted: Fri Mar 12, 2010 12:10 am
by Frank Yaeger
Brindha,

What is the RECFM and LRECL of your input file?

Re: JCL SORT

PostPosted: Fri Mar 12, 2010 11:55 am
by Brindha
Hi,

yes.. Through out the file I need to find and write the output, its a multiples.

RECFM =FBA, LRECL=100

Thanks!!

Re: JCL SORT

PostPosted: Fri Mar 12, 2010 10:36 pm
by Frank Yaeger
Here's a DFSORT job that will do what you asked for. Since your input file has RECFM=FBA, I assumed the string you're looking for starts in position 2 (after the carriage control character).

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FBA/100)
//SORTOUT DD DSN=...  output file (FBA/100)
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,64,CH,EQ,
  C'----------------- TRIGGERED BY JOBS/DATASETS/NETWORKS ----------'),
    RECORDS=2,PUSH=(101:SEQ=1))
  OUTFIL INCLUDE=(101,1,CH,EQ,C'2'),BUILD=(1,100)
/*

Re: JCL SORT

PostPosted: Wed Mar 17, 2010 3:43 pm
by Brindha
Could you please explain the syntax and I am getting the syntax error.

Re: JCL SORT

PostPosted: Wed Mar 17, 2010 10:23 pm
by Frank Yaeger
I am getting the syntax error.


Please show the //SYSOUT messages you received so I can see what error you're getting. I'm not a mindreader. (The control statements work fine when I run them with DFSORT.)

DFSORT's WHEN=GROUP function is described in detail at:

http://www.ibm.com/support/docview.wss? ... g3T7000085

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080