View previous topic :: View next topic
|
Author |
Message |
vasantha.gl
New User
Joined: 23 Sep 2011 Posts: 12 Location: Chennai
|
|
|
|
I have a file (LRECL=8, RECFM=FB), there are n number of records in that file(file is creating in one of the PGM).
Data in the file is :
Code: |
24150010
55542110
24150910
71251210
.
.
.
27665410
28551610 (till n number)
85509911
00154411
.
.
.
33456511
65627611(till n number)
55389410
20305610
72705510
.
.
.
66892010(till n number)
|
Out put as :
Code: |
55389410
20305610
72705510
.
.
.
66892010(till n number)
|
Note : 7th position there is only 10 and 11 value; I want only the 10 present in 7 position after 11 in 7 position.
Is there any way to get this solution? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
It is not clear what you mean. Can you show expected output, please.
In the Code tags. |
|
Back to top |
|
|
vasantha.gl
New User
Joined: 23 Sep 2011 Posts: 12 Location: Chennai
|
|
|
|
For Example if the input file contains 10 records as
Code: |
XXXXXX10
XXXXXX10
XXXXXX10
XXXXXX11
XXXXXX11
XXXXXX11
XXXXXX10
XXXXXX10
XXXXXX10
XXXXXX10 (where XXXXXX is numbers)
|
I need to out put as
Code: |
XXXXXX10
XXXXXX10
XXXXXX10
XXXXXX10
|
Last four records are expected out put.
Need to write a file with records having '10' at 7th position, only the Records after '11' at 7th position. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Still confusing.
You only want the records with '10' at that position? Or you want to ignore all the '11's and have anything else (which is only '10's in your sample)?
How about INCLUDE or OMIT? |
|
Back to top |
|
|
vasantha.gl
New User
Joined: 23 Sep 2011 Posts: 12 Location: Chennai
|
|
|
|
one more Example
Code: |
AAAAAA10
BBBBBA10
BBBBBB10
BBBBBC11
DDDDDD11
DDDDDE11
AAAABB10
AAAABD10
AAAADD10 |
GGGGGG10
O/P NEEDED AS
Code: |
AAAABB10
AAAABD10
AAAADD10
GGGGGG10 |
RECORDS AFTER 11 IN 08TH POSITION HAVING 10 AT 08TH POSITION SHOULD BE WRITTEN TO THE OUTPUT FILE(HERE IN THE ABOVE EXPALE LAST 4 RECORDS SATIESFIES THESE CONDITION). |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Bill,
stop being obtuse.
the requirement is very clear.
read a file and start outputting
when you have a '10' in positions 8 and 9
after you have read the last record which has a '11' in 8 and 9. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK, thanks dbz.
That'd be a GROUP with KEYBEGIN, PUSH an ID and output with ID equal to or greater than three (so, INCLUDE). With that data, anyway. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Bill,
you do realize i was being facetious (with reference to your obtuseness)
vasantha.gl,
how many groups of 11 in 8&9 are there, or can there be? |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
vasantha.gl,
Use the following DFSORT JCL which will give you the desired results.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+--
AAAAAA10
BBBBBA10
BBBBBB10
BBBBBC11
DDDDDD11
DDDDDE11
AAAABB10
AAAABD10
AAAADD10
GGGGGG10
FFFFFF10
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(7,2,CH,EQ,C'11'),PUSH=(81:SEQ=8))
OUTFIL BUILD=(1,80),INCLUDE=(81,8,ZD,GT,1,AND,7,2,CH,EQ,C'10')
//* |
|
|
Back to top |
|
|
vasantha.gl
New User
Joined: 23 Sep 2011 Posts: 12 Location: Chennai
|
|
|
|
Thanks, I got the expected result. |
|
Back to top |
|
|
|