IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Splitting group records based on details record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sandip Mallick

New User


Joined: 02 Jun 2022
Posts: 5
Location: India

PostPosted: Thu Jun 02, 2022 1:38 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Thu Jun 02, 2022 4:03 pm
Reply with quote

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
View user's profile Send private message
Sandip Mallick

New User


Joined: 02 Jun 2022
Posts: 5
Location: India

PostPosted: Thu Jun 02, 2022 4:51 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Thu Jun 02, 2022 5:00 pm
Reply with quote

Please use code tags when representing code or data.
Back to top
View user's profile Send private message
Sandip Mallick

New User


Joined: 02 Jun 2022
Posts: 5
Location: India

PostPosted: Thu Jun 02, 2022 5:18 pm
Reply with quote

Thanks Rohit.

Can anyone please provide the solution to get the desired output.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Thu Jun 02, 2022 7:45 pm
Reply with quote

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
View user's profile Send private message
Sandip Mallick

New User


Joined: 02 Jun 2022
Posts: 5
Location: India

PostPosted: Fri Jun 03, 2022 11:59 am
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Fri Jun 03, 2022 4:58 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Jun 08, 2022 1:32 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top