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 Data replication from multiple Db2 ta... kishpra DB2 5 Mon Mar 27, 2017 9:58 pm
No new posts Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm


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