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

DFSORT Spilt file based on Records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Thu Feb 13, 2014 10:56 pm
Reply with quote

If "4444" is occurred at first time in input file then the record number should be taken and copy to entire records to output file. I am planning to write a dfsort can you you please help me.



Input File

1111
2222
3333
4444
5555
4444
6666
7777
.....
......
1000000


Output File

4444
5555
4444
6666
7777
.....
......
1000000
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 13, 2014 11:04 pm
Reply with quote

Fixed-length records or variable. That determines where you extend your data. IFTHEN=(WHEN=GROUP with BEGIN for your 4s value. OUTFIL INCLUDE= for the 4s (you only acttually need to PUSH one byte) and then BUILD to drop off the extended data.
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Fri Feb 14, 2014 8:17 am
Reply with quote

Its a fixed file.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 14, 2014 2:09 pm
Reply with quote

It wasn't actually a question (no question-mark). It was telling you how to determine where to extend your record. I think I've given you everything you need, Have a crack at it at least. If you get stuck, come back.
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Fri Feb 14, 2014 2:19 pm
Reply with quote

INREC IFTHEN=(WHEN=INIT,OVERLAY=(89:1,2)),
IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'4444'),
PUSH=(81:ID=8))
SORT FIELDS=COPY
OUTREC BUILD=(1,80)

As suggesed,I am trying this query but I am getting all the records to ouput fie but I need get only the below records

Output File

4444
5555
4444
6666
7777
.....
.....
.....

Please check this and let me know your ideas on this
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Fri Feb 14, 2014 2:33 pm
Reply with quote

I think this is what Bill meant...pls see code below

Code:

//SYSIN    DD    *                                 
  OPTION COPY                                     
  INREC IFTHEN=(WHEN=GROUP,                       
         BEGIN=(1,4,CH,EQ,C'4444'),PUSH=(81:ID=1))
  OUTFIL INCLUDE=(81,1,CH,GT,C' '),BUILD=(1,80)   


Thanks,
Ashwin.
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Fri Feb 14, 2014 2:59 pm
Reply with quote

Thanks Ashwin. I tried testing your sort card but above sort card also but I am getting the entire input records. Sequence # is not starting on C'4444' the records (i.e 4th record). I think something we have to modify this sort card
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 14, 2014 3:55 pm
Reply with quote

You have to post what you are using. I'd have done it slightly differently (PUSHed the first byte of the key, and then checked for equal to '4') but I can't see that Ashwin's control cards wouldn't work.
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Fri Feb 14, 2014 4:04 pm
Reply with quote

I am testing the below sort card but this sort is not filtering any records. I am getting entire input records to output file.
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'4444')),
PUSH=(81:ID=8))
OUTFIL INCLUDE=(81,8,ZD,GT,00000000),BUILD=(1,80)
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 14, 2014 5:10 pm
Reply with quote

Humour me. Run the following, post the test results and the full sysout from the step.

Code:
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,
  BEGIN=(1,4,CH,EQ,C'4444')),
  PUSH=(81:ID=8))
  OUTFIL INCLUDE=(81,8,ZD,GT,00000000),BUILD=(1,40,81,8)


Then try this:

Code:
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,
         BEGIN=(1,4,CH,EQ,C'4444')),
         PUSH=(81:1,1))
  OUTFIL INCLUDE=(81,1,CH,EQ,C'4'),BUILD=(1,80)
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Fri Feb 14, 2014 6:30 pm
Reply with quote

Thanks a lot. Its working fine.

OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'4444')),
PUSH=(81:ID=8))
OUTFIL INCLUDE=(81,8,ZD,GT,00000000),BUILD=(1,40,81,8)
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Feb 14, 2014 6:48 pm
Reply with quote

Did you try the other solution suggested by Bill?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 14, 2014 7:39 pm
Reply with quote

The first wasn't a suggested solution, just an attempt to show what was happening...

How the output can be considered correct, I have no clue :-)
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 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top