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
 

 

Getting Previous line using SYNCSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Getting Previous line using SYNCSORT
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 5 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm


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