View previous topic :: View next topic
Author
Message
Sandip Mallick New User Joined: 02 Jun 2022Posts: 5 Location: India
I have below file:
"Xxxxxxx@ff.com
"abdjfhh
"yruhfh
"rwgdjkflfefkrl uro
" ID = 7L
"record
"record
"Trlr
"Yyyyyyyy@gg.com
"sajkcjfhh
"ydkjlajhfh
"rwdkfgkflfefkrl uro
" ID = 9Z
"record
"record
"Trlr
"Zzzzzzzz@rr.com
"abdjfhhhajlrwu74943jg
"yruhfh236r7hfwkld
"rwgdjkflfefkrl uro dasjlllflw
" ID = 7K
"record
"record
"Trlr
"Aaaaaaa@ff.com
"abdjfhhfydydy
"yruhfh56777rd
"rwgdjkflfefkrl uro hioiii
" ID = 7L
"record
"record
"Trlr
Begining of Group starts wherever we find Charachter '@' in line and then Trlr in the group.
I want all the groups based on different ID's ID= 7L or 9Z or 7K in 3 different files.
O/P:
in first file
"Xxxxxxx@ff.com
"abdjfhh
"yruhfh
"rwgdjkflfefkrl uro
" ID = 7L
"record
"record
"Trlr
"Aaaaaaa@ff.com
"abdjfhhfydydy
"yruhfh56777rd
"rwgdjkflfefkrl uro hioiii
" ID = 7L
"record
"record
"Trlr
in 2nd file
"Yyyyyyyy@gg.com
"sajkcjfhh
"ydkjlajhfh
"rwdkfgkflfefkrl uro
" ID = 9Z
"record
"record
"Trlr
in 3rd file
"Zzzzzzzz@rr.com
"abdjfhhhajlrwu74943jg
"yruhfh236r7hfwkld
"rwgdjkflfefkrl uro dasjlllflw
" ID = 7K
"record
"record
"Trlr
Please provide the sort card.
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2115 Location: USA
It is your own responsibility to provide SORT cards for YOUR OWN job.
What did you try so far, to start doing your own task?
The forum members can give you hints, and advices on some errors, but only in case you were able at least using the Code button when posting here something.
Back to top
Sandip Mallick New User Joined: 02 Jun 2022Posts: 5 Location: India
I have written the below code:
Code:
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN= (1,80,SS,EQ,C'@'),
END=(2,4,CH,EQ,C'Trlr'),
PUSH=(81:1,80,SEQ=1)),
IFTHEN=(WHEN=GROUP,
BEGIN=(161,1,ZD,EQ,5,AND,8,2,CH,NE,C' '),
END=(2,4,CH,EQ,C'Trlr'),
PUSH=(162:8,2))
OUTFIL FNAMES=OUT1,INCLUDE=(162,2,CH,EQ,C'7L'),
IFTHEN=(WHEN=(161,1,ZD,EQ,5),
BUILD=(81,80,/,1,80)),
IFTHEN=(WHEN=NONE,
BUILD=(1,80))
OUTFIL FNAMES=OUT2,INCLUDE=(162,2,CH,EQ,C'9Z'),
IFTHEN=(WHEN=(161,1,ZD,EQ,5),
BUILD=(81,80,/,1,80)),
IFTHEN=(WHEN=NONE,
BUILD=(1,80))
OUTFIL FNAMES=OUT2,INCLUDE=(162,2,CH,EQ,C'7K'),
IFTHEN=(WHEN=(161,1,ZD,EQ,5),
BUILD=(81,80,/,1,80)),
IFTHEN=(WHEN=NONE,
BUILD=(1,80))
But it's not given the desired output. output coming as below:
1st output file:
Code:
"Xxxxxxx@ff.com
" ID = 7L
"record
"record
"Trlr
"Aaaaaaa@ff.com
" ID = 7L
"record
"record
"Trlr
2nd output file:
Code:
"Yyyyyyyy@gg.com
" ID = 9Z
"record
"record
"Trlr
3rd output file:
Code:
"Zzzzzzzz@rr.com
" ID = 7K
"record
"record
"Trlr
can anyone tell how to fix this so that I can get desired output.
Coded'd for you
Back to top
Rohit Umarjikar Global Moderator Joined: 21 Sep 2010Posts: 3075 Location: NYC,USA
Please use code tags when representing code or data.
Back to top
Sandip Mallick New User Joined: 02 Jun 2022Posts: 5 Location: India
Thanks Rohit.
Can anyone please provide the solution to get the desired output.
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2115 Location: USA
You need two stages to do this.
Code:
//TWOSTAGE EXEC PGM=ICETOOL
// . . . . . . . . . . . . . . . . .
//MATCHGRP DD SPACE=(TRK,(25,25))
//GROUPS DD SPACE=(TRK,(50,50))
//*
//TOOLIN DD *
COPY FROM(SORTIN) TO(MATCHGRP,GROUPS) USING(SPLT)
COPY JKFROM TO(OUT1,OUT2,OUT3) USING(JOIN)
//*
//SPLTCNTL DD *
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,80,SS,EQ,C'@'),
END=(2,4,CH,EQ,C'Trlr'),
PUSH=(81:ID=5))
OUTFIL FNAMES=MATCHGRP,
INCLUDE=(1,80,SS,C' ID ='),
PARSE=(%1=(STARTAFT=ะก'=',
STARTAT=NONBLANK,
FIXLEN=2)),
BUILD=(81,5,%1)
OUTFIL FNAMES=GROUPS,
BUILD=(1,80,
81,5)
//*
//JOINCNTL DD *
JOINKEYS F1=GROUPS,
FIELDS=(81,5,A),SORTED
JOINKEYS F2=MATCHGRP,
FIELDS=(1,5,A),SORTED
REFORMAT FIELDS=(F1:1,80,
F2:6,2)
OUTFIL FNAMES=OUT1,INCLUDE=(81,2,CH,EQ,C'7L'),
BUILD=(1,80)
OUTFIL FNAMES=OUT2,INCLUDE=(81,2,CH,EQ,C'9Z'),
BUILD=(1,80)
OUTFIL FNAMES=OUT3,INCLUDE=(81,2,CH,EQ,C'7K'),
BUILD=(1,80)
//*
Back to top
Sandip Mallick New User Joined: 02 Jun 2022Posts: 5 Location: India
Thanks Sergeyken for your suggestion !!
But for some cases ID is not present but the position of '7L', '9Z' & '7K' is fixed.
Can you please provide any other solution excluding the ID part.
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2115 Location: USA
Sandip Mallick wrote:
Thanks Sergeyken for your suggestion !!
But for some cases ID is not present but the position of '7L', '9Z' & '7K' is fixed.
Can you please provide any other solution excluding the ID part.
I'm sorry, but this is the change any IT student should be able to update.
I have already presented you the full solution, as a courtesy, which is no typical for this Expert Forum.
People who are not able to make a minor change, like 2+2 replaced with 2*2, are supposed to visit the Beginner's Forum . (Or RTFM, as real experts do).
This is not Do-My-Job-For-Me-In-Full forum!
Back to top
Rohit Umarjikar Global Moderator Joined: 21 Sep 2010Posts: 3075 Location: NYC,USA
Sandip Mallick wrote:
Thanks Sergeyken for your suggestion !!
But for some cases ID is not present but the position of '7L', '9Z' & '7K' is fixed.
Can you please provide any other solution excluding the ID part.
Please understand the SORT card and make necessary changes. If you have questions what is what please refer the manual and give a try.
Back to top
Please enable JavaScript!