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

Getting Previous line using SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
raam_kumar

New User


Joined: 25 Apr 2007
Posts: 44
Location: chennai, India

PostPosted: Mon Dec 31, 2007 4:12 pm
Reply with quote

Hi i have a following requirement

Sample input:-

AAAA
CCCC
DDDD
AAAA
CCCC
DDDD
AAAA
EEEE
CCCC
AAAA
EEEE

Expected Output:-

AAAA
EEEE
AAAA
EEEE

i.e... For every instance of 'E' (EEEE) record. i have to get the previous record (AAAA) and 'E' (EEEE) record into the output file.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Dec 31, 2007 6:42 pm
Reply with quote

Code:
//**************************
//STEP001  EXEC PGM=SYNCTOOL
//TOOLMSG  DD SYSOUT=*     
//DFSMSG   DD SYSOUT=*     
//IN1      DD *             
AAAA                       
CCCC                       
DDDD                       
AAAA                       
CCCC                       
DDDD                       
AAAA                       
EEEE                       
CCCC                       
AAAA                       
EEEE                       
/*                         
//OUT      DD SYSOUT=*     
//TOOLIN   DD *             
 SELECT FROM(IN1) TO(OUT) ON(81,8,ZD) -                 
                            USING(NKK1) ALLDUPS         
/*                                                     
//NKK1CNTL DD   *                                       
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),   
        IFTHEN=(WHEN=(1,4,CH,NE,C'EEEE'),               
          OVERLAY=(81:81,8,ZD,ADD,+1,TO=ZD,LENGTH=8))   
   OUTFIL FNAMES=OUT,BUILD=(1,80)                                 
/*                                                     
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts rewrite same SAY line CLIST & REXX 8
No new posts How to extract the data for current y... DFSORT/ICETOOL 8
Search our Forums:

Back to Top