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

Extract records with data from prev. record


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

New User


Joined: 22 Nov 2007
Posts: 64
Location: Germany

PostPosted: Thu Jun 04, 2009 3:14 pm
Reply with quote

Hi folks,

is it possible to extract records to an output file together with data from a previous record ?

Example (input file) :

ROOT 7777 Data
CHILDA XX 1 Data
CHILDA XX 2 Data
CHILDB Data
ROOT 4444 Data
CHILDB Data
ROOT 2222 Data
ROOT 9999 Data
CHILDA XX 1 Data

Now, I'm looking for all CHILDA records containing 'XX' on pos. 8 and the whole data of their root.

Result (output file) :

CHILDA XX 1 Data ROOT 7777 Data
CHILDA XX 2 Data ROOT 7777 Data
CHILDA XX 1 Data ROOT 9999 Data

Any ideas...?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jun 04, 2009 9:08 pm
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
ROOT    7777 Data
CHILDA XX 1 Data
CHILDA XX 2 Data
CHILDB Data
ROOT    4444 Data
CHILDB Data
ROOT    2222 Data
ROOT    9999 Data
CHILDA XX 1 Data
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'ROOT'),
    PUSH=(18:1,20))
  OUTFIL INCLUDE=(1,9,CH,EQ,C'CHILDA XX')
/*
Back to top
View user's profile Send private message
oerdgie

New User


Joined: 22 Nov 2007
Posts: 64
Location: Germany

PostPosted: Tue Jun 09, 2009 3:20 pm
Reply with quote

Hi Frank,

many thanks for your help, your solution works very well !! icon_smile.gif

Is there an Application Programming Guide available (pdf), where the GRUOP and the push option is described ?
I have only an old Guide...

Many thanks
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jun 09, 2009 8:56 pm
Reply with quote

oerdgie wrote:
Hi Frank,

many thanks for your help, your solution works very well !! icon_smile.gif

Is there an Application Programming Guide available (pdf), where the GRUOP and the push option is described ?
I have only an old Guide...

Many thanks


Check this link which explain in detail about the group and many other new functions

www-947.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
oerdgie

New User


Joined: 22 Nov 2007
Posts: 64
Location: Germany

PostPosted: Wed Jun 10, 2009 3:06 am
Reply with quote

Many thanks ! icon_biggrin.gif
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 Store the data for fixed length COBOL Programming 1
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