Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extract records with data from prev. record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
oerdgie

New User


Joined: 22 Nov 2007
Posts: 55
Location: Germany

PostPosted: Thu Jun 04, 2009 3:14 pm    Post subject: Extract records with data from prev. record
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 Moderator


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

PostPosted: Thu Jun 04, 2009 9:08 pm    Post subject:
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: 55
Location: Germany

PostPosted: Tue Jun 09, 2009 3:20 pm    Post subject:
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    Post subject:
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

http://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: 55
Location: Germany

PostPosted: Wed Jun 10, 2009 3:06 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 2 Wed Jul 26, 2017 9:11 pm
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 5 Wed Jul 26, 2017 7:35 pm
No new posts Passing data from REXX to C programme... chong.zhou All Other Mainframe Topics 0 Wed Jul 26, 2017 4:55 pm
No new posts copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us