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

add additional record in between records - DFSORT


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

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Aug 07, 2012 7:56 pm
Reply with quote

Hi,

I have an input file (LRECL=80,RECFM=FB) with data as shown below:
Code:

----+----1----+----2----+----3
A1 NAME OF LENGTH 80         
A2 ADDR OF LENGTH 80         
A8 OTHR OF LENGTH 80         
ZZ ENDR OF LENGTH 80         
A1 DATA OF LENGTH 80         
A2 DATA OF LENGTH 80         
ZZ ENDR OF LENGTH 80         
A1 NAME OF LENGTH 80         
A2 ADDR OF LENGTH 80         
A7 MISC OF LENGTH 80         
ZZ ENDR OF LENGTH 80         
A1 NAME OF LENGTH 80         
A2 ADDR OF LENGTH 80         
A8 OTHR OF LENGTH 80         
ZZ ENDR OF LENGTH 80         


The above data has groups of records (each group of records start with A1 and ends with ZZ at 1st column). There are total 4 groups. My requirement is to insert A9 record after each A8 record if a group has got A8 record type. However, all the records should remain in the same order as they do appear in I/P file.

The expected output is like this:
Code:

----+----1----+----2----+----3
A1 NAME OF LENGTH 80         
A2 ADDR OF LENGTH 80         
A8 OTHR OF LENGTH 80         
A9 EXTR OF LENGTH 80         
ZZ ENDR OF LENGTH 80         
A1 DATA OF LENGTH 80         
A2 DATA OF LENGTH 80         
ZZ ENDR OF LENGTH 80         
A1 NAME OF LENGTH 80         
A2 ADDR OF LENGTH 80         
A7 MISC OF LENGTH 80         
ZZ ENDR OF LENGTH 80         
A1 NAME OF LENGTH 80         
A2 ADDR OF LENGTH 80         
A8 OTHR OF LENGTH 80         
A9 EXTR OF LENGTH 80         
ZZ ENDR OF LENGTH 80         


Is this possible with DFSORT v10 for z/OS? Please help.

Thanks.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Aug 07, 2012 8:10 pm
Reply with quote

Try an IFTHEN on OUTFIL and use the / (slash operator) when you get an A8. There are examples. Search for "slash operator".
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Aug 07, 2012 8:29 pm
Reply with quote

Bill, yes.......got the results.....thanks for the idea !!!

Code:

//SYSIN    DD *                               
 SORT FIELDS=COPY                             
 OUTFIL IFTHEN=(WHEN=(1,2,CH,EQ,C'A8'),       
 BUILD=(1,80,/,C'A9 EXTR OF LENGTH 80',60X)) 
//*                                           
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Aug 07, 2012 8:43 pm
Reply with quote

No problem. Thanks for posting your solution, it'll help someone else later.
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 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top