View previous topic :: View next topic |
Author |
Message |
oneofspace Beginner
Joined: 18 Nov 2008 Posts: 33 Topics: 14
|
Posted: Thu May 13, 2010 10:28 am Post subject: Finding the record from multiple input files |
|
|
Hi
I am having 30 input files of length 20. I need to find the files having the record starting with 'CON' in first 3 positions. Moreover some input files may not be having any record starting with 'CON'.
I/P: Code: | FILE 1:
11111111
22222222
33333333
CONA111AA
44444444
FILE 2:
AAAAAAA
BBBBBBBB
333333333
FILE 3:
LLLLLLL
JJJJJJJJJ
CON222222
LIKE THIS 30 INPUT FILES |
O/P: Code: | CONA111AA FILE1
CON222222 FILE3
|
Thanks in advance!
One. |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu May 13, 2010 10:59 am Post subject: |
|
|
is your expected output to include the file number?
Code: |
CONA111AA FILE1
CON222222 FILE3
|
or only those records with CON?
Code: |
CONA111AA
CON222222
|
if indeed you want to 'BUILD' a source file indicator on the output record,
a modification of this topic's solution,
though laborious, would apply. _________________ Dick Brenholtz
American living in Varel, Germany
Last edited by dbzTHEdinosauer on Thu May 13, 2010 11:08 am; edited 1 time in total |
|
Back to top |
|
|
oneofspace Beginner
Joined: 18 Nov 2008 Posts: 33 Topics: 14
|
Posted: Thu May 13, 2010 11:00 am Post subject: |
|
|
Hi Dick Brenholtz ,
I need to include the file number.
Thanks!
One. |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu May 13, 2010 11:10 am Post subject: |
|
|
see my previous post,
I have modified the post since your latest response.
see topic's solution _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu May 13, 2010 11:15 am Post subject: |
|
|
oneofspace,
The following DFSORT JCL will give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD DSN=&&HDR,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL BUILD=(20X),REMOVECC,HEADER1=('$$$')
//*
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DSN=Your input file 01,DISP=SHR
// DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DSN=Your input file 02,DISP=SHR
// DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT
// DD DSN=Your input file 03,DISP=SHR
.... all your 30 files concatenated with header like above
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(21:ID=2))
OUTFIL INCLUDE=(1,3,CH,EQ,C'CON'),BUILD=(1,10,C'FILE ',21,2)
//* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
oneofspace Beginner
Joined: 18 Nov 2008 Posts: 33 Topics: 14
|
Posted: Thu May 13, 2010 11:18 am Post subject: |
|
|
Hi Dick Brenholtz ,
Thanks for the solution. It will help me. In my job no. of passes will be coming as 30. Is there any other way to get the solution in less no. of passes?
Thanks!
One. |
|
Back to top |
|
|
oneofspace Beginner
Joined: 18 Nov 2008 Posts: 33 Topics: 14
|
Posted: Thu May 13, 2010 11:20 am Post subject: |
|
|
Sorry. I responded little bit late!!
Thanks for solution Kolusu. Excellent one!!!
One. |
|
Back to top |
|
|
ranga_subham Intermediate
Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Fri May 14, 2010 9:27 am Post subject: what is the catch? |
|
|
Kolusu,
I tried the STEP0100 without BUILD=(20X) and routed it to SYSOUT. With Build or without that I got same results. Would you pls let me know the use of BUILD in STEP0100.
Thanks. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Fri May 14, 2010 9:57 am Post subject: Re: what is the catch? |
|
|
ranga_subham wrote: | Kolusu,
I tried the STEP0100 without BUILD=(20X) and routed it to SYSOUT. With Build or without that I got same results. Would you pls let me know the use of BUILD in STEP0100.
Thanks. |
I have no clue as to what the problem is unless I can see your sysout or read your mind. You need to show me what you did. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
ranga_subham Intermediate
Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Fri May 14, 2010 10:09 am Post subject: repeat attempts |
|
|
Kolusu,
After repeating attempts with a test job I've learnt few things.
1). The LRECLs of the concatenated datasets should be the same.
2). If one uses BUILD=(20X) then the DSNs should be created with LRECL of 20.
3). If one removes BUILD=(20X) then it creates the temp file with LRECL of 80 and this enables us to use instream data.
I still don't understand why the temp file had to have the REFER BACK and why it fails with JCL ERROR if I remove it. I tried using (SHR,PASS,DELETE) / (OLD,PASS,DELETE) but without REFER BACK the job ends abnormally.
Please suggest.
Thanks. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Fri May 14, 2010 10:36 am Post subject: Re: repeat attempts |
|
|
ranga_subham wrote: | Kolusu,
After repeating attempts with a test job I've learnt few things.
1). The LRECLs of the concatenated datasets should be the same. |
DFSORT does NOT allow concatenation of different LRECL FB datasets. VB datasets with different LRECL's CAN be concatenated.
ranga_subham wrote: | 2). If one uses BUILD=(20X) then the DSNs should be created with LRECL of 20.
|
I used build=(20x) since OP mentioned that all his files are of 20 bytes LRECL
ranga_subham wrote: | 3). If one removes BUILD=(20X) then it creates the temp file with LRECL of 80 and this enables us to use instream data.
|
Since I used Sortin DD *, the default length is 80 bytes for in stream data.
ranga_subham wrote: | I still don't understand why the temp file had to have the REFER BACK and why it fails with JCL ERROR if I remove it. I tried using (SHR,PASS,DELETE) / (OLD,PASS,DELETE) but without REFER BACK the job ends abnormally. |
If you are trying to break the code I gave to OP, then Good luck. Morever it is a basic JCL 101 question and has got nothing to do with DFSORT. Read about referback in the JCL manual here
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA2B690/CCONTENTS? _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|